import{j as e,q as u,J as w}from"./app-Bup04Qnx.js";import{A as v}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as _}from"./Table-B-yOTLCP.js";import{D as g,R as y}from"./RestoreModal-DxRPbH67.js";import{M as m}from"./WithModal-CbKxT3eW.js";import{u as D}from"./format-CisCU4Rs.js";import{D as S,a as k}from"./DetailModalContent-BPB3mCJa.js";import{u as F,s as N}from"./index-Dy_g3AZ5.js";import"./index-DdNKWgRS.js";import"./clsx-B-dksMZM.js";import"./index-CtjruoRR.js";import"./floating-ui.dom-CwWDmSD9.js";import"./Select-Cs0aMrtU.js";import"./BaseForm-wkPKZ5Eg.js";import"./table-2-B1MKhBGJ.js";import"./DetailModalItem-BOaAAJ7m.js";function d(a){return e.jsx(v,{title:a==null?void 0:a.title,children:e.jsx(b,{})})}const b=a=>{var n,p,x;let{tableHeader:r=null}=a;const{props:l}=u();r||(r=j());const o=f(),[i,c]=F(N),s=t=>{c(t)};return e.jsxs(e.Fragment,{children:[e.jsx(_,{search:!0,filter:!0,filterOptions:o,tableHeader:r,tableBody:((p=l==null?void 0:l[(n=l==null?void 0:l.page)==null?void 0:n.name])==null?void 0:p.data)??[],tablePage:l==null?void 0:l[(x=l==null?void 0:l.page)==null?void 0:x.name],tableAction:t=>{var h;return e.jsxs(e.Fragment,{children:[e.jsx("li",{children:e.jsx(m,{id:`detail_${t==null?void 0:t.id}`,onClick:()=>s(t),children:e.jsx("span",{children:"Lihat Selengkapnya"})})}),t.deleted_at?e.jsx("li",{children:e.jsx(m,{id:`modal_restore_${t==null?void 0:t.id}`,onClick:()=>s(t),children:"Pulihkan Data"})}):e.jsx("li",{children:e.jsx(w,{href:`${(h=l==null?void 0:l.page)==null?void 0:h.url}/${t.id}/edit`,className:"",children:"Edit"})}),e.jsx("li",{children:e.jsxs(m,{id:`modal_delete_${t==null?void 0:t.id}`,onClick:()=>s(t),children:["Hapus ",t.deleted_at?"Permanen":""]})})]})},...a}),i?e.jsxs(e.Fragment,{children:[e.jsx(g,{id:i==null?void 0:i.id,label:i.name,isForceDelete:i.deleted_at!=null,handleClick:()=>s(null)}),e.jsx(y,{id:i==null?void 0:i.id,label:i.name,handleClick:()=>s(null)}),e.jsx(S,{id:i==null?void 0:i.id,tableHeader:r,data:i,handleClick:()=>s(null),content:t=>k(t,r),size:"max-w-2xl"})]}):null]})},j=()=>{const{page:a,isAdmin:r,location:l}=u().props,{params:o}=D(l);return[{label:"#",value:"id",type:"numbering"},{value:"name",label:"Nama",isSearchable:!0,valueLabel:({data:c,value:s})=>{const n="	".repeat(c.level-1);return e.jsx("p",{className:"whitespace-pre",children:`${n}${s}`})}},{value:"level",label:"Level",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[200px] !whitespace-pre"},{value:"period_type",label:"Tipe Periode",prefix:"category.period_type",className:"text-[13px] w-[10%] md:w-[200px] !whitespace-pre"},{value:"status",label:"Status",prefix:"category.status",type:"status",className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Dibuat",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",className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre",isHidden:o.get("deleted_at")!="show"},{label:"Aksi",value:"id",type:"action"}]},f=()=>{const{props:a}=u();return[{name:"status",data:(a==null?void 0:a.status)??[],label:"Filter Status"},{name:"deleted_at",label:"Filter Data Terhapus"}]},C=({children:a})=>{const r=j();return a(r)},P=({children:a})=>{const r=f();return a(r)};d.Table=b;d.HeaderProvider=C;d.FilterProvider=P;const Q=d;export{Q as default};
