mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
import{d as fe,ac as _e,a4 as he,a3 as we,u as be,ad as ge,A as W,U as C,q as xe,a7 as Ue,r as L,c as X,ae as P,a as _,af as ye,ag as Q,b as Ne,ah as Pe,e as d,o as c,g as m,h as e,i as a,v as p,j as n,k as r,t as o,ai as Z,C as De,R as D,F as b,z as g,y as ke,l as Me,aj as Se,w as ee,ak as Ve,J as Ce,_ as Be}from"./index-cd9e6ac8.js";import{A as Ie,U as Ee}from"./patient.mutations-36815db6.js";/* empty css */const Oe={class:"flex whitespace-nowrap w-full"},$e=e("span",{class:"text-gray-700 w-4/12"},"Patient Unique Identifier",-1),qe={class:"w-full"},Ae={class:"text-orange-600 w-4/12"},Fe={class:"flex whitespace-nowrap w-full"},Re=e("span",{class:"text-gray-700 w-4/12"},"First Name",-1),Ye={class:"w-full"},je={class:"text-orange-600 w-4/12"},Te={class:"flex whitespace-nowrap mb-2 w-full"},Le=e("span",{class:"text-gray-700 w-4/12"},"Middle Name",-1),Ke={class:"w-full"},Ge={class:"text-orange-600 w-4/12"},He={class:"flex whitespace-nowrap w-full"},ze=e("span",{class:"text-gray-700 w-4/12"},"Last Name",-1),Je={class:"w-full"},We={class:"text-orange-600 w-4/12"},Xe={class:"flex whitespace-nowrap my-2 w-full"},Qe=e("span",{class:"text-gray-700 w-4/12"},"Age/DOB Estimated?",-1),Ze={class:"w-full flex justify-between items-center"},et={class:"flex justify-start items-center gap-x-2 ml-4"},tt={for:"estimateYears"},st=e("span",{class:"mr-1"},"Years",-1),lt={for:"estimateMonths"},nt=e("span",{class:"mr-1"},"Months",-1),it={for:"estimateDays"},at=e("span",{class:"mr-1"},"Days",-1),ot={class:"text-orange-600 w-4/12"},dt={class:"flex whitespace-nowrap mb-2 w-full"},ut=e("span",{class:"text-gray-700 w-4/12"},"Date of Birth",-1),rt={class:"w-full"},ct=["disabled"],mt={class:"text-orange-600 w-4/12"},pt={class:"flex whitespace-nowrap mb-2 w-full"},vt=e("span",{class:"text-gray-700 w-4/12"},"Age",-1),ft={class:"w-full"},_t={class:"text-orange-600 w-4/12"},ht={class:"flex whitespace-nowrap mb-2 w-full"},wt=e("span",{class:"text-gray-700 w-4/12"},"Gender",-1),bt={class:"w-full"},gt=e("option",null,null,-1),xt=["value"],Ut={class:"text-orange-600 w-4/12"},yt={class:"flex whitespace-nowrap mb-2 w-full"},Nt=e("span",{class:"text-gray-700 w-4/12"},"Mobile Number",-1),Pt={class:"w-full"},Dt={class:"text-orange-600 w-4/12"},kt={class:"flex whitespace-nowrap mb-2 w-full"},Mt=e("span",{class:"text-gray-700 w-4/12"},"Consent to SMS",-1),St={class:"w-full"},Vt={class:"text-orange-600 w-4/12"},Ct={class:"flex whitespace-nowrap mb-2 w-full"},Bt=e("span",{class:"text-gray-700 w-4/12"},"Primary Referrer",-1),It={class:"w-full"},Et={class:"text-orange-600 w-4/12"},Ot={class:"flex whitespace-nowrap mb-2 w-full"},$t={class:"text-gray-700 w-4/12 flex justify-between items-center"},qt=e("span",{class:"mr-4"},"Extra Ids:",-1),At={class:"w-full border-gray-200"},Ft={class:"flex justify-around items-center w-full"},Rt=e("span",null,"Identification",-1),Yt=["onUpdate:modelValue"],jt=e("option",null,null,-1),Tt=["value"],Lt=e("span",null,"Value",-1),Kt=["onUpdate:modelValue"],Gt=["onClick"],Ht=e("hr",{class:"my-2"},null,-1),zt={class:"grid grid-cols-3 gap-x-4 mb-4"},Jt={class:"col-span-1"},Wt={class:"flex gap-x-2 items-center whitespace-nowrap w-full"},Xt=e("span",{class:"text-gray-700 w-4/12"},"Country",-1),Qt=e("option",{value:null},null,-1),Zt=["value"],es={class:"text-orange-600 w-4/12"},ts={class:"col-span-1"},ss={class:"flex gap-x-2 items-center whitespace-nowrap col-span-1 w-full"},ls=e("span",{class:"text-gray-700 w-4/12"},"Province",-1),ns=e("option",{value:null},null,-1),is=["value"],as={class:"text-orange-600 w-4/12"},os={class:"col-span-1"},ds={class:"flex gap-x-2 items-center whitespace-nowrap col-span-1 w-full"},us=e("span",{class:"text-gray-700 w-4/12"},"District",-1),rs=e("option",{value:null},null,-1),cs=["value"],ms={class:"text-orange-600 w-4/12"},ps=e("hr",null,null,-1),vs=e("button",{type:"submit",class:"-mb-4 w-1/5 border border-sky-800 bg-sky-800 text-white rounded-sm px-4 py-2 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Save Patient ",-1),fs=fe({__name:"PatientForm",props:{patient:Object,navigate:{type:Boolean,default:!1}},emits:["close"],setup(te,{emit:K}){const x=te;let G=_e(),v=he(),k=we();const{withClientMutation:H}=Ve();let se=be(),le=ge();const U=W({genders:["Male","Female","Missing","Trans Gender"],createAction:!0,countries:C(()=>v.getCountries),provinces:C(()=>v.getProvinces),districts:C(()=>v.getDistricts),clients:C(()=>G.getClients)});let ne=W({first:void 0,after:"",text:"",sortBy:["name"],filterAction:!1});xe(async()=>{await v.fetchCountries(),await G.fetchClients(ne),x.patient?.countryUid&&await v.filterProvincesByCountry(x.patient?.countryUid),x.patient?.provinceUid&&await v.filterDistrictsByProvince(x.patient?.provinceUid),await k.fetchIdentifications()});const{patient:i,navigate:ie}=Ue(x),M=L(0),B=L(0),I=L(0),h=()=>{const l=Ce().subtract(M.value,"year").subtract(B.value,"month").subtract(I.value,"day");w.value=l.format("YYYY-MM-DD"),y.value=M.value},z=()=>{var l=new Date().getFullYear();if(w.value){const t=new Date(w.value).getFullYear();y.value=l-t}},ae=X({uid:P(),clientPatientId:_().required("Client Patient ID is Required"),patientId:_().nullable(),firstName:_().required("First Name is Required"),middleName:_().nullable(),lastName:_().required("Last Name is Required"),client:X().required("Client is Required"),gender:_().required("Gender is Required"),age:P().nullable(),dateOfBirth:ye().nullable(),ageDobEstimated:Q().nullable(),phoneHome:_().nullable(),phoneMobile:_().nullable(),consentSms:Q().nullable(),districtUid:P().nullable(),provinceUid:P().nullable(),countryUid:P().nullable()}),{handleSubmit:oe,errors:u}=Ne({validationSchema:ae,initialValues:{uid:i?.value?.uid,clientPatientId:i?.value?.clientPatientId||le?.query?.cpid,patientId:i?.value?.patientId,firstName:i?.value?.firstName,middleName:i?.value?.middleName,lastName:i?.value?.lastName,client:i?.value?.client,gender:i?.value?.gender,age:i?.value?.age,dateOfBirth:Pe(i?.value?.dateOfBirth)?void 0:new Date(i?.value?.dateOfBirth).toISOString().split("T")[0],ageDobEstimated:i?.value?.ageDobEstimated,phoneHome:i?.value?.phoneHome,phoneMobile:i?.value?.phoneMobile,consentSms:i?.value?.consentSms,districtUid:i?.value?.districtUid,provinceUid:i?.value?.provinceUid,countryUid:i?.value?.countryUid,identifications:i?.value?.identifications??[]}}),{value:E}=d("clientPatientId"),{value:O}=d("firstName"),{value:$}=d("middleName"),{value:q}=d("lastName"),{value:A}=d("client"),{value:F}=d("gender"),{value:y}=d("age"),{value:w}=d("dateOfBirth"),{value:N}=d("ageDobEstimated"),{value:R}=d("phoneMobile"),{value:Y}=d("consentSms"),{value:j}=d("districtUid"),{value:S}=d("provinceUid"),{value:V}=d("countryUid"),{value:T}=d("identifications"),J=oe(l=>{l.uid||de(l),l.uid&&ue(l)});function de(l){H(Ie,{payload:{clientPatientId:l.clientPatientId,firstName:l.firstName,middleName:l.middleName,lastName:l.lastName,age:l.age,gender:l.gender,dateOfBirth:l.dateOfBirth,ageDobEstimated:l.ageDobEstimated,clientUid:l.client.uid,phoneMobile:l.phoneMobile,consentSms:l.consentSms,countryUid:l.countryUid,provinceUid:l.provinceUid,districtUid:l.districtUid,identifications:l.identifications}},"createPatient").then(t=>{k.addPatient(t),K("close",t),ie.value===!0&&se.push({name:"patient-detail",params:{patientUid:t.uid}})})}function ue(l){H(Ee,{uid:l.uid,payload:{clientPatientId:l.clientPatientId,firstName:l.firstName,middleName:l.middleName,lastName:l.lastName,age:l.age,gender:l.gender,dateOfBirth:l.dateOfBirth,ageDobEstimated:l.ageDobEstimated,clientUid:l.client.uid,phoneMobile:l.phoneMobile,consentSms:l.consentSms,countryUid:l.countryUid,provinceUid:l.provinceUid,districtUid:l.districtUid,identifications:l.identifications?.map(t=>({identificationUid:t.identificationUid,value:t.value}))}},"updatePatient").then(t=>{k.updatePatient(t),K("close",t)})}function re(l){v.filterProvincesByCountry(V.value)}function ce(l){v.filterDistrictsByProvince(S.value)}const me=()=>{T.value.push({identificationUid:"12122",value:""})},pe=l=>{T.value.splice(l,1)};return(l,t)=>(c(),m("form",{onSubmit:t[28]||(t[28]=ee((...s)=>n(J)&&n(J)(...s),["prevent"])),class:"border-2 border-gray-900 border-dotted rounded-sm px-4 py-8",autocomplete:"off"},[e("label",Oe,[$e,e("div",qe,[a(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":t[0]||(t[0]=s=>r(E)?E.value=s:null),placeholder:"Patient Unique Identifier"},null,512),[[p,n(E)]]),e("div",Ae,o(n(u).clientPatientId),1)])]),e("label",Fe,[Re,e("div",Ye,[a(e("input",{class:"form-input mt-1 w-full","onUpdate:modelValue":t[1]||(t[1]=s=>r(O)?O.value=s:null),placeholder:"First Name"},null,512),[[p,n(O)]]),e("div",je,o(n(u).firstName),1)])]),e("label",Te,[Le,e("div",Ke,[a(e("input",{class:"form-input mt-1 w-full","onUpdate:modelValue":t[2]||(t[2]=s=>r($)?$.value=s:null),placeholder:"Middle Name"},null,512),[[p,n($)]]),e("div",Ge,o(n(u).middleName),1)])]),e("label",He,[ze,e("div",Je,[a(e("input",{class:"form-input mt-1 w-full","onUpdate:modelValue":t[3]||(t[3]=s=>r(q)?q.value=s:null),placeholder:"Last Name"},null,512),[[p,n(q)]]),e("div",We,o(n(u).lastName),1)])]),e("label",Xe,[Qe,e("div",Ze,[a(e("input",{type:"checkbox",class:"form-checkbox text-sky-800","onUpdate:modelValue":t[4]||(t[4]=s=>r(N)?N.value=s:null)},null,512),[[Z,n(N)]]),a(e("div",et,[e("label",tt,[st,a(e("input",{name:"estimateYears",type:"number",min:"0",class:"form-input w-24 py-0 text-sky-800","onUpdate:modelValue":t[5]||(t[5]=s=>M.value=s),onChange:t[6]||(t[6]=s=>h()),onKeyup:t[7]||(t[7]=s=>h())},null,544),[[p,M.value]])]),e("label",lt,[nt,a(e("input",{name:"estimateMonths",type:"number",min:"0",max:"12",class:"form-input w-24 py-0 text-sky-800","onUpdate:modelValue":t[8]||(t[8]=s=>B.value=s),onChange:t[9]||(t[9]=s=>h()),onKeyup:t[10]||(t[10]=s=>h())},null,544),[[p,B.value]])]),e("label",it,[at,a(e("input",{name:"estimateDays",type:"number",min:"0",max:"365",class:"form-input w-24 py-0 text-sky-800","onUpdate:modelValue":t[11]||(t[11]=s=>I.value=s),onChange:t[12]||(t[12]=s=>h()),onKeyup:t[13]||(t[13]=s=>h())},null,544),[[p,I.value]])])],512),[[De,n(N)]]),e("div",ot,o(n(u).ageDobEstimated),1)])]),e("label",dt,[ut,e("div",rt,[a(e("input",{class:"form-input mt-1 w-full disabled:bg-slate-200",type:"date","onUpdate:modelValue":t[14]||(t[14]=s=>r(w)?w.value=s:null),placeholder:"Date of Birth",disabled:n(N),onChange:t[15]||(t[15]=s=>z()),onKeyup:t[16]||(t[16]=s=>z())},null,40,ct),[[p,n(w)]]),e("div",mt,o(n(u).dateOfBirth),1)])]),e("label",pt,[vt,e("div",ft,[a(e("input",{class:"form-input mt-1 w-full disabled:bg-slate-200",type:"number","onUpdate:modelValue":t[17]||(t[17]=s=>r(y)?y.value=s:null),placeholder:"Age",disabled:""},null,512),[[p,n(y)]]),e("div",_t,o(n(u).age),1)])]),e("label",ht,[wt,e("div",bt,[a(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":t[18]||(t[18]=s=>r(F)?F.value=s:null)},[gt,(c(!0),m(b,null,g(U.genders,s=>(c(),m("option",{key:s,value:s},o(s),9,xt))),128))],512),[[D,n(F)]]),e("div",Ut,o(n(u).gender),1)])]),e("label",yt,[Nt,e("div",Pt,[a(e("input",{class:"form-input mt-1 w-full","onUpdate:modelValue":t[19]||(t[19]=s=>r(R)?R.value=s:null),placeholder:"Mobile Number"},null,512),[[p,n(R)]]),e("div",Dt,o(n(u).phoneMobile),1)])]),e("label",kt,[Mt,e("div",St,[a(e("input",{type:"checkbox",class:"form-checkbox text-sky-800","onUpdate:modelValue":t[20]||(t[20]=s=>r(Y)?Y.value=s:null)},null,512),[[Z,n(Y)]]),e("div",Vt,o(n(u).consentSms),1)])]),ke(" other identifiers: passport, client pid, national id "),e("label",Ct,[Bt,e("div",It,[Me(n(Se),{placeholder:"Select a Primary Referrer",modelValue:n(A),"onUpdate:modelValue":t[21]||(t[21]=s=>r(A)?A.value=s:null),options:U.clients,searchable:!0,label:"name","track-by":"uid"},null,8,["modelValue","options"]),e("div",Et,o(n(u).client),1)])]),e("label",Ot,[e("span",$t,[qt,e("div",null,[e("span",{class:"relative px-1 mr-2 mt-4 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none",onClick:t[22]||(t[22]=s=>me())}," Add ")])]),e("div",At,[(c(!0),m(b,null,g(n(T),(s,ve)=>(c(),m("div",Ft,[Rt,a(e("select",{class:"form-select mt-1","onUpdate:modelValue":f=>s.identificationUid=f},[jt,(c(!0),m(b,null,g(n(k).identifications,f=>(c(),m("option",{key:f.uid,value:f.uid},o(f.name),9,Tt))),128))],8,Yt),[[D,s.identificationUid]]),Lt,a(e("input",{type:"text",class:"form-input text-sky-800","onUpdate:modelValue":f=>s.value=f},null,8,Kt),[[p,s.value]]),e("span",{class:"p-2 text-red-800",onClick:ee(f=>pe(ve),["prevent"])},"X",8,Gt)]))),256))])]),Ht,e("div",zt,[e("div",Jt,[e("label",Wt,[Xt,a(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":t[23]||(t[23]=s=>r(V)?V.value=s:null),onChange:t[24]||(t[24]=s=>re())},[Qt,(c(!0),m(b,null,g(U.countries,s=>(c(),m("option",{key:s.uid,value:s.uid},o(s.name),9,Zt))),128))],544),[[D,n(V)]])]),e("div",es,o(n(u).countryUid),1)]),e("div",ts,[e("label",ss,[ls,a(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":t[25]||(t[25]=s=>r(S)?S.value=s:null),onChange:t[26]||(t[26]=s=>ce())},[ns,(c(!0),m(b,null,g(U.provinces,s=>(c(),m("option",{key:s.uid,value:s.uid},o(s.name),9,is))),128))],544),[[D,n(S)]])]),e("div",as,o(n(u).provinceUid),1)]),e("div",os,[e("label",ds,[us,a(e("select",{class:"form-select mt-1 w-full","onUpdate:modelValue":t[27]||(t[27]=s=>r(j)?j.value=s:null)},[rs,(c(!0),m(b,null,g(U.districts,s=>(c(),m("option",{key:s.uid,value:s.uid},o(s.name),9,cs))),128))],512),[[D,n(j)]])])]),e("div",ms,o(n(u).districtUid),1)]),ps,vs],32))}}),bs=Be(fs,[["__file","/home/aurthur/Development/Python/felicity/felicity-lims/webapp/views/patient/PatientForm.vue"]]);export{bs as P};
|