var U=Object.defineProperty,q=Object.defineProperties;var H=Object.getOwnPropertyDescriptors;var w=Object.getOwnPropertySymbols;var X=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;var I=(o,t,e)=>t in o?U(o,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[t]=e,R=(o,t)=>{for(var e in t||(t={}))X.call(t,e)&&I(o,e,t[e]);if(w)for(var e of w(t))j.call(t,e)&&I(o,e,t[e]);return o},Y=(o,t)=>q(o,H(t));import{d as L,i,q as z,E as J,s as O,o as f,a as M,b as n,P as W,u as A,W as S,j as B,c as s,w as v,e as D,U as G,x as K,v as Q,F as Z,f as y,t as ee,n as te,H as ae,J as E,aN as oe,aq as le,B as ne}from"./index.29cf2edd.js";/* 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 se}from"./filters.69c883c5.js";import{_ as ie}from"./VisaTypeSelection.8f552476.js";const ce=L({__name:"CountrySelection",props:{value:{type:Number}},emits:["change"],setup(o,{emit:t}){const e=o,l=i();let c=i(),r=i();z(()=>{r.value=!0,J.getCountries().then(u=>{c.value=u.data,r.value=!1}).catch(u=>{r.value=!1})});const m=(u,_)=>_.name.toLowerCase().indexOf(u.toLowerCase())>=0,C=()=>{t("change",l.value)};return O(()=>e.value,u=>{u||(l.value=null)}),(u,_)=>{const g=W;return f(),M(g,{value:l.value,"onUpdate:value":_[0]||(_[0]=h=>l.value=h),"show-search":"",placeholder:"Choose a country",options:n(c),"field-names":{label:"nicename",value:"iso"},"filter-option":m,loading:n(r),disabled:n(r),onChange:C,"clear-icon":"","allow-clear":""},null,8,["value","options","loading","disabled"])}}}),me=y("Search"),de=y("Clear"),_e=y("Excel "),Ye=L({__name:"CustomerReport",setup(o){const t=[{title:"Customer",dataIndex:"user",key:"user"},{title:"Phone",dataIndex:"phone",key:"phone"},{title:"Nationality",dataIndex:"countryname",key:"countryname"},{title:"Country Code",dataIndex:"countrycode",key:"countrycode"},{title:"Email",dataIndex:"email",key:"email"},{title:"Total Buy",dataIndex:"order_total",key:"order_total"},{title:"Total Buy Volume",dataIndex:"order_volume",key:"order_volume"},{title:"Total Claim",dataIndex:"claim_total",key:"claim_total"},{title:"Total Claim Volume",dataIndex:"claim_volume",key:"claim_volume"}];A();let e=i();const l=i([]);let c=i(),r=i(),m=i();const C=async()=>{if(!x.value&&!k.value)return te.warn("Please choose report date");const a={fromdate:x.value,todate:k.value,status:c.value,country:r.value,visatype_id:m.value};ae(),await ue.getCustomerReport(a).then(d=>{E(),e.value=d.data}).catch(d=>{E()})},u=a=>{c.value=a},_=a=>{r.value=a},g=()=>{e.value=[],l.value=[],c.value=void 0},h=()=>{const a=`CustomerReport.${x.value}.${k.value}.xlsx`;oe(a,N.value)},x=S(()=>l.value[0]?l.value[0].format("YYYY-MM-DD"):null),k=S(()=>l.value[1]?l.value[1].format("YYYY-MM-DD"):null),N=S(()=>e&&e.value.length>0?e.value.map(a=>Y(R({},a),{order_total:Number(a.order_total),order_volume:Number(a.order_volume),claim_total:Number(a.claim_total),claim_volume:Number(a.claim_volume)})):e.value);return(a,d)=>{const T=le,V=re,b=ne,$=G,F=K;return f(),B("div",null,[s($,{size:8,style:{"margin-bottom":"8px"}},{default:v(()=>[s(T,{value:l.value,"onUpdate:value":d[0]||(d[0]=p=>l.value=p)},null,8,["value"]),s(ie,{value:n(m),onChange:d[1]||(d[1]=p=>Q(m)?m.value=p:m=p)},null,8,["value"]),s(V,{value:n(c),onChange:u},null,8,["value"]),s(ce,{value:n(r),onChange:_},null,8,["value"]),s(b,{onClick:C},{default:v(()=>[me]),_:1}),s(b,{onClick:g},{default:v(()=>[de]),_:1}),s(b,{disabled:!n(e)||n(e)&&n(e).length===0,type:"primary",onClick:h},{default:v(()=>[_e]),_:1},8,["disabled"])]),_:1}),n(e)?(f(),M(F,{key:0,columns:t,"data-source":n(N),pagination:!0},{bodyCell:v(({column:p,text:pe,record:P})=>[p.key==="volume"?(f(),B(Z,{key:0},[y(ee(n(se).formatMoney(P.volume)),1)],64)):D("",!0)]),_:1},8,["data-source"])):D("",!0)])}}});export{Ye as default};
