mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
import{d as ue,ah as pe,L as _e,W as he,s as ye,C as be,N as me,V as ge,z as fe,n as xe,o,c as n,b as e,f as p,g as u,e as i,ad as M,F as _,p as f,y as ke,q as F,x as O,t as c,H as h,ac as I,v as ve,as as $,E as x,G as k,w as v,j as we,_ as Re,a$ as j,D as Ce,k as Ue}from"./index-2a6c9271.js";import w from"./Button-21c3372d.js";import{u as Se}from"./analysis-48dc782c.js";import{h as R,o as C,a as U}from"./constants-b0c30fb3.js";const Ee=e("hr",{class:"mt-4 mb-2"},null,-1),Ve=e("h3",{class:"font-bold"},"Analyses/Results",-1),Ae=e("hr",{class:"mb-4 mt-2"},null,-1),De={class:"overflow-x-auto"},Te={class:"align-middle inline-block min-w-full shadow overflow-hidden bg-white shadow-dashboard px-2 pt-1 rounded-bl-lg rounded-br-lg"},Ie={key:0,class:"py-4 text-center"},Ne={key:1,class:"min-w-full"},Le={class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},$e=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},null,-1),Be=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}," Analysis ",-1),Pe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Instrument ",-1),Me=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Method ",-1),Fe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Analyst ",-1),Oe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Reviewer(s) ",-1),je=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Interim ",-1),qe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Result ",-1),Ke=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Retest ",-1),ze=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Due Date ",-1),We=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Submitted ",-1),Ge=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Approved ",-1),He=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Status ",-1),Je=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Reportable ",-1),Qe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300"},null,-1),Xe={class:"bg-white"},Ye=["onUpdate:modelValue","onChange","disabled"],Ze=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),et={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},tt={class:"text-sm leading-5 text-sky-800 font-semibold"},st={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},at={key:0,class:"text-sm leading-5 text-sky-800"},ot={key:1,class:"block col-span-2 mb-2"},nt=["onUpdate:modelValue","onChange"],rt=e("option",{value:""},null,-1),lt=["value"],ct={class:"flex justify-start items-center gap-x-1"},it={class:"text-xs font-thin text-gray-300"},dt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ut={key:0,class:"text-sm leading-5 text-sky-800"},pt={key:1,class:"block col-span-2 mb-2"},_t=["onUpdate:modelValue","onChange"],ht=e("option",{value:""},null,-1),yt=["value"],bt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},mt={class:"text-sm leading-5 text-sky-800"},gt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ft={class:"text-sm leading-5 text-sky-800"},xt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},kt={key:0,class:"text-sm leading-5 text-sky-800"},vt={key:1,class:"block col-span-2 mb-2"},wt=["onUpdate:modelValue","onChange"],Rt=e("option",{value:""},null,-1),Ct=["value"],Ut={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},St={key:0,class:"text-sm leading-5 text-sky-800"},Et={key:1,class:"block"},Vt=["onUpdate:modelValue","onKeyup"],At={key:2,class:"block col-span-2 mb-2"},Dt=["onUpdate:modelValue","onChange"],Tt=e("option",{value:""},null,-1),It=["value"],Nt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Lt={class:"text-sm leading-5 text-sky-800"},$t={key:0,class:"text-sky-800"},Bt={key:1,class:"text-orange-600"},Pt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Mt={class:"text-sm leading-5 text-sky-800"},Ft={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ot={class:"text-sm leading-5 text-sky-800"},jt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},qt={class:"text-sm leading-5 text-sky-800"},Kt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},zt={type:"button",class:"bg-sky-800 text-white px-2 py-1 rounded-sm leading-none"},Wt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Gt={class:"text-sm leading-5 text-sky-800"},Ht={key:0,class:"text-emerald-600"},Jt={key:1,class:"text-orange-600"},Qt=e("td",{class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},null,-1),Xt={class:"my-4"},Yt=ue({__name:"Results",setup(Zt){const q=we(()=>Re(()=>import("./LoadingMessage-72d34fcf.js"),["assets/LoadingMessage-72d34fcf.js","assets/index-2a6c9271.js","assets/index-88806377.css"])),N=pe(),A=_e(),y=he(),{sample:D,analysisResults:S,fetchingResults:K}=ye(y),r=be({can_submit:!1,can_cancel:!1,can_retract:!1,can_approve:!1,can_retest:!1,can_reinstate:!1,allChecked:!1});me(()=>{A.fetchLaboratoryInstruments(),A.fetchMethods(),y.fetchAnalysisResultsForSample(N.params.sampleUid)}),ge(()=>N.params.sampleUid,(s,l)=>{y.resetSample(),y.fetchAnalysisResultsForSample(N.params.sampleUid)});function L(){let s=[];return S?.value?.forEach(l=>{l.checked&&s.push(l)}),s}function z(){let s=L(),l=[];return s?.forEach(d=>l.push({uid:d.uid,result:d.result,methodUid:d.methodUid,laboratoryInstrumentUid:d.laboratoryInstrumentUid})),l}function E(){const s=L();let l=[];return s?.forEach(d=>l.push(d.uid)),l}function W(s){H()?r.allChecked=!0:r.allChecked=!1,V()}function b(s){P(s)||(s.checked=!0,V())}function B(s){s.checked=!1,V()}async function G(){await S?.value?.forEach(s=>r.allChecked?b(s):B(s)),V()}async function m(){await S?.value?.forEach(s=>B(s)),V()}function H(){return S?.value?.every(s=>s.checked===!0)}function P(s){switch(s?.status){case"retracted":return!0;case"approved":return!0;case"cancelled":return D?.value?.status!=="received";default:return!1}}function J(s){s.editable=!0}function T(s){return!["received","paired"].includes(D?.value?.status??"")||s.status!=="pending"?!1:s?.editable||j(s?.result)?(J(s),!0):!1}function Q(s){switch(s?.status){case"retracted":return"bg-gray-300";case"aproved":return s?.reportable===!1?"bg-orange-600":"";default:return""}}function V(){r.can_cancel=!1,r.can_submit=!1,r.can_retract=!1,r.can_approve=!1,r.can_retest=!1,r.can_reinstate=!1;const s=L();s.length!==0&&(s.every(l=>l.status==="cancelled")&&(r.can_reinstate=!0),s.every(l=>l.status==="pending")&&(r.can_cancel=!0),s.every(l=>["pending"].includes(l.status??"")&&!j(l.result))&&(r.can_submit=!0),s.every(l=>l.status==="resulted")&&(r.can_retract=!0,r.can_approve=!0,r.can_retest=!0))}const g=async()=>{const s=Ce(()=>y.getSample);s.value&&y.fetchSampleStatus(s?.value?.uid)};let{submitResults:X,cancelResults:Y,reInstateResults:Z,approveResults:ee,retractResults:te,retestResults:se}=Se();const ae=()=>X(z(),"sample",D?.value?.uid).then(()=>g()).finally(()=>m()),oe=()=>Y(E()).then(()=>g()).finally(()=>m()),ne=()=>Z(E()).then(()=>g()).finally(()=>m()),re=()=>ee(E(),"sample",D?.value?.uid).then(()=>g()).finally(()=>m()),le=()=>te(E()).then(()=>g()).finally(()=>m()),ce=()=>se(E()).then(()=>g()).finally(()=>m());return(s,l)=>{const d=fe("font-awesome-icon"),ie=xe("motion-slide-right");return o(),n(_,null,[Ee,Ve,Ae,e("div",De,[e("div",Te,[p(K)?(o(),n("div",Ie,[u(p(q),{message:"Fetching analytes ..."})])):(o(),n("table",Ne,[e("thead",null,[e("tr",null,[e("th",Le,[i(e("input",{type:"checkbox",class:"",onChange:G,"onUpdate:modelValue":l[0]||(l[0]=t=>r.allChecked=t)},null,544),[[M,r.allChecked]])]),$e,Be,Pe,Me,Fe,Oe,je,qe,Ke,ze,We,Ge,He,Je,Qe])]),e("tbody",Xe,[(o(!0),n(_,null,f(p(S),t=>i((o(),n("tr",{key:t.uid,class:ke([Q(t)])},[e("td",null,[i(e("input",{type:"checkbox",class:"border-red-500","onUpdate:modelValue":a=>t.checked=a,onChange:a=>W(),disabled:P(t)},null,40,Ye),[[M,t.checked]]),t.status==="pending"?(o(),F(d,{key:0,icon:"fa-question",class:"ml-1 text-xs"})):O("",!0),t.status==="resulted"?(o(),F(d,{key:1,icon:"fa-question",class:"ml-1 text-xs text-orange"})):O("",!0)]),Ze,e("td",et,[e("div",tt,c(t.analysis?.name),1)]),e("td",st,[T(t)?(o(),n("label",ot,[i(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>t.laboratoryInstrumentUid=a,onChange:a=>b(t)},[rt,(o(!0),n(_,null,f(p(A).laboratoryInstruments,a=>(o(),n("option",{key:a.uid,value:a.uid},[e("div",ct,[e("span",null,c(a.labName),1),h(" → "),e("span",it,"("+c(a?.instrument?.name)+")",1)])],8,lt))),128))],40,nt),[[I,t.laboratoryInstrumentUid]])])):(o(),n("div",at,c(t.laboratoryInstrument?.labName||"---"),1))]),e("td",dt,[T(t)?(o(),n("label",pt,[i(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>t.methodUid=a,onChange:a=>b(t)},[ht,(o(!0),n(_,null,f(p(A).methods,a=>(o(),n("option",{key:a.uid,value:a.uid},c(a.name),9,yt))),128))],40,_t),[[I,t.methodUid]])])):(o(),n("div",ut,c(t.method?.name||"---"),1))]),e("td",bt,[e("div",mt,c(`${t.submittedBy?.firstName??"--"} ${t.submittedBy?.lastName??"--"}`),1)]),e("td",gt,[e("div",ft,[(o(!0),n(_,null,f(t.verifiedBy,a=>(o(),n("span",{key:a.firstName,class:"ml-1"},c(`${a?.firstName??"--"} ${a?.lastName??"--"},`),1))),128))])]),e("td",xt,[!T(t)||t?.analysis?.interims?.length===0?(o(),n("div",kt," --- ")):(o(),n("label",vt,[i(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>t.result=a,onChange:a=>b(t)},[Rt,(o(!0),n(_,null,f(t?.analysis?.interims,(a,de)=>(o(),n("option",{key:a.key,value:a.value},c(a.value),9,Ct))),128))],40,wt),[[I,t.result]])]))]),e("td",Ut,[T(t)?t?.analysis?.resultOptions?.length===0?(o(),n("label",Et,[i(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>t.result=a,onKeyup:a=>b(t)},null,40,Vt),[[ve,t.result]])])):(o(),n("label",At,[i(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>t.result=a,onChange:a=>b(t)},[Tt,(o(!0),n(_,null,f(t?.analysis?.resultOptions,(a,de)=>(o(),n("option",{key:a.optionKey,value:a.value},c(a.value),9,It))),128))],40,Dt),[[I,t.result]])])):(o(),n("div",St,c(t?.result),1))]),e("td",Nt,[e("div",Lt,[t?.retest?(o(),n("span",$t,[u(d,{icon:"fa-check-circle"})])):(o(),n("span",Bt,[u(d,{icon:"fa-times-circle"})]))])]),e("td",Pt,[e("div",Mt,c(p($)(t?.dueDate)),1)]),e("td",Ft,[e("div",Ot,c(p($)(t?.dateSubmitted)),1)]),e("td",jt,[e("div",qt,c(p($)(t?.dateVerified)),1)]),e("td",Kt,[e("button",zt,c(t.status),1)]),e("td",Wt,[e("div",Gt,[t?.reportable?(o(),n("span",Ht,[u(d,{icon:"fa-thumbs-up","aria-hidden":"true"})])):(o(),n("span",Jt,[u(d,{icon:"fa-thumbs-down","aria-hidden":"true"})]))])]),Qt],2)),[[ie]])),128))])]))])]),e("section",Xt,[i(u(w,{key:"cancel",onClick:v(oe,["prevent"]),color:"sky-800"},{default:k(()=>[h("Cancel")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_cancel]]),i(u(w,{key:"reinstate",onClick:v(ne,["prevent"]),color:"orange-600"},{default:k(()=>[h("Re-Instate")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_reinstate]]),i(u(w,{key:"submit",onClick:v(ae,["prevent"]),color:"orange-600"},{default:k(()=>[h("Submit")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_submit]]),i(u(w,{key:"retract",onClick:v(le,["prevent"]),color:"orange-600"},{default:k(()=>[h("Retract")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_retract]]),i(u(w,{key:"verify",onClick:v(re,["prevent"]),color:"orange-600"},{default:k(()=>[h("Verify")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_approve]]),i(u(w,{key:"retest",onClick:v(ce,["prevent"]),color:"orange-600"},{default:k(()=>[h("Retest")]),_:1},512),[[x,R(U.UPDATE,C.RESULT)&&r.can_retest]])])],64)}}}),os=Ue(Yt,[["__file","/home/aurthur/Documents/Development/felicity-lims/webapp/views/sample/_id/Results.vue"]]);export{os as default};
|