felicity-lims/felicity/static/assets/PatientsCompact-ca326b7d.js
2023-04-23 16:54:32 +02:00

1 line
5.2 KiB
JavaScript

import{d as Q,a3 as W,a4 as q,s as K,r as g,A as O,U as J,B as X,V as Y,o,g as l,l as f,h as e,y as n,i as y,C as I,E as v,G as Z,j as s,w as ee,F as b,z as S,k as x,D as _,I as te,a5 as se,a6 as ae,W as oe,L as ne,H as T,t as c,_ as ie}from"./index-cd9e6ac8.js";import{t as re,a as le}from"./CaseTable-cf2e337a.js";import{t as ce}from"./AuditLog-efe68260.js";import{P as de}from"./PatientForm-c8581d4e.js";import{P as ue}from"./PatientInfo-1886732c.js";import{h as E,o as F,a as N}from"./constants-99d18042.js";import"./patient.mutations-36815db6.js";/* empty css */const k=h=>(se("data-v-81af20fc"),h=h(),ae(),h),pe={class:""},me={class:"flex justify-between"},fe={class:"flex items-center content-between"},he=["onClick"],ye=k(()=>e("hr",null,null,-1)),_e={class:"grid grid-cols-12 gap-4 mt-2"},ge={initial:{opacity:0,y:100},enter:{opacity:1,y:0,scale:1},variants:{custom:{scale:2}},delay:400,class:"col-span-3 h-screen overflow-y-scroll overscroll-contain patient-scroll"},ve={key:0,class:"py-4 text-center bg-white w-full mb-1 rounded-sm shadow border"},be={key:1},xe=["onClick"],ke={class:"flex-grow p-1"},Pe={class:"font-semibold text-gray-800 flex justify-between"},we={class:"text-sm text-gray-500"},Ce={class:"text-sm text-gray-500 flex justify-between"},Ie={class:"text-sm text-gray-500 flex justify-between"},Se=k(()=>e("div",{class:"p-2"},[n(' <span class="block h-4 w-4 bg-sky-800 rounded-full bottom-0 right-0"></span> ')],-1)),Te={key:0,initial:{opacity:0,y:-100},enter:{opacity:1,y:0,scale:1},variants:{custom:{scale:2}},delay:400,class:"col-span-9"},Ee={class:"bg-white shadow-md mt-2"},Fe={class:"-mb-px flex justify-start"},Ne=["onClick"],je=k(()=>e("h3",null,"Patient Form",-1)),Ae=Q({__name:"PatientsCompact",setup(h){let m=W(),j=q();const{patients:A,fetchingPatients:R}=K(m);let i=g(!1),d=g("samples");const B=["samples","cases","logs"];let u=g({}),p=O({first:25,before:"",text:"",sortBy:["-uid"],filterAction:!1});const D=["Male","Female","Missing","Trans Gender"];j.fetchCountries(),m.fetchPatients(p);function L(a){p.first=100,p.before="",p.text=a.target.value,p.filterAction=!0,m.fetchPatients(p)}const M=J(()=>Object.keys(u?.value)?.length>0);let V=a=>a.firstName+" "+a.lastName,$=a=>D[a],P=a=>{u.value=a,m.setPatient(a)},w=()=>{u.value={},m.resetPatient()};const G=async()=>{w(),i.value=!0},U=a=>{P(a),i.value=!1};return(a,r)=>{const z=X("router-link"),C=Y("motion");return o(),l(b,null,[f(oe,{title:"Patients Quick View"}),e("div",pe,[e("div",me,[e("div",fe,[n(' <h1 class="h1 my-4 font-bold text-dark-700">Listing</h1> '),y(f(z,{to:"/patients/search",class:"px-4 my-2 p-1 text-sm border-sky-800 border text-dark-800 transition-colors duration-150 rounded-sm focus:outline-none hover:bg-sky-800 hover:text-gray-100"},{default:v(()=>[Z(" Add Patient")]),_:1},512),[[I,E(N.CREATE,F.PATIENT)]]),e("input",{class:"w-64 ml-6 pl-4 pr-2 py-1 text-sm text-gray-800 placeholder-gray-400 border-1 border-gray-400 rounded-sm focus:placeholder-gray-500 focus:border-sky-800 focus:outline-none focus:shadow-outline-purple form-input",type:"text",placeholder:"Search ...","aria-label":"Search",onKeyup:r[0]||(r[0]=t=>L(t)),onFocus:r[1]||(r[1]=t=>s(w)())},null,32)]),y(e("button",{onClick:ee(G,["prevent"]),class:"px-4 my-2 p-1 text-sm border-sky-800 border text-dark-700 transition-colors duration-150 rounded-sm focus:outline-none hover:bg-sky-800 hover:text-gray-100"}," Quick Registration ",8,he),[[I,E(N.CREATE,F.PATIENT)]])]),ye,e("div",_e,[y((o(),l("section",ge,[s(R)?(o(),l("div",ve,[f(ne,{message:"Fetching patients ..."})])):(o(),l("div",be,[(o(!0),l(b,null,S(s(A),t=>(o(),l("a",{key:t.patientId,href:"#",onClick:H=>s(P)(t),class:T(["bg-white w-full flex items-center p-1 mb-1 rounded-sm shadow border",{"border-sky-800 bg-emerald-200":t.uid===s(u)?.uid}])},[e("div",ke,[e("div",Pe,[e("span",null,c(s(V)(t)),1),e("span",we,c(t.age)+" yrs, "+c(s($)(t.gender)),1)]),e("div",Ce,[e("span",null,c(t.patientId),1),e("span",null,c(t.clientPatientId),1)]),e("div",Ie,[e("span",null,c(t?.client?.district?.province?.name),1),e("span",null,c(t?.client?.name),1)])]),Se],10,xe))),128))]))])),[[C]]),s(M)?y((o(),l("section",Te,[n(" PatientInfo "),f(ue,{onEditPatient:r[2]||(r[2]=()=>x(i)?i.value=!0:i=!0)}),n(" Sample and Case Data "),e("nav",Ee,[e("div",Fe,[(o(),l(b,null,S(B,t=>e("a",{key:t,class:T(["no-underline text-gray-500 uppercase tracking-wide font-bold text-xs py-1 px-4 tab hover:bg-sky-600 hover:text-gray-200 hover:bg-sky-600 hover:text-gray-200",{"tab-active":s(d)===t}]),onClick:H=>x(d)?d.value=t:d=t,href:"#"},c(t),11,Ne)),64))])]),s(d)==="samples"?(o(),_(re,{key:0,target:"patient-samples",targetUid:s(u).uid},null,8,["targetUid"])):n("v-if",!0),s(d)==="cases"?(o(),_(le,{key:1})):n("v-if",!0),s(d)==="logs"?(o(),_(ce,{key:2,targetType:"patient",targetId:s(u)?.uid},null,8,["targetId"])):n("v-if",!0)])),[[C]]):n("v-if",!0)]),n(" Patient Edit Form Modal "),s(i)?(o(),_(te,{key:0,onClose:r[3]||(r[3]=t=>x(i)?i.value=!1:i=!1),contentWidth:"w-3/6"},{header:v(()=>[je]),body:v(()=>[f(de,{patient:s(u),navigate:!1,onClose:U},null,8,["patient"])]),_:1})):n("v-if",!0)])],64)}}});const Ue=ie(Ae,[["__scopeId","data-v-81af20fc"],["__file","/home/aurthur/Development/Python/felicity/felicity-lims/webapp/views/patient/PatientsCompact.vue"]]);export{Ue as default};