import{d as $}from"./datatable-Cnt5bvOi.js";import{_ as T,x as A,a as U,E as B,G as x,d as E,e as M,o as r,f as k,w as t,c as o,j as N,g as y,i as _,t as u,F as c,J as p,bi as D,av as F,ah as S,bj as j,aw as P,n as z,v as G}from"./app-DGDivIsO.js";import{U as H}from"./UserInfo-u_wyRiK9.js";import{f as J}from"./fields-DMP5eaRW.js";const R=A({props:{user_id:null,paymentMode:null,dates:{default:[],type:null}},components:{UserInfo:H},setup(e){const{paymentsColumns:f,paymentsHashableColumns:b}=J(),{formatDate:g,formatAmountCurrency:h,selectedWarehouse:C}=U(),n=$();B(()=>{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})};x(e,(a,s)=>{l(a)}),x(C,(a,s)=>{l(e)});const i=E(()=>{let a=0;return n.table.data.forEach(s=>{a+=s.amount}),{totalAmount:a}});return{paymentsColumns:f,...n,formatDate:g,formatAmountCurrency:h,totals:i}}}),W={class:"table-responsive"};function q(e,f,b,g,h,C){const n=M("UserInfo"),l=D,i=F,a=S,s=j,v=P,I=z,V=G;return r(),k(V,null,{default:t(()=>[o(I,{span:24},{default:t(()=>[N("div",W,[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:d})=>{var w;return[m.dataIndex==="date"?(r(),y(c,{key:0},[_(u(e.formatDate(d.date)),1)],64)):p("",!0),m.dataIndex==="payment_type"?(r(),y(c,{key:1},[_(u(d.payment_type=="in"?e.$t("menu.payment_in"):e.$t("menu.payment_out")),1)],64)):p("",!0),m.dataIndex==="mode_type"?(r(),y(c,{key:2},[_(u(d.payment_mode&&d.payment_mode.name?(w=d.payment_mode)==null?void 0:w.name:"-"),1)],64)):p("",!0),m.dataIndex==="user_id"?(r(),k(n,{key:3,user:d.user},null,8,["user"])):p("",!0),m.dataIndex==="amount"?(r(),y(c,{key:4},[_(u(e.formatAmountCurrency(d.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=T(R,[["render",q]]);export{X as P};
