felicity-lims/felicity/templates/static/assets/QualityControlListing-d0461d9a.js
2024-04-21 12:22:39 +02:00

1 line
10 KiB
JavaScript

import{d as se,W as oe,ab as ne,L as le,s as ae,r as C,C as A,D as f,z as ie,o as n,c as l,b as e,e as p,E,w as x,i as L,f as i,F as h,p as v,t as _,g as P,G as U,H as re,x as w,ac as g,q as de,j as D,h as ce,_ as R,aR as ue,O as pe,k as he}from"./index-2a6c9271.js";import{h as _e,o as me,a as fe}from"./constants-b0c30fb3.js";const ve={class:"flex items-center justify-between"},be=e("h1",{class:"h1 font-bold text-dark-700"},"QC Analyses Requests",-1),ye=e("hr",null,null,-1),ge={class:"overflow-x-auto mt-4"},xe={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"},we={class:"min-w-full"},ke=e("thead",null,[e("tr",null,[e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},"Date Created"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"QCSet (samples)"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"},"Test(s)"),e("th",{class:"px-1 py-1 border-b-2 border-gray-300"})])],-1),Ce={class:"bg-white"},Se=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),Qe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ae={class:"flex items-center"},Le={class:"text-sm leading-5 text-gray-800"},Ue={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ve={class:"text-sm leading-5 text-sky-800"},qe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ee={class:"text-sm leading-5 text-sky-800"},Pe={class:"px-1 py-1 whitespace-no-wrap text-right border-b border-gray-500 text-sm leading-5"},De={key:0,class:"py-4 text-center"},Re={class:"flex justify-between"},Te=e("div",null,null,-1),je={class:"my-4 flex sm:flex-row flex-col"},Me={class:"flex flex-row mb-1 sm:mb-0"},Be={class:"relative"},Ie=["disabled"],Ne=ce('<option value="25">25</option><option value="50">50</option><option value="100">100</option><option value="250">250</option><option value="500">500</option><option value="1000">1000</option><option value="5000">5000</option><option value="10000">10000</option>',8),$e=[Ne],Fe=e("div",{class:"pointer-events-none absolute inset-y-0 right-0 flex items-center px-2 text-gray-700"},[e("svg",{class:"fill-current h-4 w-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20"},[e("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"})])],-1),Oe={class:"block relative"},ze=["placeholder"],Ge=e("h3",null,"Create QC Analyses Requests",-1),He={action:"post",class:"mb-8 bg-white"},We={class:"grid grid-cols-3 gap-x-4 mb-4"},Ze={class:"block col-span-1"},Je=e("span",{class:"text-gray-700"},"Department",-1),Ke=e("option",{value:""},null,-1),Xe=["value"],Ye={id:"samples"},et=e("hr",null,null,-1),tt={class:"flex justify-between items-center py-2"},st=e("h5",null,"Process Control Samples",-1),ot=e("i",{class:"fa fa-ellipsis-h","aria-hidden":"true"},null,-1),nt=[ot],lt=e("hr",{class:"mb-4"},null,-1),at={class:"flex items-center justify-between"},it={class:""},rt={class:"grid grid-cols-4 gap-x-4"},dt={class:"block col-span-1 mb-2"},ct=e("span",{class:"text-gray-700"},"QC Template",-1),ut=["onUpdate:modelValue"],pt=e("option",{value:""},null,-1),ht=["value"],_t={key:0,class:"block col-span-1 mb-2"},mt=e("span",{class:"text-gray-700"},"QC Levels",-1),ft=["onUpdate:modelValue"],vt=e("option",{value:""},null,-1),bt=["value"],yt={class:"block col-span-1 mb-2"},gt=e("span",{class:"text-gray-700"},"Analysis Profiles",-1),xt=["onUpdate:modelValue"],wt=e("option",{value:""},null,-1),kt=["value"],Ct={key:1,class:"block col-span-1 mb-2"},St=e("span",{class:"text-gray-700"},"Analysis Services",-1),Qt=["onUpdate:modelValue"],At=e("option",{value:""},null,-1),Lt=["value"],Ut={class:""},Vt=["onClick"],qt=e("hr",null,null,-1),Et=e("hr",null,null,-1),Pt=se({__name:"QualityControlListing",setup(Dt){const T=D(()=>R(()=>import("./LoadingMessage-72d34fcf.js"),["assets/LoadingMessage-72d34fcf.js","assets/index-2a6c9271.js","assets/index-88806377.css"])),j=D(()=>R(()=>import("./SimpleModal-0c0664c5.js"),["assets/SimpleModal-0c0664c5.js","assets/index-2a6c9271.js","assets/index-88806377.css","assets/SimpleModal-f645a074.css"])),c=oe(),u=ne(),V=le(),{withClientMutation:M}=pe(),{qcSets:B,fetchingQCSets:I}=ae(c);let d=C(!1),N=C(!0),m=A({departmentUid:void 0,samples:[{}]}),$=A({first:void 0,after:"",text:"",sortBy:["name"]});u.fetchAnalysesServices($),u.fetchQCLevels(),u.fetchQCTemplates(),u.fetchAnalysesProfiles(),V.fetchDepartments({}),c.resetQCSets();let b=C(25),y=A({first:b.value,after:"",text:"",sortBy:["uid"],filterAction:!1});c.fetchQCSets(y);const F=f(()=>u.getAnalysesProfiles),O=f(()=>{const r=u.getAnalysesServicesSimple;let s=new Set;return r.forEach(a=>{a.profiles?.length===0&&s.add(a)}),[...s]});function z(){M(ue,{samples:m.samples},"createQcSet").then(r=>c.addQCSet(r))}function G(){m.samples?.push({})}function H(r){m.samples?.splice(r,1)}function W(){N.value===!0&&z(),d.value=!1}const S=f(()=>c.getQCSetPageInfo);function Z(){y.first=+b.value,y.after=S?.value?.pageInfo?.endCursor??"",y.text="",y.filterAction=!1,c.fetchQCSets(y)}function J(r){let s=[];return r?.forEach(a=>{a?.sampleId+""+a.status;let t=a?.qcLevel?.level?.match(/\b([A-Z])/g).join("")+" ("+a.status+")";s.includes(t)||s.push(t)}),s.join(", ")}function K(r){let s=[];return r?.forEach(a=>{a.profiles.forEach(t=>{s.includes(t.name)||s.push(t.name)})}),r?.forEach(a=>{a.analyses.forEach(t=>{s.includes(t.name)||s.push(t.name)})}),s.join(", ")}const k=C(!1),X=f(()=>V.getDepartments),Y=f(()=>u.getQCTemplates),ee=f(()=>u.getQCLevels),te=f(()=>c.getQCSets?.length+" of "+c.getQCSetCount+" QC Sets");return(r,s)=>{const a=ie("router-link");return n(),l(h,null,[e("div",ve,[be,p(e("button",{type:"button",class:"border border-sky-800 text-sky-800 rounded-sm px-2 py-1 m-2 transition-colors duration-500 ease select-none hover:bg-sky-800 hover:text-white focus:outline-none focus:shadow-outline",onClick:s[0]||(s[0]=x(t=>L(d)?d.value=!i(d):d=!i(d),["prevent"]))}," Add New QC Request ",512),[[E,_e(fe.CREATE,me.SAMPLE)]])]),ye,e("section",ge,[e("div",xe,[e("table",we,[ke,e("tbody",Ce,[(n(!0),l(h,null,v(i(B),t=>(n(),l("tr",{key:t.uid},[Se,e("td",Qe,[e("div",Ae,[e("div",Le,_(t.createdAt),1)])]),e("td",Ue,[e("div",Ve,_(J(t.samples??[])),1)]),e("td",qe,[e("div",Ee,_(K(t.samples??[])),1)]),e("td",Pe,[P(a,{to:{name:"qc-set-detail",params:{qcSetUid:t.uid}},class:"px-2 py-1 mr-2 border-sky-800 border text-gray-500rounded-smtransition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"},{default:U(()=>[re("View Detail")]),_:2},1032,["to"])])]))),128))])]),i(I)?(n(),l("div",De,[P(i(T),{message:"Fetching QCSets ..."})])):w("",!0)])]),e("section",Re,[Te,e("div",je,[p(e("button",{onClick:s[1]||(s[1]=x(t=>Z(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"},"Show More",512),[[E,S.value?.pageInfo?.hasNextPage]]),e("div",Me,[e("div",Be,[p(e("select",{class:"appearance-none h-full rounded-l-sm border block w-full bg-white border-gray-400 text-gray-700 py-2 px-4 pr-8 leading-tight focus:outline-none focus:bg-white focus:border-gray-500","onUpdate:modelValue":s[2]||(s[2]=t=>L(b)?b.value=t:b=t),disabled:!S.value?.pageInfo?.hasNextPage},[...$e],8,Ie),[[g,i(b)]]),Fe])]),e("div",Oe,[e("input",{placeholder:te.value,class:"appearance-none rounded-r-sm rounded-l-sm sm:rounded-l-none border border-gray-400 border-b block pl-8 pr-6 py-2 w-full bg-white text-sm placeholder-gray-400 text-gray-700 focus:bg-white focus:placeholder-gray-600 focus:text-gray-700 focus:outline-none",disabled:""},null,8,ze)])])]),i(d)?(n(),de(i(j),{key:0,onClose:s[7]||(s[7]=t=>L(d)?d.value=!1:d=!1)},{header:U(()=>[Ge]),body:U(()=>[e("form",He,[e("div",We,[e("label",Ze,[Je,p(e("select",{name:"clientContacts",id:"clientContacts","onUpdate:modelValue":s[3]||(s[3]=t=>i(m).departmentUid=t),class:"form-input mt-1 block w-full"},[Ke,(n(!0),l(h,null,v(X.value,t=>(n(),l("option",{key:t.uid,value:t.uid},_(t.name),9,Xe))),128))],512),[[g,i(m).departmentUid]])])]),e("section",Ye,[et,e("div",tt,[st,e("span",{class:"cursor-pointer text-xl text-sky-800",onClick:s[4]||(s[4]=t=>k.value=!k.value)},[...nt]),i(m).samples?.length<20?(n(),l("button",{key:0,onClick:s[5]||(s[5]=x(t=>G(),["prevent"])),class:"px-2 py-1 mr-2 border-sky-800 border text-sky-800 rounded-sm transition duration-300 hover:bg-sky-800 hover:text-white focus:outline-none"},"Add QCSet")):w("",!0)]),lt,(n(!0),l(h,null,v(i(m).samples,(t,q)=>(n(),l("div",{key:q},[e("div",at,[e("div",it,[e("div",rt,[e("label",dt,[ct,p(e("select",{"onUpdate:modelValue":o=>t.qcTemplateUid=o,class:"form-input mt-1 block w-full"},[pt,(n(!0),l(h,null,v(Y.value,(o,Q)=>(n(),l("option",{key:o.uid,value:o.uid},_(o.name),9,ht))),128))],8,ut),[[g,t.qcTemplateUid]])]),k.value?(n(),l("label",_t,[mt,p(e("select",{"onUpdate:modelValue":o=>t.qcLevels=o,class:"form-input mt-1 block w-full",multiple:""},[vt,(n(!0),l(h,null,v(ee.value,(o,Q)=>(n(),l("option",{key:o.uid,value:o.uid},_(o.level),9,bt))),128))],8,ft),[[g,t.qcLevels]])])):w("",!0),e("label",yt,[gt,p(e("select",{"onUpdate:modelValue":o=>t.analysisProfiles=o,class:"form-input mt-1 block w-full",multiple:""},[wt,(n(!0),l(h,null,v(F.value,(o,Q)=>(n(),l("option",{key:o.uid,value:o.uid},_(o.name),9,kt))),128))],8,xt),[[g,t.analysisProfiles]])]),k.value?(n(),l("label",Ct,[St,p(e("select",{"onUpdate:modelValue":o=>t.analysisServices=o,class:"form-input mt-1 block w-full",multiple:""},[At,(n(!0),l(h,null,v(O.value,(o,Q)=>(n(),l("option",{key:o.uid,value:o.uid},_(o.name),9,Lt))),128))],8,Qt),[[g,t.analysisServices]])])):w("",!0)])]),e("div",Ut,[e("button",{onClick:x(o=>H(q),["prevent"]),class:"px-2 py-1 mr-2 border-orange-600 border text-orange-600rounded-smtransition duration-300 hover:bg-orange-600 hover:text-white focus:outline-none"},"Remove",8,Vt)])]),qt]))),128))]),Et,e("button",{type:"button",onClick:s[6]||(s[6]=x(t=>W(),["prevent"])),class:"-mb-4 w-full 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 Form ")])]),_:1})):w("",!0)],64)}}}),jt=he(Pt,[["__file","/home/aurthur/Documents/Development/felicity-lims/webapp/views/qcontrol/QualityControlListing.vue"]]);export{jt as default};