import{j as e,q as d}from"./app-Bup04Qnx.js";import{A as y}from"./AuthenticatedLayout-BdDF4YYO.js";import{T as w}from"./Table-B-yOTLCP.js";import{c as i,u as S}from"./format-CisCU4Rs.js";import{D as _,a as T}from"./DetailModalContent-BPB3mCJa.js";import{M as A}from"./WithModal-CbKxT3eW.js";import{u as k,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 c(l){return e.jsx(y,{title:l==null?void 0:l.title,children:e.jsx(f,{})})}const f=l=>{var u,h,b;let{tableHeader:n=null}=l;const{props:a}=d();n||(n=j());const x=p(),[s,g]=k(C),m=r=>{g(r)};return e.jsxs(e.Fragment,{children:[e.jsx(w,{search:!0,filter:!0,filterOptions:x,tableHeader:n,addButton:!1,tableBody:((h=a==null?void 0:a[(u=a==null?void 0:a.page)==null?void 0:u.name])==null?void 0:h.data)??[],tablePage:a==null?void 0:a[(b=a==null?void 0:a.page)==null?void 0:b.name],tableAction:r=>e.jsx(e.Fragment,{children:e.jsx("li",{children:e.jsx(A,{id:`detail_${r==null?void 0:r.id}`,onClick:()=>m(r),children:e.jsx("span",{children:"Lihat Selengkapnya"})})})}),tableFooter:r=>{const{tableBody:B,tableHeader:D,defaultClassName:{tdBodyClassName:o,trBodyClassName:N},isTable:v=!0}=r,t=(a==null?void 0:a.summary)??{};return v?e.jsxs("tr",{className:`${N} bg-white w-full`,children:[e.jsx("td",{colSpan:3,className:`${o}`,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",{className:`${o}`,children:e.jsx("span",{className:"font-semibold text-blue-600",children:i((t==null?void 0:t.total_debit)??0)})}),e.jsx("td",{className:`${o}`,children:e.jsx("span",{className:"font-semibold text-orange-600",children:i((t==null?void 0:t.total_credit)??0)})}),e.jsx("td",{className:`${o}`,children:e.jsx("span",{className:"font-semibold text-green-600",children:i((t==null?void 0:t.total_remaining)??0)})}),e.jsx("td",{colSpan:5})]}):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 gap-3",children:[e.jsx("span",{className:"font-semibold text-lg text-gray-900 dark:text-gray-100",children:"Total Keseluruhan"}),e.jsxs("div",{className:"flex flex-wrap gap-4 text-sm",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-gray-500 text-xs",children:"Total Anggaran"}),e.jsx("span",{className:"font-semibold text-blue-600",children:i((t==null?void 0:t.total_debit)??0)})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-gray-500 text-xs",children:"Total Realisasi"}),e.jsx("span",{className:"font-semibold text-orange-600",children:i((t==null?void 0:t.total_credit)??0)})]}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"text-gray-500 text-xs",children:"Sisa Saldo"}),e.jsx("span",{className:"font-semibold text-green-600",children:i((t==null?void 0:t.total_remaining)??0)})]})]})]})})},...l}),s?e.jsx(e.Fragment,{children:e.jsx(_,{id:s==null?void 0:s.id,tableHeader:n,data:s,handleClick:()=>m(null),content:r=>T(r,n),size:"max-w-2xl"})}):null]})},j=()=>{const{page:l,isAdmin:n,location:a}=d().props;return S(a),[{label:"#",value:"id",type:"numbering"},{value:"code",label:"Kode",isSearchable:!0},{value:"department.name",label:"Departemen",isSearchable:!0},{value:"debit_amount",label:"Total Anggaran",type:"currency"},{value:"credit_amount",label:"Realisasi",type:"currency"},{value:"remaining_amount",label:"Sisa Saldo",type:"currency",render:s=>i(((s==null?void 0:s.debit_amount)??0)-((s==null?void 0:s.credit_amount)??0))},{value:"year",label:"Tahun"},{value:"user.name",label:"PIC",isDetail:!0},{value:"company.name",label:"Perusahaan",isDetail:!0},{label:"Waktu",value:"created_at",type:"date",isSearchable:!0,className:"text-[13px] w-[10%] md:w-[100px] !whitespace-pre"},{label:"Aksi",value:"id",type:"action"}]},p=()=>{const{props:l}=d();return[]},F=({children:l})=>{const n=j();return l(n)},P=({children:l})=>{const n=p();return l(n)};c.Table=f;c.HeaderProvider=F;c.FilterProvider=P;const U=c;export{U as default};
