PageSourceSearch

https://resthorn.org/assets/GalleryView-WqpO3Xu9.js

js resthorn.org collected 2026-10-09 22:50:52 UTC 3,421 bytes, 1 lines download raw bytes

1import{e as s,l as B,c as d,a as l,F as A,h as F,j,B as M,t as D,b as o,d as u,r as N,C as k,E as g,J as _,w as x,x as h,o as p}from"./index-DYdpvxc0.js";import{_ as V}from"./BaseFileInput-DwHUWYoU.js";import{_ as b}from"./BaseButton-D7by4iey.js";const J={class:"col-span-10 bg-slate-50 px-[6%] py-12"},L={class:"grid grid-cols-1 md:grid-cols-12 place-items-start"},R={class:"col-span-9"},q={class:"grid grid-cols-1 md:grid-cols-3 gap-4"},z=["src"],H={class:"text-lg font-semibold"},K={class:"text-sm text-gray-600"},O={class:"flex gap-4 mt-2"},P=["onClick"],Q=["onClick"],W={class:"col-span-3 flex flex-col p-6 bg-white shadow rounded"},te={__name:"GalleryView",setup(X){const w=s([]),v=async()=>{try{const e=await h.get("/admin/gallery");e.success&&(w.value=e.data)}catch(e){alert(e)}},y=s(null),m=s(""),f=s(""),I=e=>{y.value=e},U=async()=>{const e=new FormData;e.append("gallery",y.value),e.append("title",m.value),e.append("description",f.value);try{(await h.post("/admin/gallery",e)).success&&(alert("Saved"),v(),y.value=null,m.value="",f.value="")}catch(t){alert(t)}},r=s(null),n=s(null),i=s(""),c=s(""),G=e=>{r.value=e.id,n.value=null,i.value=e.title,c.value=e.description},S=e=>{n.value=e},$=async()=>{const e=new FormData;n.value&&e.append("gallery",n.value),e.append("title",i.value),e.append("description",c.value);try{(await h.patch(`/admin/gallery/${r.value}`,e)).success&&(alert("Updated"),v(),r.value=null,n.value=null,i.value="",c.value="")}catch(t){alert(t)}},E=async e=>{try{(await h.delete(`/admin/gallery/${e}`)).success&&(alert("Deleted"),v())}catch(t){alert(t)}};return B(v),(e,t)=>{const C=N("font-awesome-icon");return p(),d("section",J,[l("div",L,[l("div",R,[l("div",q,[(p(!0),d(A,null,F(w.value,a=>(p(),d("div",{key:a.id,class:"p-4 flex flex-col gap-2 shadow bg-white rounded"},[l("img",{src:j(M)+a.gallery,class:"w-full h-48 object-cover object-center rounded"},null,8,z),l("h3",H,D(a.title),1),l("p",K,D(a.description),1),l("div",O,[l("button",{onClick:T=>G(a),class:"text-blue-600 bg-blue-50 px-3 py-1 rounded"},[o(C,{icon:"edit"}),u(" Edit ")],8,P),l("button",{onClick:T=>E(a.id),class:"text-red-600 bg-red-50 px-3 py-1 rounded"},[o(C,{icon:"trash"}),u(" Delete ")],8,Q)])]))),128))])]),l("div",W,[r.value?(p(),d("form",{key:1,onSubmit:k($,["prevent"]),class:"flex flex-col gap-3"},[o(V,{onImageUpdate:S,label:"Change Image (optional)",type:"file",accept:"image/*"}),g(l("input",{"onUpdate:modelValue":t[2]||(t[2]=a=>i.value=a),placeholder:"Title",class:"border p-2 rounded"},null,512),[[_,i.value]]),g(l("textarea",{"onUpdate:modelValue":t[3]||(t[3]=a=>c.value=a),placeholder:"Description",class:"border p-2 rounded h-20"},null,512),[[_,c.value]]),o(b,{type:"submit"},{default:x(()=>[u("Update")]),_:1}),o(b,{type:"button",class:"bg-gray-500 text-white",onClick:t[4]||(t[4]=a=>{r.value=null,n.value=null})},{default:x(()=>[u(" Cancel ")]),_:1})],32)):(p(),d("form",{key:0,onSubmit:k(U,["prevent"]),class:"flex flex-col gap-3"},[o(V,{onImageUpdate:I,label:"Choose Image",type:"file",accept:"image/*"}),g(l("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>m.value=a),placeholder:"Title",class:"border p-2 rounded"},null,512),[[_,m.value]]),g(l("textarea",{"onUpdate:modelValue":t[1]||(t[1]=a=>f.value=a),placeholder:"Description",class:"border p-2 rounded h-20"},null,512),[[_,f.value]]),o(b,{type:"submit",class:"w-full"},{default:x(()=>[u("Save")]),_:1})],32))])])])}}};export{te as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.