import{j as e,q as c,J as v}from"./app-Bup04Qnx.js";import{A as y}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as D}from"./Table-B-yOTLCP.js";import{D as g,R as k}from"./RestoreModal-DxRPbH67.js";import{M as o}from"./WithModal-CbKxT3eW.js";import{u as w}from"./format-CisCU4Rs.js";import{D as F,a as S}from"./DetailModalContent-BPB3mCJa.js";import{u as A,s as C}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 s(a){return e.jsx(y,{title:a==null?void 0:a.title,children:e.jsx(p,{})})}const p=a=>{var u,m,h,x;let{tableHeader:r=null}=a;const{props:l}=c();r||(r=j());const d=f(),[i,_]=A(C),n=t=>{_(t)};return e.jsxs(e.Fragment,{children:[e.jsx(D,{search:!0,filter:!0,filterOptions:d,tableHeader:r,tableBody:((m=l==null?void 0:l[(u=l==null?void 0:l.page)==null?void 0:u.name])==null?void 0:m.data)??[],tablePage:(x=l==null?void 0:l[(h=l==null?void 0:l.page)==null?void 0:h.name])==null?void 0:x.links,tableAction:t=>{var b;return e.jsxs(e.Fragment,{children:[e.jsx("li",{children:e.jsx(o,{id:`detail_${t==null?void 0:t.id}`,onClick:()=>n(t),children:e.jsx("span",{children:"Lihat Selengkapnya"})})}),t.deleted_at?e.jsx("li",{children:e.jsx(o,{id:`modal_restore_${t==null?void 0:t.id}`,onClick:()=>n(t),children:"Pulihkan Data"})}):e.jsx("li",{children:e.jsx(v,{href:`${(b=l==null?void 0:l.page)==null?void 0:b.url}/${t.id}/edit`,className:"",children:"Edit"})}),e.jsx("li",{children:e.jsxs(o,{id:`modal_delete_${t==null?void 0:t.id}`,onClick:()=>n(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:()=>n(null)}),e.jsx(k,{id:i==null?void 0:i.id,label:i.name,handleClick:()=>n(null)}),e.jsx(F,{id:i==null?void 0:i.id,tableHeader:r,data:i,handleClick:()=>n(null),content:t=>S(t,r),size:"max-w-2xl"})]}):null]})},j=()=>{const{page:a,isAdmin:r,location:l}=c().props,{params:d}=w(l);return[{label:"#",value:"id",type:"numbering"},{value:"code",label:"Kode",isSearchable:!0},{value:"year",label:"Tahun"},{value:"month",label:"Bulan"},{value:"debit_amount",label:"Debit",type:"currency"},{value:"credit_amount",label:"Kredit",type:"currency"},{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:d.get("deleted_at")!="show"},{label:"Aksi",value:"id",type:"action"}]},f=()=>{const{props:a}=c();return[{name:"status",data:(a==null?void 0:a.status)??[],label:"Filter Status"},{name:"deleted_at",label:"Filter Data Terhapus"}]},M=({children:a})=>{const r=j();return a(r)},P=({children:a})=>{const r=f();return a(r)};s.Table=p;s.HeaderProvider=M;s.FilterProvider=P;const U=s;export{U as default};
