import{Kt as e,Q as t,Qt as n,R as r,Tn as i,X as a,Y as o,Z as s,at as c,c as l,fr as u,i as d,it as f,or as p,r as m,st as h}from"./dist-CoD0k1Bd.js";import{t as g}from"./plus-DrIll_vd.js";import{t as _}from"./search-B4f4vYLn.js";import{t as v}from"./Input-C3DwKNOf.js";import{t as y}from"./button-mN_poAXs.js";import{t as b}from"./routes-BZ4t1sNs.js";import{t as x}from"./Heading-CCd5Tysh.js";import{t as S}from"./badge-n_RZ0blh.js";import{t as C}from"./Pagination-BRYVDO_a.js";var w={class:`flex flex-col space-y-6`},T={class:`flex items-center justify-between gap-4`},E={class:`w-full max-w-sm`},D={method:`GET`,action:`/billings`},O={class:`relative`},k={class:`overflow-hidden rounded-xl border`},A={class:`w-full text-sm`},j={class:`divide-y`},M={class:`px-4 py-3 font-mono font-medium`},N={class:`px-4 py-3 font-mono font-medium`},P={class:`px-4 py-3 text-muted-foreground`},F={class:`px-4 py-3 text-right tabular-nums`},I={class:`px-4 py-3 text-right tabular-nums`},L={class:`px-4 py-3 text-muted-foreground`},R={class:`px-4 py-3 text-center`},z={class:`px-4 py-3 text-right`},B={class:`flex justify-end gap-1`},V=[`href`],H={key:0},U=h({layout:{breadcrumbs:[{title:`Dashboard`,href:b()},{title:`Billing`,href:`/billings`}]},__name:`Index`,props:{billings:{},filters:{}},setup(h){let b=h,U=l().props.auth.user?.is_admin??!1,W={Pending:`outline`,Lunas:`default`,Batal:`secondary`},G=e=>`Rp `+e.toLocaleString(`id-ID`);return(l,h)=>(e(),t(r,null,[c(p(m),{title:`Billing`}),o(`div`,w,[o(`div`,T,[c(x,{title:`Billing & Deposit`,description:`Invoice deposit credit`}),c(p(y),{"as-child":``},{default:i(()=>[c(p(d),{href:`/billings/create`},{default:i(()=>[c(p(g),{class:`size-4`}),h[0]||=f(` Topup`,-1)]),_:1})]),_:1})]),o(`div`,E,[o(`form`,D,[o(`div`,O,[c(p(_),{class:`absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),c(p(v),{name:`search`,"default-value":b.filters.search??``,placeholder:`Cari nomor invoice…`,class:`pl-9`},null,8,[`default-value`])])])]),o(`div`,k,[o(`table`,A,[h[4]||=o(`thead`,{class:`bg-muted/50 text-left text-xs uppercase text-muted-foreground`},[o(`tr`,null,[o(`th`,{class:`px-4 py-3 font-medium`},`No. Invoice`),o(`th`,{class:`px-4 py-3 font-medium`},`Tanggal`),o(`th`,{class:`px-4 py-3 font-medium`},`Pengguna`),o(`th`,{class:`px-4 py-3 font-medium text-right`},`Kredit`),o(`th`,{class:`px-4 py-3 font-medium text-right`},`Total`),o(`th`,{class:`px-4 py-3 font-medium`},`Metode`),o(`th`,{class:`px-4 py-3 font-medium text-center`},`Status`),o(`th`,{class:`px-4 py-3 font-medium text-right`},`Aksi`)])],-1),o(`tbody`,j,[(e(!0),t(r,null,n(b.billings.data,n=>(e(),t(`tr`,{key:n.id,class:`hover:bg-muted/30`},[o(`td`,M,u(n.no_invoice),1),o(`td`,N,u(new Date(n.created_at).toLocaleString(`id-ID`,{timeZone:`Asia/Jakarta`})),1),o(`td`,P,u(n.user?.name??`—`),1),o(`td`,F,u(n.jumlah_credit.toLocaleString(`id-ID`)),1),o(`td`,I,u(G(n.total)),1),o(`td`,L,[c(p(S),{variant:n.payment_method===`duitku`?`default`:`outline`},{default:i(()=>[f(u(n.payment_method===`duitku`?`Duitku`:n.bank?.kode??`Manual`),1)]),_:2},1032,[`variant`])]),o(`td`,R,[c(p(S),{variant:W[n.status]??`outline`},{default:i(()=>[f(u(n.status),1)]),_:2},1032,[`variant`])]),o(`td`,z,[o(`div`,B,[n.status===`Pending`&&n.payment_method===`duitku`&&n.duitku_payment_url?(e(),a(p(y),{key:0,"as-child":``,size:`sm`},{default:i(()=>[o(`a`,{href:n.duitku_payment_url},`Bayar`,8,V)]),_:2},1024)):s(``,!0),p(U)&&n.status===`Pending`&&n.payment_method!==`duitku`?(e(),a(p(y),{key:1,"as-child":``,size:`sm`},{default:i(()=>[c(p(d),{href:`/billings/${n.id}/confirm`},{default:i(()=>[...h[1]||=[f(`Konfirmasi`,-1)]]),_:1},8,[`href`])]),_:2},1024)):s(``,!0),p(U)&&n.status===`Pending`?(e(),a(p(y),{key:2,"as-child":``,variant:`ghost`,size:`sm`},{default:i(()=>[c(p(d),{href:`/billings/${n.id}/edit`},{default:i(()=>[...h[2]||=[f(`Edit`,-1)]]),_:1},8,[`href`])]),_:2},1024)):s(``,!0)])])]))),128)),b.billings.data.length===0?(e(),t(`tr`,H,[...h[3]||=[o(`td`,{colspan:`7`,class:`px-4 py-8 text-center text-muted-foreground`},`Belum ada invoice.`,-1)]])):s(``,!0)])])]),c(C,{links:b.billings.links,from:b.billings.from,to:b.billings.to,total:b.billings.total},null,8,[`links`,`from`,`to`,`total`])])],64))}});export{U as default};