import{u as v}from"./data-C_m0Mceb.js";import{_}from"./TopBar.vue_vue_type_script_setup_true_lang-CtReUXIV.js";import{_ as f}from"./BottomNav.vue_vue_type_script_setup_true_lang-Bb1Ze8Sv.js";import{d as g,k as y,c as d,l as u,b as t,t as a,h as c,F as k,m as h,n as p,o as r,p as b}from"./index-BvsGCd9b.js";const w={class:"pb-32 min-h-dvh"},D={class:"max-w-md mx-auto px-4 pt-2"},N={key:0,class:"rounded-card bg-amber-50 border border-amber-200 p-4 mb-4"},V={class:"text-display text-amber-900 mt-1 tabular-nums"},B={key:1,class:"text-center py-12 text-ink-muted"},C={class:"flex items-start justify-between gap-3"},F={class:"flex-1 min-w-0"},I={class:"font-bold"},S={class:"text-meta text-ink-muted"},L={class:"mt-3 grid grid-cols-3 gap-2 text-meta"},T={class:"font-bold tabular-nums"},$={class:"font-bold tabular-nums"},P=g({__name:"InvoicesView",setup(j){const l=v();y(()=>l.loadInvoices());const i=p(()=>l.invoices??[]),x=o=>({paid:"bg-emerald-50 text-emerald-700 border-emerald-200",partial:"bg-amber-50   text-amber-800   border-amber-200",due:"bg-red-50     text-red-700     border-red-200"})[o??""]??"bg-slate-50 text-slate-700 border-slate-200",m=p(()=>i.value.reduce((o,e)=>o+(e.due>0?e.due:0),0)),n=o=>o.toLocaleString(void 0,{maximumFractionDigits:2});return(o,e)=>(r(),d("div",w,[u(_),t("main",D,[e[5]||(e[5]=t("h1",{class:"text-display py-4"},"Invoices",-1)),m.value>0?(r(),d("div",N,[e[0]||(e[0]=t("div",{class:"text-meta uppercase tracking-wider text-amber-800 font-bold"},"Outstanding balance",-1)),t("div",V,a(n(m.value)),1)])):c("",!0),i.value.length===0?(r(),d("div",B,[...e[1]||(e[1]=[t("div",{class:"text-5xl mb-3 opacity-60"},"🧾",-1),t("p",{class:"text-meta"},"No invoices yet.",-1)])])):c("",!0),(r(!0),d(k,null,h(i.value,s=>(r(),d("article",{key:s.id,class:"rounded-card bg-surface shadow-card p-4 mb-3"},[t("div",C,[t("div",F,[t("div",I,a(s.ref_no),1),t("div",S,a(s.date||"—"),1)]),t("span",{class:b(["px-2 py-0.5 rounded-pill text-[10px] font-bold uppercase border shrink-0",x(s.payment_status)])},a(s.payment_status||"—"),3)]),t("div",L,[t("div",null,[e[2]||(e[2]=t("div",{class:"text-micro uppercase text-ink-subtle"},"Total",-1)),t("div",T,a(n(s.total)),1)]),t("div",null,[e[3]||(e[3]=t("div",{class:"text-micro uppercase text-ink-subtle"},"Paid",-1)),t("div",$,a(n(s.paid)),1)]),t("div",null,[e[4]||(e[4]=t("div",{class:"text-micro uppercase text-ink-subtle"},"Due",-1)),t("div",{class:b(["font-bold tabular-nums",s.due>0?"text-red-600":"text-emerald-700"])},a(n(s.due)),3)])])]))),128))]),u(f)]))}});export{P as default};
//# sourceMappingURL=InvoicesView-DzxuXSWv.js.map
