import{j as e,q as w,J as h}from"./app-Bup04Qnx.js";import{A as D}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as I}from"./Table-B-yOTLCP.js";import{c as b}from"./format-CisCU4Rs.js";import{D as f,a as g}from"./DetailModalContent-BPB3mCJa.js";import{u as _,s as A}from"./index-Dy_g3AZ5.js";import{M as y}from"./WithModal-CbKxT3eW.js";import{a as p}from"./Select-Cs0aMrtU.js";import N from"./Index-D3bNvfxU.js";import F from"./Index-CY9Ant1w.js";import{E as v}from"./eye-COhjizRe.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";import"./RejectedModal-pIH7niEQ.js";import"./TextArea-DiAj0IR8.js";import"./useFormChange-D35moWjQ.js";function T(r){return e.jsx(D,{title:r==null?void 0:r.title,Breadcrumb:H,children:e.jsx(k,{})})}const H=({currentLabel:r})=>{const{props:n}=w(),{budget_id:s}=n.request??{},l=n.location.split("/"),o=l.indexOf("budgets")+1;return l[o],e.jsx("div",{className:"text-sm text-gray-500 breadcrumbs overflow-auto scrollbar-none",children:e.jsxs("ul",{children:[e.jsx("li",{children:e.jsx(h,{href:"/admin/budgets",className:"text-primary hover:underline",children:"Anggaran"})}),e.jsx("li",{children:e.jsx(h,{href:n.location,className:"hover:underline",children:"Detail Pembayaran"})})]})})},k=r=>{let{tableHeader:n=null}=r;const{props:s}=w(),[l,o]=_(A),c=m=>{o(m)};return e.jsx(N.HeaderProvider,{children:m=>e.jsx(N.FilterProvider,{children:C=>{var d,x,u;return n||(n=m),e.jsxs(e.Fragment,{children:[e.jsx(I,{filter:!0,filterOptions:C,search:!0,addButton:!1,tableHeader:n,tableBody:((x=s==null?void 0:s[(d=s==null?void 0:s.page)==null?void 0:d.name])==null?void 0:x.data)??[],tablePage:s==null?void 0:s[(u=s==null?void 0:s.page)==null?void 0:u.name],tableAction:t=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx("li",{children:e.jsxs(y,{id:`detail_${t==null?void 0:t.id}`,onClick:()=>c(t),className:"menu-item-action",children:[e.jsx(v,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{children:"Lihat Selengkapnya"})]})}),t!=null&&t.transaction?e.jsx("li",{children:e.jsxs(y,{disabled:!(t!=null&&t.transaction),id:`detail_transaction_${t==null?void 0:t.id}`,onClick:()=>c(t),className:"menu-item-action",children:[e.jsx(v,{className:"w-4 h-4 text-blue-500"}),e.jsxs("span",{children:["Lihat Transaksi ",p(`budget.type.${(i=t==null?void 0:t.budget)==null?void 0:i.type}`)]})]})}):null]})},tableFooter:t=>{const{tableBody:i,tableHeader:j,defaultClassName:{tdBodyClassName:P,trBodyClassName:$},isTable:B=!0}=t,a=(s==null?void 0:s.paymentDetailSum)??{};return B?e.jsxs("tr",{className:`${$} bg-white w-full`,children:[e.jsx("td",{colSpan:3,className:`${P}`,children:e.jsx("div",{className:"flex items-center justify-between w-full py-3",children:e.jsx("span",{className:"font-semibold",children:"Total"})})}),e.jsx("td",{children:e.jsx("span",{className:"font-semibold",children:b((a==null?void 0:a.amount_total)??0)})}),e.jsx("td",{colSpan:10})]}):e.jsx("div",{className:"card bg-white dark:bg-gray-800 shadow-sm border border-gray-200 dark:border-gray-700 p-4 mt-4 w-full",children:e.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-center gap-4",children:[e.jsx("span",{className:"font-semibold text-lg text-gray-900 dark:text-gray-100",children:"Total"}),e.jsx("div",{className:"flex flex-wrap gap-4 justify-center sm:justify-end text-sm",children:e.jsxs("div",{className:"flex flex-col items-center sm:items-end",children:[e.jsx("span",{className:"text-gray-500 text-xs",children:"Total Pembayaran"}),e.jsx("span",{className:"font-semibold",children:b((a==null?void 0:a.amount_total)??0)})]})})]})})},...r}),l?e.jsxs(e.Fragment,{children:[e.jsx(f,{id:l==null?void 0:l.id,tableHeader:n,data:l,handleClick:()=>c(null),content:t=>g(t,n),size:"max-w-2xl"}),e.jsx(F.HeaderProvider,{children:t=>{var i;return e.jsx(f,{label:`Detail Transaksi ${p(`budget.type.${(i=l==null?void 0:l.budget)==null?void 0:i.type}`)}`,id:`transaction_${l==null?void 0:l.id}`,tableHeader:t,data:l==null?void 0:l.transaction,handleClick:()=>c(null),content:j=>g(j,t),size:"max-w-2xl"})}})]}):null]})}})})};T.Table=k;const se=T;export{se as default};
