import{d as v}from"./datatable-CE60mo9E.js";import{_ as A,d as M,b as N,E as T,a6 as w,V as U,r as B,o as d,i as x,w as t,a as o,j as E,c as y,l as _,t as u,G as c,k as p,aL as D,aM as S,H as F,aN as H,J as P,q as j,h as q}from"./app-DyK1k-lL.js";import{U as z}from"./UserInfo-pYbiVjS2.js";import{f as G}from"./fields-C1S7sneA.js";const J=M({props:{user_id:null,paymentMode:null,dates:{default:[],type:null}},components:{UserInfo:z},setup(e){const{paymentsColumns:f,paymentsHashableColumns:b}=G(),{formatDate:g,formatAmountCurrency:h,selectedWarehouse:C}=N(),n=v();T(()=>{l(e)});const l=a=>{const s={};a.user_id&&a.user_id!=null&&(s.user_id=a.user_id),n.tableUrl.value={url:"payments?fields=id,xid,date,payment_type,amount,payment_number,user_id,x_user_id,user{id,xid,name,profile_image,profile_image_url,user_type},payment_mode_id,x_payment_mode_id,paymentMode{id,xid,name,mode_type}",filters:s,extraFilters:{dates:a.dates,payment_mode:a.paymentMode}},n.hashable.value=[...b],n.table.sorter={field:"date",order:"desc"},n.exportDetails.value={allowExport:!0,exportType:"payment_reports"},n.fetch({page:1})};w(e,(a,s)=>{l(a)}),w(C,(a,s)=>{l(e)});const i=U(()=>{let a=0;return n.table.data.forEach(s=>{a+=s.amount}),{totalAmount:a}});return{paymentsColumns:f,...n,formatDate:g,formatAmountCurrency:h,totals:i}}}),L={class:"table-responsive"};function R(e,f,b,g,h,C){const n=B("UserInfo"),l=D,i=S,a=F,s=H,V=P,I=j,$=q;return d(),x($,null,{default:t(()=>[o(I,{span:24},{default:t(()=>[E("div",L,[o(V,{columns:e.paymentsColumns,"row-key":m=>m.xid,"data-source":e.table.data,pagination:e.table.pagination,loading:e.table.loading,onChange:e.handleTableChange,id:"payment-reports-table",bordered:"",size:"middle"},{bodyCell:t(({column:m,record:r})=>{var k;return[m.dataIndex==="date"?(d(),y(c,{key:0},[_(u(e.formatDate(r.date)),1)],64)):p("",!0),m.dataIndex==="payment_type"?(d(),y(c,{key:1},[_(u(r.payment_type=="in"?e.$t("menu.payment_in"):e.$t("menu.payment_out")),1)],64)):p("",!0),m.dataIndex==="mode_type"?(d(),y(c,{key:2},[_(u(r.payment_mode&&r.payment_mode.name?(k=r.payment_mode)==null?void 0:k.name:"-"),1)],64)):p("",!0),m.dataIndex==="user_id"?(d(),x(n,{key:3,user:r.user},null,8,["user"])):p("",!0),m.dataIndex==="amount"?(d(),y(c,{key:4},[_(u(e.formatAmountCurrency(r.amount)),1)],64)):p("",!0)]}),summary:t(()=>[o(s,null,{default:t(()=>[o(l,{"col-span":4}),o(l,{"col-span":1},{default:t(()=>[o(i,{strong:""},{default:t(()=>[_(u(e.$t("common.total")),1)]),_:1})]),_:1}),o(l,{"col-span":1},{default:t(()=>[o(i,{strong:""},{default:t(()=>[o(a,null,{default:t(()=>[_(u(e.formatAmountCurrency(e.totals.totalAmount)),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1},8,["columns","row-key","data-source","pagination","loading","onChange"])])]),_:1})]),_:1})}const X=A(J,[["render",R]]);export{X as P};
