PageSourceSearch

https://white-yak-197240.hostingersite.com/build/assets/EditCommunity-C4uRjq2I.js

js white-yak-197240.hostingersite.com collected 2026-10-03 04:58:22 UTC 4,340 bytes, 1 lines download raw bytes

1import{r as x,j as e,L as E,S as F}from"./app-B835LByG.js";import{B as h}from"./button-sl7Azlq-.js";import{C as T}from"./card-Dm36Qk8i.js";import{I as m,L as I}from"./label-C_2sIW9U.js";import{T as B,S as L}from"./textarea-BcPLA1C1.js";import{A as $}from"./AuthenticatedLayout-By2Fn9Dj.js";import{S as g}from"./sweetalert2.esm.all-B0Dix5B2.js";import{X as k}from"./x-BghNlfR7.js";import"./index-DO-rpKIa.js";import"./index-CWLFM8D5.js";import"./utils-DgjiVB1k.js";import"./index-dx6lgo4y.js";import"./index-CE0Ai7XB.js";import"./index-DDeWC3bn.js";import"./createLucideIcon-Z4j02yTi.js";const f=({title:a,children:s})=>e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-lg font-semibold",children:a}),e.jsx(L,{}),e.jsx("div",{className:"space-y-4",children:s})]}),r=({label:a,children:s})=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(I,{children:a}),s]}),_=({src:a,alt:s,className:t="h-24 w-auto rounded object-cover"})=>e.jsx("div",{className:"mb-2",children:e.jsx("img",{src:`/storage/images/${a}`,alt:s,className:t})}),W=({communityData:a})=>{const s={title:a.title||"",description:a.description||"",date:a.date||"",cover:null,documentation:[],existingDocumentation:a.documentation||[],documentationToDelete:[]},[t,c]=x.useState(s),[p,u]=x.useState(!1),l=o=>{const{name:n,value:i,type:d,files:w}=o.target;d==="file"?j(n,w):c({...t,[n]:i})},j=(o,n)=>{c(o==="documentation"?{...t,[o]:n}:{...t,[o]:n[0]})},v=(o,n)=>{n&&n.preventDefault();const i=[...t.existingDocumentation],d=i.splice(o,1)[0];d.id?c({...t,existingDocumentation:i,documentationToDelete:[...t.documentationToDelete,d.id]}):c({...t,existingDocumentation:i})},D=o=>{o.preventDefault(),u(!0);const n=C();F.post(`/dashboard/community/update/${a.id}`,n,{forceFormData:!0,onSuccess:()=>{u(!1),g.fire({icon:"success",title:"Success!",text:"Data added successfully!",confirmButtonColor:"#3085d6"})},onError:i=>{u(!1),g.fire({icon:"error",title:"Error!",text:Object.values(i)[0],confirmButtonColor:"#d33"})}})};function C(){const o=new FormData;return o.append("title",t.title),o.append("description",t.description),o.append("date",t.date),o.append("keywords",t.keywords),t.cover&&o.append("cover",t.cover),b(o),o}function b(o){if(t.documentation.length>0)for(let n=0;n<t.documentation.length;n++)o.append("documentation[]",t.documentation[n]);t.existingDocumentation.forEach((n,i)=>{o.append(`existing_documentation[${i}]`,n.id)}),t.documentationToDelete.forEach((n,i)=>{o.append(`documentation_to_delete[${i}]`,n)})}const S=()=>e.jsxs(f,{title:"Basic Information",children:[e.jsx(r,{label:"Title",children:e.jsx(m,{type:"text",name:"title",value:t.title,onChange:l})}),e.jsx(r,{label:"Description",children:e.jsx(B,{name:"description",value:t.description,onChange:l,rows:6})}),e.jsx(r,{label:"Date",children:e.jsx(m,{type:"date",name:"date",value:t.date,onChange:l})}),e.jsx(r,{label:"Current Cover Image",children:a.cover&&e.jsx(_,{src:a.cover,alt:"Current cover"})}),e.jsx(r,{label:"Upload New Cover Image",children:e.jsx(m,{type:"file",name:"cover",onChange:l,accept:"image/*"})})]}),y=(o,n)=>e.jsxs("div",{className:"group relative rounded-md border p-2",children:[e.jsx("div",{className:"absolute right-1 top-1 z-10",children:e.jsx(h,{variant:"destructive",size:"icon",className:"h-6 w-6 rounded-full opacity-0 transition-opacity group-hover:opacity-100",onClick:i=>v(n,i),children:e.jsx(k,{className:"h-4 w-4"})})}),e.jsx("img",{src:`/storage/images/${o.image}`,alt:`Documentation ${n+1}`,className:"h-24 w-full rounded object-cover"}),e.jsx("p",{className:"mt-1 truncate text-xs",children:o.name})]},n),N=()=>e.jsxs(f,{title:"Documentation",children:[t.existingDocumentation.length>0&&e.jsx(r,{label:"Current Documentation",children:e.jsx("div",{className:"grid grid-cols-2 gap-2 md:grid-cols-3 lg:grid-cols-4",children:t.existingDocumentation.map(y)})}),e.jsx(r,{label:"Upload New Documentation",children:e.jsx(m,{type:"file",name:"documentation",onChange:l,accept:"image/*",multiple:!0})})]});return e.jsxs($,{header:"Edit Community Service",children:[e.jsx(E,{title:"Edit Community Service"}),e.jsx(T,{className:"p-6",children:e.jsxs("form",{onSubmit:D,encType:"multipart/form-data",className:"space-y-6",children:[S(),N(),e.jsx(h,{type:"submit",className:"w-full",disabled:p,children:p?"Saving...":"Save Community Service"})]})})]})};export{W 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.