var O=Object.defineProperty,W=Object.defineProperties;var z=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable;var R=(n,a,o)=>a in n?O(n,a,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[a]=o,D=(n,a)=>{for(var o in a||(a={}))K.call(a,o)&&R(n,o,a[o]);if(T)for(var o of T(a))Q.call(a,o)&&R(n,o,a[o]);return n},$=(n,a)=>W(n,z(a));import{g as Z,d as ee,u as ae,i as s,W as b,o as i,j as B,k as te,c as r,b as t,a as M,e as m,w as x,n as oe,H as ne,J as L,aN as le,aq as re,B as se,x as ue,F as Y,f as p,t as P}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{_ as ie}from"./Status.120e28ab.js";import{f as w}from"./filters.69c883c5.js";import{_ as ce}from"./ServiceLocationSelection.6ec04a32.js";import{_ as de}from"./BuyModeSelection.7846d63e.js";import{_ as me}from"./BuyTypeSelection.f3739a5a.js";import{_ as pe}from"./InsuranceSelection.053f358d.js";import{_ as ve}from"./PackageSelection.ec5d16e2.js";import{_ as _e}from"./StatusSelection.682823fe.js";import{R as ye}from"./ReportService.10f7d665.js";const fe={class:"filter-options"},ke=p("Search"),ge=p("Clear"),xe=p("Excel "),he=ee({__name:"SaleReport",setup(n){const a=[{title:"ID",dataIndex:"id",key:"id"},{title:"Certificate No",dataIndex:"no",key:"no"},{title:"Customer",dataIndex:"customer",key:"customer"},{title:"Passport",dataIndex:"passport",key:"passport"},{title:"Buy Type",dataIndex:"type",key:"type"},{title:"Buy Mode",dataIndex:"buy_mode",key:"buy_mode"},{title:"Amount",dataIndex:"amount",key:"amount"},{title:"Payment",dataIndex:"channel",key:"channel"},{title:"Insurance Type",dataIndex:"insurance_name",key:"insurance_name"},{title:"Package",dataIndex:"package_name",key:"package_name"},{title:"Seller",dataIndex:"seller",key:"seller"},{title:"Service Location",dataIndex:"servicelocation",key:"servicelocation"},{title:"Status",dataIndex:"status",key:"status"},{title:"Buy Date",dataIndex:"createdtime",key:"createdtime"}],o=ae();let l=s();const u=s([]);let v=s(),_=s(),y=s(),f=s(),k=s(),g=s();const E=async()=>{if(!h.value&&!S.value)return oe.warn("Please choose report date");const e={fromdate:h.value,todate:S.value,serviceLocation:v.value,buyType:_.value,buyMode:y.value,insuranceType:f.value,packageType:k.value,status:g.value};ne(),ye.getSaleReport(e).then(c=>{l.value=c.data,L()}).catch(c=>{L()})},A=e=>{v.value=e},V=e=>{_.value=e},F=e=>{y.value=e},U=e=>{f.value=e},X=e=>{k.value=e},j=e=>{g.value=e},q=()=>{l.value=[],u.value=[],v.value=void 0,_.value=void 0,y.value=void 0,f.value=void 0,k.value=void 0,g.value=void 0},G=()=>{const e=`SaleReport.${h.value}.${S.value}.xlsx`;le(e,N.value)},h=b(()=>u.value[0]?u.value[0].format("YYYY-MM-DD"):null),S=b(()=>u.value[1]?u.value[1].format("YYYY-MM-DD"):null),N=b(()=>l&&l.value.length>0?l.value.map(e=>$(D({},e),{amount:Number(e.amount),createdtime:w.formatDate(e.createdtime)})):l.value);return(e,c)=>{const H=re,C=se,J=ue;return i(),B("div",null,[te("div",fe,[r(H,{value:u.value,"onUpdate:value":c[0]||(c[0]=d=>u.value=d),style:{"min-width":"200px"}},null,8,["value"]),["ADMIN","ACCOUNTING","CLAIMER"].includes(t(o).role)?(i(),M(ce,{key:0,value:t(v),onChange:A},null,8,["value"])):m("",!0),r(me,{value:t(_),onChange:V},null,8,["value"]),r(de,{value:t(y),onChange:F},null,8,["value"]),r(pe,{value:t(f),onChange:U},null,8,["value"]),r(ve,{value:t(k),onChange:X},null,8,["value"]),r(_e,{value:t(g),onChange:j},null,8,["value"]),r(C,{onClick:E},{default:x(()=>[ke]),_:1}),r(C,{onClick:q},{default:x(()=>[ge]),_:1}),r(C,{disabled:!t(l)||t(l)&&t(l).length===0,type:"primary",onClick:G},{default:x(()=>[xe]),_:1},8,["disabled"])]),t(l)?(i(),M(J,{key:0,dataSource:t(N),columns:a,pagination:!1},{bodyCell:x(({column:d,text:Se,record:I,index:Ce})=>[d.key==="status"?(i(),M(ie,{key:0,status:I.status},null,8,["status"])):m("",!0),d.key==="amount"?(i(),B(Y,{key:1},[p(P(t(w).formatMoney(I.amount)),1)],64)):m("",!0),d.key==="createdtime"?(i(),B(Y,{key:2},[p(P(I.createdtime),1)],64)):m("",!0)]),_:1},8,["dataSource"])):m("",!0)])}}});var Xe=Z(he,[["__scopeId","data-v-f1887774"]]);export{Xe as default};
