import{r as f,j as t,J as j,q as h}from"./app-Bup04Qnx.js";import{A as _}from"./AuthenticatedLayout-BdDF4YYO.js";import{M as b}from"./WithModal-CbKxT3eW.js";import{T as S}from"./Table-B-yOTLCP.js";import{D as w,R as D}from"./RestoreModal-DxRPbH67.js";import{u as N}from"./format-CisCU4Rs.js";import"./index-DdNKWgRS.js";import"./clsx-B-dksMZM.js";import"./index-CtjruoRR.js";import"./floating-ui.dom-CwWDmSD9.js";import"./index-Dy_g3AZ5.js";import"./Select-Cs0aMrtU.js";import"./BaseForm-wkPKZ5Eg.js";import"./table-2-B1MKhBGJ.js";function s(e){var d,c,m;const i=x(),r=v(),[l,u]=f.useState(null),n=a=>{u(a)};return t.jsxs(_,{title:e==null?void 0:e.title,children:[t.jsx(S,{search:!0,filter:!0,filterOptions:r,tableHeader:i,tableBody:((c=e==null?void 0:e[(d=e==null?void 0:e.page)==null?void 0:d.name])==null?void 0:c.data)??[],tablePage:e==null?void 0:e[(m=e==null?void 0:e.page)==null?void 0:m.name],tableAction:a=>{var o;return t.jsxs(t.Fragment,{children:[a.deleted_at?t.jsx("li",{children:t.jsx(b,{id:`modal_restore_${a==null?void 0:a.id}`,onClick:()=>n(a),children:"Pulihkan Data"})}):t.jsx("li",{children:t.jsx(j,{href:`${(o=e==null?void 0:e.page)==null?void 0:o.url}/${a.id}/edit`,className:"",children:"Edit"})}),t.jsx("li",{children:t.jsxs(b,{id:`modal_delete_${a==null?void 0:a.id}`,onClick:()=>n(a),children:["Hapus ",a.deleted_at?"Permanen":""]})})]})}}),l?t.jsxs(t.Fragment,{children:[t.jsx(w,{id:l==null?void 0:l.id,label:l.name,isForceDelete:l.deleted_at!=null,handleClick:()=>n(null)}),t.jsx(D,{id:l==null?void 0:l.id,label:l.name,handleClick:()=>n(null)})]}):null]})}const x=()=>{const{page:e,isAdmin:i,location:r}=h().props,{params:l}=N(r);return[{label:"#",value:"id",type:"numbering"},{label:`Nama ${e==null?void 0:e.label}`,value:"name",isSearchable:!0},{label:`Kode ${e==null?void 0:e.label}`,value:"code",className:"w-[10%]",isSearchable:!0},{label:"Dibuat Oleh",value:"user.name",className:"w-[15%]",isSearchable:!0},{label:"Total Anggota",value:"user_departments_count",valueLabel:"[value] Orang",className:"w-[15%]",defaultValue:"-"},{label:"Status",value:"status",type:"status",className:"w-[10%]"},{label:"Dibuat",value:"created_at",type:"date",isSearchable:!0,className:"w-[10%] whitespace-pre"},{label:"Diperbarui",value:"updated_at",type:"date",isSearchable:!0,className:"w-[10%] whitespace-pre"},{label:"Dihapus",value:"deleted_at",type:"date",className:"w-[10%]",isHidden:l.get("deleted_at")!="show"},{label:"Aksi",value:"id",type:"action",className:"w-[10%]"}]},v=()=>{const{props:e}=h();return[{name:"status",data:e==null?void 0:e.status,label:"Filter Status"},{name:"deleted_at",label:"Filter Data Terhapus"}]},g=({children:e})=>{const i=x();return e(i)},y=({children:e})=>{const i=v();return e(i)};s.HeaderProvider=g;s.FilterProvider=y;const J=s;export{J as default};
