var H=Object.defineProperty,U=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var j=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var R=(s,t,e)=>t in s?H(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,Y=(s,t)=>{for(var e in t||(t={}))j.call(t,e)&&R(s,e,t[e]);if(N)for(var e of N(t))q.call(t,e)&&R(s,e,t[e]);return s},w=(s,t)=>U(s,X(t));import{d as z,u as J,i as k,W as _,o as x,j as P,c as o,w as l,b as n,a as Q,Z as W,e as M,U as Z,x as A,f as c,t as b,F as G,n as K,H as ee,J as V,aN as te,aq as ae,B as oe,aO as le,aP as ne,aQ as se}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{_ as re}from"./StatusSelection.682823fe.js";/* empty css              *//* empty css              */import{R as ue}from"./ReportService.10f7d665.js";import{f as B}from"./filters.69c883c5.js";const ce=c("Search"),me=c("Clear"),_e=c("Excel "),pe=c("Total"),we=z({__name:"PackageReport",setup(s){const t=[{title:"Package",dataIndex:"name",key:"name"},{title:"Status",dataIndex:"status",key:"status"},{title:"Orders",dataIndex:"total",key:"total"},{title:"Volume",dataIndex:"volume",key:"volume"}];J();let e=k();const u=k([]);let m=k();const D=async()=>{if(!p.value&&!i.value)return K.warn("Please choose report date");const a={fromdate:p.value,todate:i.value,status:m.value};ee(),await ue.getPackageReport(a).then(r=>{V(),e.value=r.data}).catch(r=>{V()})},h=_(()=>{let a=0,r=0;return e.value.forEach(({total:d,volume:v})=>{a+=Number(d),r+=Number(v)}),{totalOrders:a,totalVolume:r}}),E=a=>{m.value=a},I=()=>{e.value=[],u.value=[],m.value=void 0},O=()=>{const a=`PackageReport.${p.value}.${i.value}.xlsx`;te(a,S.value)},p=_(()=>u.value[0]?u.value[0].format("YYYY-MM-DD"):null),i=_(()=>u.value[1]?u.value[1].format("YYYY-MM-DD"):null),S=_(()=>e&&e.value.length>0?e.value.map(a=>w(Y({},a),{total:Number(a.total),volume:Number(a.volume)})):e.value);return(a,r)=>{const d=ae,v=re,f=oe,T=Z,y=le,C=ne,F=se,L=A;return x(),P("div",null,[o(T,{size:8,style:{"margin-bottom":"8px"}},{default:l(()=>[o(d,{value:u.value,"onUpdate:value":r[0]||(r[0]=g=>u.value=g)},null,8,["value"]),o(v,{value:n(m),onChange:E},null,8,["value"]),o(f,{onClick:D},{default:l(()=>[ce]),_:1}),o(f,{onClick:I},{default:l(()=>[me]),_:1}),o(f,{disabled:!n(e)||n(e)&&n(e).length===0,type:"primary",onClick:O},{default:l(()=>[_e]),_:1},8,["disabled"])]),_:1}),n(e)?(x(),Q(L,{key:0,columns:t,"data-source":n(S),pagination:!1},W({bodyCell:l(({column:g,text:ie,record:$})=>[g.key==="volume"?(x(),P(G,{key:0},[c(b(n(B).formatMoney($.volume)),1)],64)):M("",!0)]),_:2},[n(e)?{name:"summary",fn:l(()=>[o(F,null,{default:l(()=>[o(y,{"col-span":2},{default:l(()=>[pe]),_:1}),o(y,null,{default:l(()=>[o(C,{type:"success"},{default:l(()=>[c(b(n(h).totalOrders),1)]),_:1})]),_:1}),o(y,null,{default:l(()=>[o(C,{type:"success"},{default:l(()=>[c(b(n(B).formatMoney(n(h).totalVolume)),1)]),_:1})]),_:1})]),_:1})])}:void 0]),1032,["data-source"])):M("",!0)])}}});export{we as default};
