import{j as e,q as c,J as v}from"./app-Bup04Qnx.js";import{A as _}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as g}from"./Table-B-yOTLCP.js";import{D as y,R as D}from"./RestoreModal-DxRPbH67.js";import{M as o}from"./WithModal-CbKxT3eW.js";import{u as S}from"./format-CisCU4Rs.js";import{D as k,a as w}from"./DetailModalContent-BPB3mCJa.js";import{u as F,s as A}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 n(a){return e.jsx(_,{title:a==null?void 0:a.title,children:e.jsx(p,{})})}const p=a=>{var m,u,x;let{tableHeader:r=null}=a;const{props:l}=c();r||(r=b());const d=j(),[i,f]=F(A),s=t=>{f(t)};return e.jsxs(e.Fragment,{children:[e.jsx(g,{search:!0,filter:!0,filterOptions:d,tableHeader:r,tableBody:((u=l==null?void 0:l[(m=l==null?void 0:l.page)==null?void 0:m.name])==null?void 0:u.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(o,{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(o,{id:`modal_restore_${t==null?void 0:t.id}`,onClick:()=>s(t),children:"Pulihkan Data"})}):e.jsx("li",{children:e.jsx(v,{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(o,{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(y,{id:i==null?void 0:i.id,label:i.name,isForceDelete:i.deleted_at!=null,handleClick:()=>s(null)}),e.jsx(D,{id:i==null?void 0:i.id,label:i.name,handleClick:()=>s(null)}),e.jsx(k,{id:i==null?void 0:i.id,tableHeader:r,data:i,handleClick:()=>s(null),content:t=>w(t,r),size:"max-w-2xl"})]}):null]})},b=()=>{const{page:a,isAdmin:r,location:l}=c().props,{params:d}=S(l);return[{label:"#",value:"id",type:"numbering"},{value:"name",label:"Nama",isSearchable:!0},{value:"code",label:"Kode",isSearchable:!0},{value:"address",label:"Alamat",isSearchable:!0},{value:"status",label:"Status",prefix:"company.status",type:"status"},{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"}]},j=()=>{const{props:a}=c();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=b();return a(r)},M=({children:a})=>{const r=j();return a(r)};n.Table=p;n.HeaderProvider=C;n.FilterProvider=M;const Q=n;export{Q as default};
