import{j as e,q as x,J as k}from"./app-Bup04Qnx.js";import{A as _}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as v}from"./Table-B-yOTLCP.js";import{D as g,R as S}from"./RestoreModal-DxRPbH67.js";import{M as m}from"./WithModal-CbKxT3eW.js";import{u as D}from"./format-CisCU4Rs.js";import{D as w,a as F}from"./DetailModalContent-BPB3mCJa.js";import{u as N,s as C}from"./index-Dy_g3AZ5.js";import{a as p}from"./Select-Cs0aMrtU.js";import"./index-DdNKWgRS.js";import"./clsx-B-dksMZM.js";import"./index-CtjruoRR.js";import"./floating-ui.dom-CwWDmSD9.js";import"./BaseForm-wkPKZ5Eg.js";import"./table-2-B1MKhBGJ.js";import"./DetailModalItem-BOaAAJ7m.js";function d(l){return e.jsx(_,{title:l==null?void 0:l.title,children:e.jsx(j,{})})}const j=l=>{var c,o,b;let{tableHeader:r=null}=l;const{props:a}=x();r||(r=f());const u=y(),[i,s]=N(C),n=t=>{s(t)};return e.jsxs(e.Fragment,{children:[e.jsx(v,{search:!0,filter:!0,filterOptions:u,tableHeader:r,tableBody:((o=a==null?void 0:a[(c=a==null?void 0:a.page)==null?void 0:c.name])==null?void 0:o.data)??[],tablePage:a==null?void 0:a[(b=a==null?void 0:a.page)==null?void 0:b.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:()=>n(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:()=>n(t),children:"Pulihkan Data"})}):e.jsx("li",{children:e.jsx(k,{href:`${(h=a==null?void 0:a.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:()=>n(t),children:["Hapus ",t.deleted_at?"Permanen":""]})})]})},...l}),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(S,{id:i==null?void 0:i.id,label:i.name,handleClick:()=>n(null)}),e.jsx(w,{id:i==null?void 0:i.id,tableHeader:r,data:i,handleClick:()=>n(null),content:t=>F(t,r),size:"max-w-2xl"})]}):null]})},f=()=>{const{page:l,isAdmin:r,location:a}=x().props,{params:u}=D(a);return[{label:"#",value:"id",type:"numbering"},{value:"type",label:"Tipe",isSearchable:!0,className:"capitalize",prefix:"user_bank.type"},{value:"owner",label:"Pemilik",custom:({data:s})=>{var n,c,o;return e.jsxs("td",{children:[e.jsx("div",{className:"font-semibold text-gray-700",children:s.type==="personal"?(n=s.user)==null?void 0:n.name:(c=s.company)==null?void 0:c.name}),e.jsx("div",{className:"text-xs text-gray-500",children:s.type==="personal"?p((o=s.user)==null?void 0:o.role):p("user_bank.type.company")})]})}},{value:"bank.name",label:"Bank",isSearchable:!0},{value:"account_number",label:"No. Rekening",isSearchable:!0},{value:"account_name",label:"Nama Rekening",isSearchable:!0},{value:"branch",label:"Cabang",isSearchable:!0},{value:"status",label:"Status",prefix:"user_bank.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:u.get("deleted_at")!="show"},{label:"Aksi",value:"id",type:"action"}]},y=()=>{const{props:l}=x();return[{name:"type",data:(l==null?void 0:l.types)??[],label:"Filter Tipe",prefix:"user_bank.type"},{name:"status",data:(l==null?void 0:l.status)??[],label:"Filter Status"},{name:"deleted_at",label:"Filter Data Terhapus"}]},P=({children:l})=>{const r=f();return l(r)},T=({children:l})=>{const r=y();return l(r)};d.Table=j;d.HeaderProvider=P;d.FilterProvider=T;const Q=d;export{Q as default};
