import{j as t,J as b,q as o}from"./app-DB4YCWeF.js";import{A as j}from"./AuthenticatedLayout-DqLtl3fm.js";import{T as f,D as _,R as g,a as D,b as w}from"./DetailModalContent-CbTh58kC.js";import{M as c}from"./WithModal-BI-p938E.js";import{u as k}from"./BaseForm-CkSb_d40.js";import{b as y,s as M}from"./lib-C9iOZMGt.js";import"./clsx-B-dksMZM.js";import"./Select-DXXQNVxU.js";import"./index-D_LogWT2.js";function B(e){var r,u,h,x;const n=v(),s=A(),[a,m]=y(M),i=l=>{m(l)};return t.jsxs(j,{title:e==null?void 0:e.title,children:[t.jsx(f,{search:!0,filter:!0,filterOptions:s,tableHeader:n,tableBody:((u=e==null?void 0:e[(r=e==null?void 0:e.page)==null?void 0:r.name])==null?void 0:u.data)??[],tablePage:(x=e==null?void 0:e[(h=e==null?void 0:e.page)==null?void 0:h.name])==null?void 0:x.links,headerButton:()=>{var l,d;return t.jsx(t.Fragment,{children:t.jsxs(b,{href:`${(l=e==null?void 0:e.page)==null?void 0:l.url}/create`,className:"btn btn-primary w-max btn-sm text-white",children:["Tambah ",(d=e==null?void 0:e.page)==null?void 0:d.label]})})},tableAction:l=>{var d;return t.jsxs(t.Fragment,{children:[t.jsx("li",{children:t.jsx(c,{id:`detail_${l==null?void 0:l.id}`,onClick:()=>i(l),children:t.jsx("span",{children:"Lihat Detail"})})}),l.deleted_at?t.jsx("li",{children:t.jsx(c,{id:`modal_restore_${l==null?void 0:l.id}`,onClick:()=>i(l),children:"Pulihkan Data"})}):t.jsx("li",{children:t.jsx(b,{href:`${(d=e==null?void 0:e.page)==null?void 0:d.url}/${l.id}/edit`,className:"",children:"Edit"})}),t.jsx("li",{children:t.jsxs(c,{id:`modal_delete_${l==null?void 0:l.id}`,onClick:()=>i(l),children:["Hapus ",l.deleted_at?"Permanen":""]})})]})}}),a?t.jsxs(t.Fragment,{children:[t.jsx(_,{id:a==null?void 0:a.id,label:a.name,isForceDelete:a.deleted_at!=null,handleClick:()=>i(null)}),t.jsx(g,{id:a==null?void 0:a.id,label:a.name,handleClick:()=>i(null)}),t.jsx(D,{id:a==null?void 0:a.id,tableHeader:n,data:a,handleClick:()=>i(null),content:l=>w(l,n),size:"max-w-2xl"})]}):null]})}const v=()=>{const{page:e,isAdmin:n,location:s}=o().props,{params:a}=k(s);return[{label:"#",value:"id",type:"numbering"},{label:"Nama",value:"name",isModalDetail:!0},{label:"Instansi",value:"institute"},{label:"Ditambahkan",value:"created_at",type:"date",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Diperbarui",value:"updated_at",type:"date",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Dihapus",value:"deleted_at",type:"date",isHidden:a.get("deleted_at")!="show",className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Aksi",value:"id",type:"action"}]},A=()=>{const{props:e}=o();return[{name:"deleted_at",label:"Filter Data Terhapus"}]};export{B as default};
