import{u as j,a as g,G as f,j as e,H as b,L as N}from"./app-CyJEXGyv.js";import{A as P,u as n}from"./app-layout-DbUGBUec.js";import{P as C}from"./page-pagination-f8WRSjxd.js";import{T,a as y,b as k,c as H,d as o,e as s,f as v,g as w,h as r}from"./table-fuaFg2Mm.js";import{B as D}from"./button-COEJSQkW.js";import{A as B,M as _}from"./modal-delete-CUfNw5Hz.js";import{H as A}from"./heading-BLley4b9.js";import{C as z}from"./trash-BflsAFp1.js";import{F}from"./file-text-CLByCbPK.js";import{C as L}from"./circle-x-DtHfKmuw.js";import{C as M}from"./circle-pause-By97QX3L.js";import{C as S}from"./circle-check-big-D2NZJssq.js";import"./utils-D3rN0LeJ.js";import"./sheet-D9YCjyPN.js";import"./index-JbHgsFAK.js";import"./index-BiS8IM9B.js";import"./x-CEXz2EER.js";import"./createLucideIcon-DqnlFWer.js";import"./index-CeYyXWc4.js";import"./index-D448AvbX.js";import"./truck-DSNzHzca.js";import"./package-Ca-wQg6n.js";import"./shopping-bag-kX2qM3ec.js";import"./app-logo-icon-bwP4qd8Q.js";import"./bluetooth-context-DlC5mQaA.js";import"./index-BtT9Eyya.js";import"./index-l-_2VD5G.js";import"./sonner-DMUJNVEP.js";import"./pagination-7aOfsluw.js";import"./chevron-left-O9iIxqlL.js";import"./select-787Dhddj.js";import"./chevron-down-CelnyKCC.js";import"./input-De4RhZu7.js";import"./dialog-C64V63Fe.js";const R=[{title:"Pengeluaran",href:route("apps.expenses.index")}];function be(){const{expenses:i,perPage:d,currentPage:c}=j().props,{data:m,setData:p}=g({id:""}),[x,l]=f.useState(!1),u=a=>{l(!0),p(t=>({...t,id:a.id}))},h=a=>{switch(a){case"paid":return e.jsxs("div",{className:"flex items-center gap-1 text-green-500",children:[e.jsx(S,{className:"size-4"})," Lunas"]});case"partial":return e.jsxs("div",{className:"flex items-center gap-1 text-amber-500",children:[e.jsx(M,{className:"size-4"})," Belum Lunas"]});case"unpaid":return e.jsxs("div",{className:"flex items-center gap-1 text-rose-500",children:[e.jsx(L,{className:"size-4"})," Belum Dibayar"]});default:return"Status Tidak Dikenal"}};return e.jsxs(P,{breadcrumbs:R,children:[e.jsx(b,{title:"Pengeluaran"}),e.jsxs("div",{className:"p-4 bg-background text-foreground transition-colors",children:[e.jsx(A,{title:"Pengeluaran",description:"Halaman ini digunakan untuk mengelola data pengeluaran/biaya oprasional"}),e.jsxs("div",{className:"border border-border bg-card text-card-foreground shadow-sm rounded-xl p-4",children:[n(["expenses-create"])&&e.jsx(D,{asChild:!0,variant:"outline",children:e.jsxs(N,{href:route("apps.expenses.create"),children:[e.jsx(z,{className:"size-4"})," ",e.jsx("span",{className:"hidden sm:inline-flex font-semibold",children:"Tambah Pengeluaran"})]})}),e.jsx("div",{className:"mt-6",children:e.jsx(T,{withFilterPage:!0,currentPage:c,perPage:d,url:route("apps.expenses.index"),placeholder:"Cari data pengeluaran berdasarkan nomor pengeluaran"})}),e.jsx(y,{className:"mt-5",children:e.jsxs(k,{children:[e.jsx(H,{children:e.jsxs(o,{children:[e.jsx(s,{className:"w-[10px]",children:"No"}),e.jsx(s,{children:"No Biaya"}),e.jsx(s,{children:"No Referensi"}),e.jsx(s,{children:"Kategori"}),e.jsx(s,{children:"Subkategori"}),e.jsx(s,{children:"Tanggal"}),e.jsx(s,{children:"Jumlah"}),e.jsx(s,{className:"w-[10px] text-center",children:"Status Pengeluaran"}),e.jsx(s,{className:"w-[10px] text-center",children:"Aksi"})]})}),e.jsx(v,{children:i.data.length===0?e.jsx(w,{colSpan:9,message:"data pengeluaran"}):i.data.map((a,t)=>e.jsxs(o,{children:[e.jsx(r,{className:"text-center",children:t+1}),e.jsx(r,{children:a.expensee_number}),e.jsx(r,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[a.file!=null&&e.jsx("a",{href:a.file,target:"_blank",children:e.jsx(F,{size:16})}),a.reference_number]})}),e.jsx(r,{children:a.expense_category.name}),e.jsx(r,{children:a.expense_subcategory.name}),e.jsx(r,{children:a.date}),e.jsxs(r,{children:[e.jsx("sup",{children:"Rp"})," ",a.amount]}),e.jsx(r,{children:h(a.payment_status)}),e.jsx(r,{children:e.jsx("div",{className:"text-center",children:(n(["expenses-update"])||n(["expenses-delete"]))&&e.jsx(B,{permissionPrefix:"expenses",withDetail:!0,actionDetailHref:route("apps.expenses.show",a.id),actionEditHref:route("apps.expenses.edit",a.id),actionDelete:()=>u(a)})})})]},t))})]})}),e.jsx(_,{open:x,onOpenChange:l,url:route("apps.expenses.destroy",m.id)}),e.jsx(C,{data:i})]})]})]})}export{be as default};
