import{d as D,i as u,q as w,s as F,o as r,a as h,P as L,H as R,J as C,n as T,W as U,j as E,k as g,c as i,b as p,v as j,w as k,m as q,B as H,x as J,F as M,f as S,t as B,e as x,r as W}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{C as z}from"./CustomerService.3b8d3388.js";import{_ as G}from"./Status.120e28ab.js";import{_ as K}from"./Type.ec60a9ee.js";import{_ as Q}from"./StatusSelection.682823fe.js";import{_ as X}from"./RoleSelection.bdd43d80.js";/* empty css              */import"./filters.69c883c5.js";const Y=D({__name:"CertificatePeriodSelection",props:{value:{type:Number}},emits:["change"],setup(y,{emit:_}){const l=y,t=u(),s=[{id:30,value:"\u0EDD\u0EBB\u0E94\u0EAD\u0EB2\u0E8D\u0EB8\u0EC3\u0E99 30 \u0EA7\u0EB1\u0E99"},{id:15,value:"\u0EDD\u0EBB\u0E94\u0EAD\u0EB2\u0E8D\u0EB8\u0EC3\u0E99 15 \u0EA7\u0EB1\u0E99"},{id:0,value:"\u0EDD\u0EBB\u0E94\u0EAD\u0EB2\u0E8D\u0EB8\u0EC1\u0EA5\u0EC9\u0EA7"}];w(()=>{l.value&&(t.value=s.filter(a=>a.id===l.value)[0])});const d=()=>{_("change",t.value)};return F(()=>l.value,a=>{a||(t.value=null)}),(a,o)=>{const c=L;return r(),h(c,{value:t.value,"onUpdate:value":o[0]||(o[0]=f=>t.value=f),"show-search":"",placeholder:"Choose a certificate expired in",options:s,"clear-icon":"","allow-clear":"",onChange:d,"field-names":{label:"value",value:"id"}},null,8,["value"])}}}),Z={class:"flex",style:{"padding-bottom":"10px"}},ee=S("Clear"),te={key:3},ae=["onClick"],xe=D({__name:"CustomerList",setup(y){const _=[{title:"ID",dataIndex:"id",key:"id"},{title:"Full name",dataIndex:"fullname",key:"fullname"},{title:"Email",dataIndex:"email",key:"email"},{title:"Phone Number",dataIndex:"phone",key:"phone"},{title:"Passport Number",dataIndex:"passport",key:"passport"},{title:"Role",dataIndex:"role",key:"role"},{title:"Status",dataIndex:"status",key:"status"},{title:"Action",key:"action"}];let l=u(),t=u(),s=u(),d=u(),a=u(),o=u();w(()=>{c()});const c=()=>{R(),z.getCustomer({certificateExpiredIn:o.value}).then(e=>{C();const v=e.data;l.value=v.customers}).catch(e=>{C(),T.error(e.message)})},f=e=>{W.push(`/customer/view/${e.id}`)},I=e=>{s.value=e},b=e=>{a.value=e},A=e=>{o.value=e,c()},N=()=>{t.value="",s.value="",a.value=""},O=U(()=>t.value||s.value||d.value||a.value?l.value.filter(e=>e.firstname.indexOf(t.value)!==-1||e.lastname.indexOf(t.value)!==-1||e.email&&e.email.indexOf(t.value)!==-1||e.phone&&e.phone.indexOf(t.value)!==-1||e.passport&&e.passport.indexOf(t.value)!==-1||e.role&&e.role.indexOf(s.value)!==-1||e.visatype_id&&e.visatype_id.indexOf(d.value)!==-1||e.status&&e.status.indexOf(a.value)!==-1):l.value);return(e,v)=>{const P=q,$=H,V=J;return r(),E("div",null,[g("div",Z,[i(P,{value:p(t),"onUpdate:value":v[0]||(v[0]=n=>j(t)?t.value=n:t=n),placeholder:"Name, Email, Phone, Passport",style:{"max-width":"265px","margin-right":"12px"}},null,8,["value"]),i(X,{value:p(s),onChange:I,style:{width:"165px","margin-right":"12px"}},null,8,["value"]),i(Q,{value:p(a),onChange:b,style:{"min-width":"165px","margin-right":"12px"}},null,8,["value"]),i(Y,{value:p(o),onChange:A,style:{"min-width":"165px","margin-right":"12px"}},null,8,["value"]),i($,{style:{"margin-right":"12px"},onClick:N},{default:k(()=>[ee]),_:1})]),i(V,{dataSource:p(O),columns:_},{bodyCell:k(({column:n,text:se,record:m})=>[n.key==="fullname"?(r(),E(M,{key:0},[S(B(m.firstname)+" "+B(m.lastname),1)],64)):x("",!0),n.key==="role"?(r(),h(K,{key:1,type:m.role},null,8,["type"])):x("",!0),n.key==="status"?(r(),h(G,{key:2,status:m.status},null,8,["status"])):n.key==="action"?(r(),E("span",te,[g("a",{onClick:le=>f(m)},"View",8,ae)])):x("",!0)]),_:1},8,["dataSource"])])}}});export{xe as default};
