mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 17:02:55 +08:00
4 lines
13 KiB
JavaScript
4 lines
13 KiB
JavaScript
import{f as pe,r as y,d as z,v as be,h as n,k as l,x as e,s as j,u as d,B as F,F as x,ak as k,D as c,ag as m,y as b,i as _e,_ as fe}from"./_plugin-vue_export-helper-dacf3d65.js";import{y as ge,D as xe,ah as me}from"./shipment-53265c2d.js";import{u as ve}from"./analysis-47167c72.js";import{h as w,o as R,a as C}from"./constants-743d82a1.js";import{a as p,e as K,v as W,d as G}from"./runtime-dom.esm-bundler-98433118.js";const ke=e("hr",null,null,-1),we={class:"flex justify-end"},Re={key:0,class:"overflow-x-auto mt-4"},Ce={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"},Ue={class:"min-w-full"},Se=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},null,-1),Ee=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}," Analysis ",-1),Ve=e("th",{class:"px-1 py-1 border-b-2 border-gray-300"},null,-1),Ae={class:"bg-white"},De=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),$e={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Te={class:"text-sm leading-5 text-gray-800"},qe={class:"flex items-center"},Le=["onUpdate:modelValue","disabled"],Pe={key:0,class:"text-sm leading-5 text-sky-800"},Be={key:1,class:"block"},Ie=["onUpdate:modelValue","onKeyup"],Ke={key:2,class:"block col-span-2"},Ne=["onUpdate:modelValue","onChange"],Qe=e("option",{value:""},null,-1),Me=["value"],Oe={class:"text-sm italics text-sky-800"},ze={key:1,class:"overflow-x-auto"},je={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"},Fe={class:"min-w-full"},We={class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},Ge=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},null,-1),He=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}," Analysis ",-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"}," Methods ",-1),Xe=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),Ye=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),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"}," Result ",-1),et=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),tt=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),st=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),at=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),ot=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),nt=e("th",{class:"px-1 py-1 border-b-2 border-gray-300"},null,-1),lt={class:"bg-white"},rt=["onUpdate:modelValue","disabled"],it=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),dt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ct={class:"text-sm leading-5 text-sky-800"},ut={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},yt={class:"text-sm leading-5 text-sky-800"},ht={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},pt={class:"text-sm leading-5 text-sky-800"},bt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},_t={class:"text-sm leading-5 text-sky-800"},ft={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},gt={key:0,class:"text-sm leading-5 text-sky-800"},xt={key:1,class:"block"},mt=["onUpdate:modelValue","onKeyup"],vt={key:2,class:"block col-span-2 mb-2"},kt=["onUpdate:modelValue","onChange"],wt=e("option",{value:""},null,-1),Rt=["value"],Ct={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ut={class:"text-sm leading-5 text-sky-800"},St={key:0,class:"text-sky-800"},Et=e("i",{class:"fa fa-check-circle","aria-hidden":"true"},null,-1),Vt=[Et],At={key:1,class:"text-orange-600"},Dt=e("i",{class:"fa fa-times-circle","aria-hidden":"true"},null,-1),$t=[Dt],Tt=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},[e("div",{class:"text-sm leading-5 text-sky-800"},"2020-10-10")],-1),qt=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},[e("div",{class:"text-sm leading-5 text-sky-800"},"2020-10-10")],-1),Lt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Pt={type:"button",class:"bg-sky-800 text-white p-1rounded-smleading-none"},Bt={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},It={class:"text-sm leading-5 text-sky-800"},Kt={key:0,class:"text-sky-800"},Nt=e("i",{class:"fa fa-thumbs-up","aria-hidden":"true"},null,-1),Qt=[Nt],Mt={key:1,class:"text-orange-600"},Ot=e("i",{class:"fa fa-thumbs-down","aria-hidden":"true"},null,-1),zt=[Ot],jt=e("td",{class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},[b(` <button @click.prevent="submitResult(result)" \r
|
|
class="p-1 ml-2 border-white border text-gray-500rounded-smtransition duration-300 hover:border-sky-800 hover:text-sky-800 focus:outline-none">\r
|
|
submit\r
|
|
</button> `)],-1),Ft={class:"my-4"},Wt=pe({__name:"QCSet",setup(Gt){let _=ge(),H=xe(),E=y(!1),A=y(!1),D=y(!1),$=y(!1),T=y(!1),f=y(!1);_.fetchQCSetByUid(H.params.qcSetUid);let g=z(()=>{let a=_.getQCSet;if(!a)return;let t={levels:[],analytes:[]};return a?.samples?.forEach(r=>{r.assigned||(t.levels.some(s=>s.uid==r?.qcLevel?.uid)||t.levels.push(r?.qcLevel),r?.analysisResults?.forEach(s=>{t.analytes.some(i=>i.uid==s?.analysis?.uid)||t.analytes.push(s?.analysis);const o=t.analytes.findIndex(i=>i.uid==s?.analysis?.uid);t.analytes[o].items?t.analytes[o].items?.some(i=>i.sampleUid===s.sampleUid)||t.analytes[o].items.push({...s,sample:r}):t.analytes[o].items=[{...s,sample:r}]}))}),B("grid"),{levels:t.levels,analytes:t.analytes}});function N(){let a=[];return g?.value.analytes?.forEach(t=>t.items.forEach(r=>a.push(r))),a}function J(){let a=[];return g?.value.analytes?(g?.value.analytes?.forEach(t=>{t?.items?.forEach(r=>a.push(r))}),a):[]}function q(){let a=[];return g?.value.analytes?(g?.value.analytes?.forEach(t=>{t?.items?.forEach(r=>{r.checked&&a.push(r)})}),a):[]}function U(){const a=q();let t=[];return a?.forEach(r=>t.push(r.uid)),t}function u(){E.value=!1,A.value=!1,D.value=!1,$.value=!1,T.value=!1;const a=q();a.length!==0&&(a.every(t=>t.status==="cancelled")&&(T.value=!0),a.every(t=>t.status==="pending")&&(E.value=!0),a.every(t=>t.status==="resulted")&&(A.value=!0,D.value=!0,$.value=!0))}function X(){return J()?.every(t=>t.checked===!0)}function S(a){a.checked=!0,u()}function Y(a){a.checked=!1,u()}function Z(){N()?.forEach(t=>f.value?S(t):Y(t)),u()}function Q(){X()?f.value=!0:f.value=!1,u()}function ee(a){a.editable=!0}function M(a){return a?.editable||me(a?.result)?["cancelled","verified","retracted","to_be_verified"].includes(a.status)?(a.editable=!1,!1):(ee(a),!0):!1}function O(a){switch(a?.status){case"retracted":return!0;case"verified":return a?.reportable===!1;default:return!1}}function te(){let a=q(),t=[];return a?.forEach(r=>t.push({uid:r.uid,result:r.result})),t}const v=async()=>{const a=z(()=>_.getSample);a.value&&_.fetchSampleStatus(a?.value?.uid)};let{submitResults:se,cancelResults:ae,reInstateResults:oe,approveResults:ne,retractResults:le,retestResults:re}=ve();const ie=()=>se(te(),"qcset",_.qcSet?.uid).then(a=>(v(),u())),de=()=>ae(U()).then(a=>(v(),u())),ce=()=>oe(U()).then(a=>(v(),u())),ue=()=>ne(U(),"qcset",_.qcSet?.uid).then(a=>(v(),u())),ye=()=>le(U()).then(a=>(v(),u())),he=()=>re(U()).then(a=>(v(),u()));let h=y(!0),L=y("grid"),P=y(!1);function B(a){let t=[],r=[];_.getQCSet?.samples?.forEach(o=>{r.push(o),o.assigned||o?.analysisResults?.forEach(i=>t.push(i))});for(let o of r){const i=t.filter(I=>I.sampleUid===o.uid);let V=[];if(i?.forEach(I=>V.push(I.analysisUid)),P.value=new Set(V).size!==V.length,P.value===!0)break}P.value?(h.value=!1,L.value="list"):a==="grid"?(h.value=!0,L.value="grid"):(h.value=!1,L.value="list")}return(a,t)=>{const r=be("font-awesome-icon");return n(),l(x,null,[ke,e("div",we,[e("button",{class:j(["focus:outline-none",{"fill-current text-gray-900":d(h)===!0},{"fill-current text-gray-200":d(h)===!1}]),onClick:t[0]||(t[0]=p(s=>B("grid"),["prevent"]))},[F(r,{icon:"th"})],2),e("button",{class:j(["focus:outline-none ml-2",{"fill-current text-gray-900":d(h)===!1},{"fill-current text-gray-200":d(h)===!0}]),onClick:t[1]||(t[1]=p(s=>B("list"),["prevent"]))},[F(r,{icon:"th-list"})],2)]),d(h)?(n(),l("section",Re,[e("div",Ce,[e("table",Ue,[e("thead",null,[e("tr",null,[Se,Ee,(n(!0),l(x,null,k(d(g)?.levels,s=>(n(),l("th",{key:s.uid,class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},c(s?.level),1))),128)),Ve])]),e("tbody",Ae,[(n(!0),l(x,null,k(d(g)?.analytes,s=>(n(),l("tr",{key:s.uid},[De,e("td",$e,[e("div",Te,c(s?.name),1)]),(n(!0),l(x,null,k(s?.items,o=>(n(),l("td",{key:o.uid,class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},[e("div",qe,[m(e("input",{type:"checkbox",class:"mr-2","onUpdate:modelValue":i=>o.checked=i,onChange:t[2]||(t[2]=i=>Q()),disabled:O(o)},null,40,Le),[[K,o.checked]]),e("div",null,[M(o)?o?.analysis?.resultOptions?.length<1?(n(),l("label",Be,[m(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":i=>o.result=i,onKeyup:i=>S(o)},null,40,Ie),[[W,o.result]])])):(n(),l("label",Ke,[m(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":i=>o.result=i,onChange:i=>S(o)},[Qe,(n(!0),l(x,null,k(o?.analysis?.resultOptions,(i,V)=>(n(),l("option",{key:i.optionKey,value:i.value},c(i.value),9,Me))),128))],40,Ne),[[G,o.result]])])):(n(),l("div",Pe,c(o?.result),1)),b(' <div class="text-sm italics text-sky-800"> {{ result?.sample?.qcLevel?.level }}</div> '),e("div",Oe,c(o?.status),1)])])]))),128))]))),128))])])])])):(n(),l("section",ze,[e("div",je,[e("table",Fe,[e("thead",null,[e("tr",null,[e("th",We,[m(e("input",{type:"checkbox",class:"",onChange:t[3]||(t[3]=s=>Z()),"onUpdate:modelValue":t[4]||(t[4]=s=>_e(f)?f.value=s:f=s)},null,544),[[K,d(f)]])]),Ge,He,Je,Xe,Ye,Ze,et,tt,st,at,ot,nt])]),e("tbody",lt,[(n(!0),l(x,null,k(N(),s=>(n(),l("tr",{key:s.uid},[e("td",null,[m(e("input",{type:"checkbox",class:"","onUpdate:modelValue":o=>s.checked=o,onChange:t[5]||(t[5]=o=>Q()),disabled:O(s)},null,40,rt),[[K,s.checked]])]),it,e("td",dt,[e("div",ct,c(s.analysis?.name),1)]),e("td",ut,[e("div",yt,c(s.method?.name||"None"),1)]),e("td",ht,[e("div",pt,c(s.instrument?.name||"None"),1)]),e("td",bt,[e("div",_t,c(s.analyst?.name||"moyoza"),1)]),e("td",ft,[M(s)?s?.analysis?.resultOptions?.length===0?(n(),l("label",xt,[m(e("input",{class:"form-input mt-1 block w-full","onUpdate:modelValue":o=>s.result=o,onKeyup:o=>S(s)},null,40,mt),[[W,s.result]])])):(n(),l("label",vt,[m(e("select",{class:"form-input mt-1 block w-full","onUpdate:modelValue":o=>s.result=o,onChange:o=>S(s)},[wt,(n(!0),l(x,null,k(s?.analysis?.resultOptions,(o,i)=>(n(),l("option",{key:o.optionKey,value:o.value},c(o.value),9,Rt))),128))],40,kt),[[G,s.result]])])):(n(),l("div",gt,c(s?.result),1))]),e("td",Ct,[e("div",Ut,[s?.retest?(n(),l("span",St,Vt)):(n(),l("span",At,$t))])]),Tt,qt,e("td",Lt,[e("button",Pt,c(s.status),1)]),e("td",Bt,[e("div",It,[s?.reportable?(n(),l("span",Kt,Qt)):(n(),l("span",Mt,zt))])]),jt]))),128))])])])])),e("section",Ft,[w(C.UPDATE,R.RESULT)&&d(E)?(n(),l("button",{key:0,onClick:t[6]||(t[6]=p(s=>de(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Cancel ")):b("v-if",!0),w(C.UPDATE,R.RESULT)&&d(T)?(n(),l("button",{key:1,onClick:t[7]||(t[7]=p(s=>ce(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Re-Instate ")):b("v-if",!0),w(C.UPDATE,R.RESULT)&&d(E)?(n(),l("button",{key:2,onClick:t[8]||(t[8]=p(s=>ie(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Submit ")):b("v-if",!0),w(C.UPDATE,R.RESULT)&&d(A)?(n(),l("button",{key:3,onClick:t[9]||(t[9]=p(s=>ye(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Retract ")):b("v-if",!0),w(C.UPDATE,R.RESULT)&&d(D)?(n(),l("button",{key:4,onClick:t[10]||(t[10]=p(s=>ue(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Verify ")):b("v-if",!0),w(C.UPDATE,R.RESULT)&&d($)?(n(),l("button",{key:5,onClick:t[11]||(t[11]=p(s=>he(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"}," Retest ")):b("v-if",!0)])],64)}}}),es=fe(Wt,[["__file","/home/aurthurm/Development/felicity-lims/webapp/views/qcontrol/_id/QCSet.vue"]]);export{es as default};
|