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