import{d as I,i as p,q as N,s as T,o as s,a as y,P as q,H as j,as as J,J as S,W as M,j as f,k as B,c as r,b as c,v as W,w,m as z,B as G,x as K,F as C,f as x,t as h,e as d,r as Q}from"./index.29cf2edd.js";/* empty css              *//* empty css              *//* empty css              *//* empty css              *//* empty css              */import{_ as X}from"./Status.120e28ab.js";import{_ as b}from"./Type.ec60a9ee.js";import{_ as Y}from"./StatusSelection.682823fe.js";import{_ as Z}from"./RoleSelection.bdd43d80.js";import{_ as ee}from"./HospitalSelection.c3cfe7ce.js";import{_ as te}from"./ServiceLocationSelection.6ec04a32.js";/* empty css              */import"./filters.69c883c5.js";const ae=I({__name:"PositionSelection",props:{value:{type:String,required:!0}},emits:["change"],setup(E,{emit:g}){const _=E,a=p(),i=[{id:"HEAD",value:"\u0EAB\u0EBB\u0EA7\u0EDC\u0EC9\u0EB2"},{id:"STAFF",value:"\u0E9E\u0EB0\u0E99\u0EB1\u0E81\u0E87\u0EB2\u0E99"}];N(()=>{_.value&&(a.value=i.filter(l=>l.id===_.value)[0])});const m=()=>{g("change",a.value)};return T(()=>_.value,l=>{l===""&&(a.value=null)}),(l,u)=>{const v=q;return s(),y(v,{value:a.value,"onUpdate:value":u[0]||(u[0]=k=>a.value=k),placeholder:"Choose a position",options:i,onChange:m,"field-names":{label:"value",value:"id"}},null,8,["value"])}}}),le={class:"flex",style:{"padding-bottom":"10px","flex-flow":"wrap"}},ne=x("Clear "),oe={key:6},se=["onClick"],Ee=I({__name:"UserList",setup(E){const g=[{title:"ID",dataIndex:"id",key:"id"},{title:"Full name",dataIndex:"fullname",key:"fullname"},{title:"Phone Number",dataIndex:"phone",key:"phone"},{title:"Hospital",dataIndex:"hospital_name",key:"hospital_name"},{title:"Service Location",dataIndex:"servicelocation_name",key:"servicelocation_name"},{title:"Position",dataIndex:"position",key:"position"},{title:"Role",dataIndex:"role",key:"role"},{title:"Status",dataIndex:"status",key:"status"},{title:"Action",key:"action"}];let _=p(),a=p(),i=p(),m=p(),l=p(""),u=p(""),v=p("");N(()=>{k()});const k=()=>{j(),J.getUsers().then(e=>{S(),_.value=e.data}).catch(e=>{S()})},U=e=>{Q.push(`/user/view/${e.id}`)},$=e=>{i.value=e},A=e=>{m.value=e},L=e=>{l.value=e},P=e=>{u.value=e},F=e=>{v.value=e},V=()=>{a.value="",u.value="",v.value="",i.value=null,m.value=null,l.value=""},D=M(()=>{let e=_;return i.value?e.value.filter(t=>t.hospital_id===i.value):m.value?e.value.filter(t=>t.servicelocation_id===m.value):l.value?e.value.filter(t=>t.position===l.value):u.value?e.value.filter(t=>t.role===u.value):v.value?e.value.filter(t=>t.status===v.value):a.value?e.value.filter(t=>t.firstname&&t.firstname.indexOf(a.value)!==-1||t.lastname&&t.lastname.indexOf(a.value)!==-1||t.phone&&t.phone.indexOf(a.value)!==-1):e.value});return(e,t)=>{const H=z,O=G,R=K;return s(),f("div",null,[B("div",le,[r(H,{value:c(a),"onUpdate:value":t[0]||(t[0]=n=>W(a)?a.value=n:a=n),placeholder:"Name, Phone",style:{"max-width":"220px","margin-right":"12px","margin-bottom":"12px"}},null,8,["value"]),r(ee,{value:c(i),onChange:$,style:{"margin-right":"12px","margin-bottom":"12px"}},null,8,["value"]),r(te,{value:c(m),onChange:A,style:{"margin-right":"12px","margin-bottom":"12px"}},null,8,["value"]),r(ae,{value:c(l),onChange:L,style:{width:"165px","margin-right":"12px"}},null,8,["value"]),r(Z,{value:c(u),onChange:P,style:{width:"165px","margin-right":"12px"}},null,8,["value"]),r(Y,{value:c(v),onChange:F,style:{width:"165px","margin-right":"12px"}},null,8,["value"]),r(O,{onClick:V,style:{"margin-right":"12px"}},{default:w(()=>[ne]),_:1})]),r(R,{dataSource:c(D),columns:g},{bodyCell:w(({column:n,text:ie,record:o})=>[n.key==="fullname"?(s(),f(C,{key:0},[x(h(o.firstname)+" "+h(o.lastname),1)],64)):d("",!0),n.key==="role"?(s(),y(b,{key:1,type:o.role},null,8,["type"])):d("",!0),n.key==="status"?(s(),y(X,{key:2,status:o.status},null,8,["status"])):d("",!0),n.key==="position"?(s(),y(b,{key:3,type:o.position},null,8,["type"])):d("",!0),n.key==="hospital_name"?(s(),f(C,{key:4},[x(h(o.hospital_name?o.hospital_name:"N/A"),1)],64)):d("",!0),n.key==="servicelocation_name"?(s(),f(C,{key:5},[x(h(o.servicelocation_name?o.servicelocation_name:"N/A"),1)],64)):n.key==="action"?(s(),f("span",oe,[B("a",{onClick:ue=>U(o)},"View",8,se)])):d("",!0)]),_:1},8,["dataSource"])])}}});export{Ee as default};
