1import{r as l,j as e,a as G,b as v}from"./app-e9f383ef.js";import{I as m}from"./InputLabel-db8389f3.js";import{A as P}from"./AuthenticatedLayout-24f803c5.js";import{u as $}from"./index-749b8c22.js";import{P as A}from"./Pagination-290d2859.js";import"./transition-0e44cea8.js";function J(d){const x=d.galeri,[h,g]=l.useState(!1),w={display:"flex",flexDirection:"row",flexWrap:"wrap",marginTop:16},N={display:"inline-flex",borderRadius:2,border:"1px solid #eaeaea",marginBottom:8,marginRight:8,width:132,height:90,padding:4,boxSizing:"border-box"},C={display:"flex",minWidth:0,overflow:"hidden"},D={display:"block",width:"auto",height:"100%"},[F,i]=l.useState(!1),u=()=>{i(!1)},L=()=>{i(!0)},[n,R]=l.useState({kegiatan:"",keterangan:"",tanggal:""}),c=a=>{R({...n,[a.target.name]:a.target.value})},[o,p]=l.useState([]);function S(a){const{getRootProps:s,getInputProps:t}=$({accept:{"image/*":[]},onDrop:r=>{p(r.map(k=>Object.assign(k,{preview:URL.createObjectURL(k)})))}}),z=o.map(r=>e.jsx("div",{style:N,children:e.jsx("div",{style:C,children:e.jsx("img",{src:r.preview,style:D,onLoad:()=>{URL.revokeObjectURL(r.preview)}})})},r.name));return l.useEffect(()=>()=>{o.forEach(r=>URL.revokeObjectURL(r.preview))},[o]),e.jsxs("section",{className:"container px-2 my-2 border-gray-400 border-dashed rounded-md bg-slate-200 border-spacing-2 border-1",children:[e.jsxs("div",{...s({className:"dropzone"}),children:[e.jsx("input",{...t({onChange:T})}),e.jsx("p",{className:"py-5 dark:text-white ",children:"Drag 'n' drop beberapa foto ke sini, atau klik untuk memilih file foto"})]}),e.jsx("aside",{style:w,children:z})]})}function T(a){const s=Array.from(a.target.files).map(t=>Object.assign(t,{preview:URL.createObjectURL(t)}));p(t=>t.concat(s))}const U=async a=>{a.preventDefault();const s=new FormData;for(let t=0;t<o.length;t++)s.append(`foto[${t}]`,o[t]);console.log(o),s.append("kegiatan",n.kegiatan),s.append("keterangan",n.keterangan),s.append("tanggal",n.tanggal),g(!0);try{const t=await v.post(route("adminpanel.galeri-foto.store"),s,{headers:{"Content-Type":"multipart/form-data"}});console.log(t)}catch(t){console.error(t)}g(!1),i(!1),window.location.reload()},[I,f]=l.useState(!1),[b,j]=l.useState({id:null,kegiatan:null}),M=({id:a,kegiatan:s})=>{j({id:a,kegiatan:s}),f(!0)},O=async()=>{try{const a=await v.delete(route("adminpanel.galeri-foto.destroy",b.id));console.log(a)}catch(a){console.error(a)}window.location.reload(),window.location.reload()},y=()=>{f(!1),j({id:null,kegiatan:null})};return e.jsxs("div",{className:"dark:bg-slate-900",children:[e.jsxs(P,{auth:d.auth,errors:d.errors,header:e.jsx("h2",{className:"text-xl font-semibold leading-tight text-gray-800",children:"Dashboard"}),children:[e.jsx(G,{children:e.jsx("title",{children:"Galeri Foto"})}),e.jsx("div",{className:"px-0 mx-auto mt-6 lg:px-4",children:h&&e.jsx("div",{className:"text-center text-slate-900 dark:text-slate-50",children:"Loading..."})}),e.jsx("p",{className:"col-span-4 mx-2 my-auto mt-5 font-bold lg:text-xl dark:text-white",children:"Galeri Foto"}),e.jsxs("button",{onClick:L,className:"px-2 py-2 mt-3 text-xs font-semibold text-white rounded-md xl:text-base xl:w-48 bg-accent",children:[e.jsx("i",{className:"fas fa-plus-circle",children:" "})," Tambah Galeri Foto"]}),e.jsx("div",{className:"px-0 mx-auto mt-2 rounded-md shadow-lg dark:bg-default lg:px-4 ",children:e.jsxs("div",{className:"py-2",children:[e.jsx("div",{className:"grid grid-cols-1 gap-2 py-4 sm:grid-cols-2 md:grid-cols-4 ",children:x.data.map(a=>e.jsxs("div",{className:"overflow-hidden rounded-md",children:[e.jsxs("div",{className:"flex justify-between px-2 py-2 bg-gray-900 bg-opacity-50 translate-y-11",children:[e.jsx("a",{href:`/adminpanel/galeri-foto/edit/${a.id}`,children:e.jsx("i",{className:"mx-3 text-lg text-center text-green-500 fas fa-edit"})}),e.jsx("button",{onClick:()=>M(a),children:e.jsx("i",{className:"mx-3 text-lg text-center text-red-500 fas fa-trash"})})]}),e.jsx("img",{className:"object-cover h-56 overflow-hidden w-96",src:`/assets/images/gallery/${a.foto[0]}`,alt:"Foto Kegiatan"}),e.jsx("div",{className:"h-16 text-sm text-center text-white -translate-y-16 bg-gray-900 bg-opacity-50",children:a.kegiatan})]},a.id))}),e.jsx("div",{className:"flex justify-center px-auto",children:e.jsx(A,{className:"mx-auto",links:x.links})})]})})]}),F&&e.jsx("div",{id:"createModal",tabIndex:"-1","aria-hidden":"true",className:"fixed top-0 left-0 right-0 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full",children:e.jsx("div",{className:"relative w-full h-full max-w-3xl mx-auto top-20 md:h-auto",children:e.jsxs("div",{className:"relative bg-white rounded-lg shadow-lg dark:bg-default",children:[e.jsxs("div",{className:"flex items-start justify-between p-4 border-b roun
1ded-t dark:border-gray-600",children:[e.jsx("div",{className:"flex font-semibold text-gray-900 dark:text-white",children:e.jsx("span",{className:"mr-1",children:"Tambah Foto Baru "})}),e.jsx("button",{type:"button",onClick:u,className:"close-btn text-gray-400 hover:text-gray-900 rounded-lg p-1.5 ml-auto inline-flex items-center dark:hover:text-white","galerifoto-modal-hide":"editModal",children:e.jsx("i",{className:"fas fa-times-circle"})})]}),e.jsx("div",{className:"border-b dark:border-white0 border-1 border-slate-200"}),e.jsx("div",{className:"p-6 space-y-6",children:e.jsxs("form",{onSubmit:U,encType:"multipart/form-data",children:[e.jsxs("div",{className:"grid grid-cols-3 mt-1 mr-2",children:[e.jsx(m,{htmlFor:"kegiatan",value:"Kegiatan",className:"flex py-1 text-sm text-dark dark:text-white"}),e.jsx("input",{className:"col-span-2 text-sm border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring-indigo-500",type:"text",pattern:"[^'$<>\\x22]+",title:"Tidak diperbolehkan karakter khusus",name:"kegiatan",onChange:c})]}),e.jsxs("div",{className:"grid grid-cols-3 mt-1 mr-2",children:[e.jsx(m,{htmlFor:"keterangan",value:"Keterangan",className:"flex py-1 text-sm text-dark dark:text-white"}),e.jsx("input",{className:"col-span-2 text-sm border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring-indigo-500",type:"text",pattern:"[^'$<>\\x22]+",title:"Tidak diperbolehkan karakter khusus",name:"keterangan",onChange:c})]}),e.jsxs("div",{className:"grid grid-cols-3 mt-1 mr-2",children:[e.jsx(m,{htmlFor:"tanggal",value:"Tanggal Kegiatan",className:"flex py-1 text-sm text-dark dark:text-white"}),e.jsx("input",{className:"col-span-2 text-sm border-gray-300 rounded-md shadow-sm focus:border-indigo-500 focus:ring-indigo-500",type:"date",name:"tanggal",onChange:c})]}),h&&e.jsx("span",{className:"mx-auto text-center text-red-500",children:"Mohon menunggu photo sedang diupload..."}),e.jsx(S,{}),e.jsx("p",{className:"text-sm text-red-500",children:"*)maksimal 10 foto yang diupload"}),e.jsx("div",{className:"mt-2 border-b dark:border-white0 border-1 border-slate-200"}),e.jsxs("div",{className:"grid grid-cols-3 mt-1 mr-2",children:[e.jsx("button",{type:"button",onClick:u,className:"py-2 mt-2 bg-yellow-500 rounded-md text-dark",children:"Cancel"}),e.jsx("div",{className:""}),e.jsx("button",{type:"submit",className:"py-2 mt-2 text-white rounded-md bg-accent",children:"Submit"})]})]})})]})})}),I&&e.jsx("div",{className:"fixed top-0 left-0 right-0 z-50 p-4 overflow-x-hidden overflow-y-auto md:inset-0 h-modal md:h-full",children:e.jsxs("div",{className:"relative w-full h-full max-w-3xl mx-auto top-20 md:h-auto",children:[e.jsx("div",{className:"flex flex-col p-4 border-b rounded-t dark:border-gray-600"}),e.jsx("div",{className:"col-span-5 px-3 mx-3 bg-gray-300 rounded-md shadow-md dark:bg-default shadow-red-100",children:e.jsxs("div",{className:"flex flex-col p-4 border-b rounded-t dark:border-gray-600",children:[e.jsx("button",{type:"button",onClick:y,className:"close-btn text-accent hover:bg-accent rounded-lg p-1.5 ml-auto inline-flex items-center dark:hover:text-white","delete-modal-hide":"confirmDelete",children:e.jsx("i",{className:"fas fa-times-circle"})}),e.jsxs("div",{className:"mt-4 font-bold text-center dark:text-white border-b-1 border-dark",children:['Apakah anda yakin ingin menghapus foto-foto "',b.kegiatan,'"?']}),e.jsxs("div",{className:"grid grid-cols-6 mt-1 mr-2 ",children:[e.jsx("button",{type:"button",onClick:y,className:"px-2 py-2 mt-2 bg-yellow-500 rounded-md text-dark",children:"Cancel"}),e.jsx("div",{className:"col-span-4"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",className:"px-2 py-2 mt-2 text-white rounded-md bg-accent",onClick:O,children:"Hapus"})})]})]})})]})})]})}export{J 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.