import{J as A,B as b,a0 as K,ah as O,G as Q,k as I,aR as Y,r as o,o as B,l as h,w as t,f as n,q as P,ag as C,u as l,m as M,i as v,t as c,j as Z,h as g,x as ee}from"./vendor.d12b5734.js";import te from"./BaseTable.ec8995dc.js";import{_ as ae}from"./CapsuleIcon.37dfa933.js";import{x as ne,w as le}from"./main.465728e1.js";import{u as oe}from"./payment.e5b74251.js";import{u as se}from"./global.dc565c4e.js";import"./auth.c88ceb4c.js";const me={class:"relative table-container"},re=["innerHTML"],Be={setup(ce){const{tm:ue,t:u}=A();let i=b(!1);b("created_at");let $=b(!0),y=b(null);const s=K({payment_mode:"",payment_number:""}),D=O("utils");Q();const p=oe(),_=se(),w=I(()=>!p.totalPayments&&!$.value),H=I(()=>_.currency),N=I(()=>[{key:"payment_date",label:u("payments.date"),thClass:"extra",tdClass:"font-medium text-gray-900"},{key:"payment_number",label:u("payments.payment_number")},{key:"payment_mode",label:u("payments.payment_mode")},{key:"invoice_number",label:u("invoices.invoice_number")},{key:"amount",label:u("payments.amount")},{key:"actions",label:"",tdClass:"text-right text-sm font-medium",sortable:!1}]);Y(s,()=>{R()},{debounce:500});async function T(a){return(await p.fetchPaymentModes(a,_.companySlug)).data.data}async function E({page:a,filter:r,sort:d}){let k={payment_method_id:s.payment_mode!==null?s.payment_mode:"",payment_number:s.payment_number,orderByField:d.fieldName||"created_at",orderBy:d.order||"desc",page:a};$.value=!0;let m=await p.fetchPayments(k,_.companySlug);return $.value=!1,{data:m.data.data,pagination:{totalPages:m.data.meta.last_page,currentPage:a,totalCount:m.data.meta.total,limit:10}}}function G(){y.value.refresh()}function R(){G()}function S(){s.customer="",s.payment_mode="",s.payment_number=""}function W(){i.value&&S(),i.value=!i.value}return(a,r)=>{const d=o("BaseBreadcrumbItem"),k=o("BaseBreadcrumb"),m=o("BaseIcon"),x=o("BaseButton"),z=o("BasePageHeader"),L=o("BaseInput"),V=o("BaseInputGroup"),U=o("BaseMultiselect"),q=o("BaseFilterWrapper"),J=o("BaseEmptyPlaceholder"),j=o("router-link"),X=o("BasePage");return B(),h(X,null,{default:t(()=>[n(z,{title:a.$t("payments.title")},{actions:t(()=>[P(n(x,{variant:"primary-outline",onClick:W},{right:t(e=>[l(i)?(B(),h(m,{key:1,class:M(e.class),name:"XIcon"},null,8,["class"])):(B(),h(m,{key:0,class:M(e.class),name:"FilterIcon"},null,8,["class"]))]),default:t(()=>[v(c(a.$t("general.filter"))+" ",1)]),_:1},512),[[C,l(p).totalPayments]])]),default:t(()=>[n(k,{slot:"breadcrumbs"},{default:t(()=>[n(d,{title:a.$t("general.home"),to:`/${l(_).companySlug}/customer/dashboard`},null,8,["title","to"]),n(d,{title:a.$tc("payments.payment",2),to:"#",active:""},null,8,["title"])]),_:1})]),_:1},8,["title"]),P(n(q,{onClear:S},{default:t(()=>[n(V,{label:a.$t("payments.payment_number"),class:"px-3"},{default:t(()=>[n(L,{modelValue:l(s).payment_number,"onUpdate:modelValue":r[0]||(r[0]=e=>l(s).payment_number=e),placeholder:a.$t("payments.payment_number")},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),n(V,{label:a.$t("payments.payment_mode"),class:"px-3"},{default:t(()=>[n(U,{modelValue:l(s).payment_mode,"onUpdate:modelValue":r[1]||(r[1]=e=>l(s).payment_mode=e),"value-prop":"id","track-by":"name","filter-results":!1,label:"name","resolve-on-load":"",delay:100,searchable:"",options:T,placeholder:a.$t("payments.payment_mode")},null,8,["modelValue","placeholder"])]),_:1},8,["label"])]),_:1},512),[[C,l(i)]]),l(w)?(B(),h(J,{key:0,title:a.$t("payments.no_payments"),description:a.$t("payments.list_of_payments")},{default:t(()=>[n(ae,{class:"mt-5 mb-4"})]),_:1},8,["title","description"])):Z("",!0),P(g("div",me,[n(te,{ref:(e,f)=>{f.table=e,ee(y)?y.value=e:y=e},data:E,columns:l(N),"placeholder-count":l(p).totalPayments>=20?10:5,class:"mt-10"},{"cell-payment_date":t(({row:e})=>[v(c(e.data.formatted_payment_date),1)]),"cell-payment_number":t(({row:e})=>[n(j,{to:{path:`payments/${e.data.id}/view`},class:"font-medium text-primary-500"},{default:t(()=>[v(c(e.data.payment_number),1)]),_:2},1032,["to"])]),"cell-payment_mode":t(({row:e})=>[g("span",null,c(e.data.payment_method?e.data.payment_method.name:a.$t("payments.not_selected")),1)]),"cell-invoice_number":t(({row:e})=>{var f,F;return[g("span",null,c(((f=e.data.invoice)==null?void 0:f.invoice_number)?(F=e.data.invoice)==null?void 0:F.invoice_number:a.$t("payments.no_invoice")),1)]}),"cell-amount":t(({row:e})=>[g("div",{innerHTML:l(D).formatMoney(e.data.amount,l(H))},null,8,re)]),"cell-actions":t(({row:e})=>[n(ne,null,{activator:t(()=>[n(m,{name:"DotsHorizontalIcon",class:"w-5 text-gray-500"})]),default:t(()=>[n(j,{to:`payments/${e.data.id}/view`},{default:t(()=>[n(le,null,{default:t(()=>[n(m,{name:"EyeIcon",class:"h-5 mr-3 text-gray-600"}),v(" "+c(a.$t("general.view")),1)]),_:1})]),_:2},1032,["to"])]),_:2},1024)]),_:1},8,["columns","placeholder-count"])],512),[[C,!l(w)]])]),_:1})}}};export{Be as default};
