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