import{$ as e,C as t,E as n,Ht as r,Lt as i,Q as a,R as o,W as s,_ as c,g as l,gt as u,l as d,lt as f,ut as p,v as m,w as h,y as g}from"./vue.runtime.esm-bundler-56z_v_HH.js";import{t as _}from"./store-DIrP_oUf.js";import{n as v}from"./vue-i18n-DhldrKy8.js";import{c as y}from"./main-CkEZzrzw.js";var b={class:`relative table-container`},x=n({__name:`CustomerPaymentsView`,setup(n){let x=_(),{t:S}=v(),C=p(null),w=p(!0),T=p(!1),E=f({payment_mode:``,payment_number:``}),D=l(()=>!x.totalPayments&&!w.value),O=l(()=>[{key:`payment_date`,label:S(`payments.date`),thClass:`extra`,tdClass:`font-medium text-heading`},{key:`payment_number`,label:S(`payments.payment_number`)},{key:`payment_mode`,label:S(`payments.payment_mode`)},{key:`invoice_number`,label:S(`invoices.invoice_number`)},{key:`amount`,label:S(`payments.amount`)},{key:`actions`,label:``,tdClass:`text-right text-sm font-medium`,sortable:!1}]);y(E,()=>j(),{debounce:500});async function k(e){return x.fetchPaymentModes(e)}async function A({page:e,sort:t}){let n={payment_method_id:E.payment_mode||void 0,payment_number:E.payment_number||void 0,orderByField:t.fieldName||`created_at`,orderBy:t.order||`desc`,page:e};w.value=!0;let r=await x.fetchPayments(n);return w.value=!1,{data:r.data.data,pagination:{totalPages:r.data.meta.last_page,currentPage:e,totalCount:r.data.meta.total,limit:10}}}function j(){C.value?.refresh()}function M(){E.payment_mode=``,E.payment_number=``}function N(){T.value&&M(),T.value=!T.value}return(n,l)=>{let f=s(`BaseBreadcrumbItem`),p=s(`BaseBreadcrumb`),_=s(`BaseIcon`),v=s(`BaseButton`),y=s(`BasePageHeader`),S=s(`BaseInput`),w=s(`BaseInputGroup`),j=s(`BaseMultiselect`),P=s(`BaseFilterWrapper`),F=s(`BaseEmptyPlaceholder`),I=s(`router-link`),L=s(`BaseFormatMoney`),R=s(`BaseDropdownItem`),z=s(`BaseDropdown`),B=s(`BaseTable`),V=s(`BasePage`);return o(),m(V,null,{default:a(()=>[h(y,{title:n.$t(`payments.title`)},{breadcrumbs:a(()=>[h(p,null,{default:a(()=>[h(f,{title:n.$t(`general.home`),to:`/${u(x).companySlug}/customer/dashboard`},null,8,[`title`,`to`]),h(f,{title:n.$t(`payments.payment`,2),to:`#`,active:``},null,8,[`title`])]),_:1})]),actions:a(()=>[e(h(v,{variant:`primary-outline`,onClick:N},{right:a(e=>[T.value?(o(),m(_,{key:1,class:i(e.class),name:`XMarkIcon`},null,8,[`class`])):(o(),m(_,{key:0,class:i(e.class),name:`FunnelIcon`},null,8,[`class`]))]),default:a(()=>[t(r(n.$t(`general.filter`))+` `,1)]),_:1},512),[[d,u(x).totalPayments]])]),_:1},8,[`title`]),e(h(P,{onClear:M},{default:a(()=>[h(w,{label:n.$t(`payments.payment_number`),class:`px-3`},{default:a(()=>[h(S,{modelValue:E.payment_number,"onUpdate:modelValue":l[0]||=e=>E.payment_number=e,placeholder:n.$t(`payments.payment_number`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),h(w,{label:n.$t(`payments.payment_mode`),class:`px-3`},{default:a(()=>[h(j,{modelValue:E.payment_mode,"onUpdate:modelValue":l[1]||=e=>E.payment_mode=e,"value-prop":`id`,"track-by":`name`,"filter-results":!1,label:`name`,"resolve-on-load":``,delay:100,searchable:``,options:k,placeholder:n.$t(`payments.payment_mode`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])]),_:1},512),[[d,T.value]]),D.value?(o(),m(F,{key:0,title:n.$t(`payments.no_payments`),description:n.$t(`payments.list_of_payments`)},null,8,[`title`,`description`])):g(``,!0),e(c(`div`,b,[h(B,{ref_key:`tableRef`,ref:C,data:A,columns:O.value,"placeholder-count":u(x).totalPayments>=20?10:5,class:`mt-10`},{"cell-payment_date":a(({row:e})=>[t(r(e.data.formatted_payment_date),1)]),"cell-payment_number":a(({row:e})=>[h(I,{to:{path:`payments/${e.data.id}/view`},class:`font-medium text-primary-500`},{default:a(()=>[t(r(e.data.payment_number),1)]),_:2},1032,[`to`])]),"cell-payment_mode":a(({row:e})=>[c(`span`,null,r(e.data.payment_method?.name??n.$t(`payments.not_selected`)),1)]),"cell-invoice_number":a(({row:e})=>[c(`span`,null,r(e.data.invoice?.invoice_number??n.$t(`payments.no_invoice`)),1)]),"cell-amount":a(({row:e})=>[h(L,{amount:e.data.amount,currency:u(x).currency},null,8,[`amount`,`currency`])]),"cell-actions":a(({row:e})=>[h(z,null,{activator:a(()=>[h(_,{name:`EllipsisHorizontalIcon`,class:`w-5 text-muted`})]),default:a(()=>[h(I,{to:`payments/${e.data.id}/view`},{default:a(()=>[h(R,null,{default:a(()=>[h(_,{name:`EyeIcon`,class:`h-5 mr-3 text-body`}),t(` `+r(n.$t(`general.view`)),1)]),_:1})]),_:1},8,[`to`])]),_:2},1024)]),_:1},8,[`columns`,`placeholder-count`])],512),[[d,!D.value]])]),_:1})}}});export{x as default};