import{t as e}from"./axios-m7YkukvY.js";import{A as t,L as n,N as r,St as i,W as a,_ as o,c as s,d as c,et as l,h as u,l as d,m as f}from"./runtime-core.esm-bundler-Babufkcf.js";import{t as p}from"./QChip-Bsee2q-S.js";import{t as m}from"./QTd-mJJNUD6x.js";import{t as h}from"./QPage-eKZDij2L.js";import{t as g}from"./useIncomingSearch-Ba_RAApf.js";var _={class:`row my_radio_less q-pa-sm`},v={class:`col-12`},y={class:`col-12 q-mt-sm`},b={class:`col-12`},x={key:1},S={__name:`ReceiptsPage`,setup(S){let{proxy:C}=o(),w=l([]),T=l([]),E=l(!1),D=l(``);g(e=>{D.value=e});let O=[{name:`created_at`,label:`#`,field:`id`,align:`left`},{name:`receipt_no`,label:`ReceiptNo`,field:`receipt_no`,align:`left`,sortable:!0},{name:`receipt_date`,label:`PaymentDate`,field:`receipt_date`,align:`left`,sortable:!0},{name:`payer`,label:`Payer`,field:`payer`,align:`left`},{name:`invoice`,label:`InvoiceNo`,field:`invoice`,align:`left`},{name:`amount`,label:`Amount`,field:`amount`,align:`right`,sortable:!0},{name:`amount_base`,label:`BaseAmount`,field:`amount_base`,align:`right`},{name:`method`,label:`Method`,field:`method`,align:`left`},{name:`actions`,label:`Actions`,field:`actions`,align:`right`}];function k(e){return Number(e||0).toLocaleString(`en-US`,{maximumFractionDigits:2})}function A(e){return{cash:`green-7`,bank:`blue-7`,other:`blue-grey-6`}[e]??`grey`}function j(e){return{cash:`Cash`,bank:`Bank`,other:`Other`}[e]??`Other`}async function M(){E.value=!0;try{let{data:t}=await e.get(`/receipts`);w.value=t}finally{E.value=!1}}function N(e){C.$delete(`receipts/`+e,M)}return t(M),(e,t)=>{let o=n(`m-header`),l=n(`table-stats`),g=n(`action-bar`),S=n(`n-table`),C=n(`m-backgrounds`);return r(),d(h,null,{default:a(()=>[u(C,null,{default:a(()=>[s(`div`,_,[s(`div`,v,[u(o,{icon:`payments`,controlRoomButton:`false`,class:`q-mt-xs`},{default:a(()=>[f(i(e.$t(`Receipts`)),1)]),_:1})]),s(`div`,y,[u(l,{rows:w.value,"total-label":e.$t(`TotalReceipts`),"total-icon":`receipt`,breakdown:{field:`method`,labels:{cash:`Cash`,bank:`Bank`,other:`Other`},icons:{cash:`payments`,bank:`account_balance`,other:`more_horiz`}},money:{field:`amount`,label:`TotalReceived`,icon:`savings`}},null,8,[`rows`,`total-label`])]),u(g,{rows:w.value,columns:O,filename:`receipts`,"import-key":`receipt`,"onUpdate:filtered":t[0]||=e=>T.value=e},null,8,[`rows`]),s(`div`,b,[u(S,{"config-key":`page.receipts`,loading:E.value,data:w.value,columns:O,filter:D.value,"onUpdate:filter":t[1]||=e=>D.value=e,can_delete:`receipt-delete`,noInfo:!0,noEdit:!0,onDel:N},{"body-cell-invoice":a(e=>[u(m,{props:e},{default:a(()=>[f(i(e.row.invoice?.invoice_no||`—`),1)]),_:2},1032,[`props`])]),"body-cell-amount":a(e=>[u(m,{props:e,class:`text-right`},{default:a(()=>[f(i(k(e.row.amount))+` `+i(e.row.currency),1)]),_:2},1032,[`props`])]),"body-cell-amount_base":a(e=>[u(m,{props:e,class:`text-right text-weight-bold text-primary`},{default:a(()=>[f(i(k(e.row.amount_base)),1)]),_:2},1032,[`props`])]),"body-cell-method":a(t=>[u(m,{props:t},{default:a(()=>[t.row.method?(r(),d(p,{key:0,dense:``,size:`sm`,color:A(t.row.method),"text-color":`white`},{default:a(()=>[f(i(e.$t(j(t.row.method))),1)]),_:2},1032,[`color`])):(r(),c(`span`,x,`—`))]),_:2},1032,[`props`])]),_:1},8,[`loading`,`data`,`filter`])])])]),_:1})]),_:1})}}};export{S as default};