var X=Object.defineProperty;var $=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable;var B=(d,a,i)=>a in d?X(d,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):d[a]=i,N=(d,a)=>{for(var i in a||(a={}))G.call(a,i)&&B(d,i,a[i]);if($)for(var i of $(a))K.call(a,i)&&B(d,i,a[i]);return d};import{d as Q,u as Z,i as c,q as ee,H as te,J as w,W as ae,s as ie,o as l,j as r,c as u,w as Y,b as s,U as ne,x as oe,v as le,a as L,e as v,F as _,f as y,t as f,k as se,r as re,m as ue,aq as ce,B as de}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{C as me}from"./CovidService.5364de46.js";import{_ as ve}from"./Status.120e28ab.js";import{f as pe,h as D}from"./filters.69c883c5.js";import{_ as _e}from"./StatusSelection.682823fe.js";import{_ as fe}from"./BuyTypeSelection.f3739a5a.js";import{_ as ye}from"./BuyModeSelection.7846d63e.js";import{_ as ke}from"./InsuranceSelection.053f358d.js";import{_ as ge}from"./PackageSelection.ec5d16e2.js";import{_ as Ce}from"./ServiceLocationSelection.6ec04a32.js";const xe=y("Clear"),he={key:0},Ie={key:7},be=["onClick"],ze=Q({__name:"OrderList",setup(d){let a=[{title:"No.",dataIndex:"",key:"no"},{title:"Certificate No",dataIndex:"no",key:"certificateno"},{title:"Customer",dataIndex:"certificatemember",key:"certificatemember"},{title:"Service Location",dataIndex:"servicelocation_id",key:"servicelocation_id"},{title:"Buy Type",dataIndex:"type",key:"type"},{title:"Buy Via",dataIndex:"buy_mode",key:"via"},{title:"Insurance Type",dataIndex:"insurancetype",key:"insurancetype"},{title:"Package",dataIndex:"insurancepackage",key:"insurancepackage"},{title:"Status",dataIndex:"status",key:"status"},{title:"Date of Placed",dataIndex:"createdtime",key:"createdtime"},{title:"Action",key:"action"}];const i=Z();i.role!=="ADMIN"&&(a=a.filter(e=>!["servicelocation_id"].includes(e.dataIndex)));const m=c([]),M=c();let p=c(),k=c(),g=c(),C=c(),x=c(),h=c(),I=c();ee(async()=>{T()});const b=e=>{if(e.expirytime)return D(e.expirytime).diff(new Date,"days")},T=e=>{te(),me.getCertificates(e).then(t=>{w(),M.value=t.data.map(S=>N({},S))}).catch(t=>{w()})},O=ae(()=>{let e=M.value;return k.value&&(e=e.filter(t=>t.servicelocation_id===k.value)),x.value&&(e=e.filter(t=>t.insurancetype_id===x.value)),h.value&&(e=e.filter(t=>t.insurancepackage_id===h.value)),g.value&&(e=e.filter(t=>t.type===g.value)),C.value&&(e=e.filter(t=>t.buy_mode===C.value)),I.value&&(e=e.filter(t=>t.status===I.value)),p.value&&(e=e.filter(t=>t.no.indexOf(p.value)!==-1)),m.value[0]&&m.value[1]&&(e=e.filter(t=>D(t.createdtime).format("YYYYMMDD")>=m.value[0].format("YYYYMMDD")&&D(t.createdtime).format("YYYYMMDD")<=m.value[1].format("YYYYMMDD"))),e}),V=e=>{re.push(`/covid/order/view/${e}`)},A=e=>{k.value=e},E=e=>{g.value=e},P=e=>{C.value=e},R=e=>{x.value=e},U=e=>{h.value=e},q=e=>{I.value=e},F=()=>{p.value=void 0,m.value=[],k.value=void 0,g.value=void 0,C.value=void 0,x.value=void 0,h.value=void 0,I.value=void 0};return ie(()=>m.value,e=>{}),(e,t)=>{const S=ue,W=ce,j=de,z=ne,H=oe;return l(),r("div",null,[u(z,{size:8,style:{"margin-bottom":"8px"}},{default:Y(()=>[u(S,{value:s(p),"onUpdate:value":t[0]||(t[0]=n=>le(p)?p.value=n:p=n),placeholder:"Certificate No, Customer"},null,8,["value"]),u(W,{value:m.value,"onUpdate:value":t[1]||(t[1]=n=>m.value=n)},null,8,["value"]),["ADMIN","CLAIMER"].includes(s(i).role)?(l(),L(Ce,{key:0,value:s(k),onChange:A},null,8,["value"])):v("",!0),u(fe,{value:s(g),onChange:E},null,8,["value"]),u(ye,{value:s(C),onChange:P},null,8,["value"]),u(ke,{value:s(x),onChange:R},null,8,["value"]),u(ge,{value:s(h),onChange:U},null,8,["value"]),u(_e,{value:s(I),onChange:q},null,8,["value"]),u(j,{onClick:F},{default:Y(()=>[xe]),_:1})]),_:1}),u(H,{dataSource:s(O),columns:s(a)},{bodyCell:Y(({column:n,text:Se,record:o,index:J})=>[n.key==="no"?(l(),r(_,{key:0},[y(f(J+1),1)],64)):v("",!0),n.key==="certificatemember"?(l(),r(_,{key:1},[y(f(o.certificatemember.length>0?`${o.certificatemember[0].firstname} ${o.certificatemember[0].lastname}`:""),1)],64)):v("",!0),n.key==="servicelocation_id"?(l(),r(_,{key:2},[y(f(o.servicelocation_id?`${o.servicelocation.name}`:"N/A"),1)],64)):v("",!0),n.key==="insurancetype"?(l(),r(_,{key:3},[y(f(o.insurancetype.name),1)],64)):v("",!0),n.key==="insurancepackage"?(l(),r(_,{key:4},[y(f(o.insurancepackage.name),1)],64)):v("",!0),n.key==="status"?(l(),r(_,{key:5},[b(o)<=15?(l(),r("div",he,f(`Will expire in ${b(o)}`),1)):(l(),L(ve,{key:1,status:b(o)<=0?"EXPIRED":o.status},null,8,["status"]))],64)):v("",!0),n.key==="createdtime"?(l(),r(_,{key:6},[y(f(s(pe).formatDate(o.createdtime)),1)],64)):n.key==="action"?(l(),r("span",Ie,[se("a",{onClick:Ye=>V(o.no)},"View",8,be)])):v("",!0)]),_:1},8,["dataSource","columns"])])}}});export{ze as default};
