mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 00:42:59 +08:00
1 line
7.8 KiB
JavaScript
1 line
7.8 KiB
JavaScript
import{d as X,aq as Z,ar as ee,W as te,r as k,x as f,q as se,z as D,o as a,c as l,b as e,e as n,F as d,E as _,t as r,as as g,w,P as A,f as u,g as T,B as M,C as j,at as F,j as L,_ as N,S as P,ca as oe,cb as ae,M as le,k as ne}from"./index-e62f5c21.js";import{h as re,o as ie,a as ce}from"./constants-02c93bfe.js";const de=e("hr",null,null,-1),ue={action:"post",class:"mt-4"},pe={class:"flex justify-start items-center mr-4"},he=e("span",{class:"text-gray-700"},"Worksheet Template",-1),_e={class:"block mx-4"},me=e("option",null,null,-1),ye=["value"],fe=e("hr",{class:"mt-4 mb-2"},null,-1),ge=e("h3",{class:"font-bold"},"Manual Analyses Assignment",-1),be=e("hr",{class:"mb-4 mt-2"},null,-1),xe={class:"overflow-x-auto mt-4"},ve={action:"post",class:"p-1"},ke={class:"flex justify-start mb-4"},we={class:"flex justify-between items-center"},Ae=e("span",{class:"text-gray-700 mr-2"},"SampleType",-1),Te=["value"],Se={class:"flex justify-between items-center ml-6"},Ce=e("span",{class:"text-gray-700 mr-2"},"Analyses",-1),Ue=["value"],Ee={class:"ml-6 mt-2"},Be={class:"overflow-x-auto mt-4"},We={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"},Ve={key:0,class:"py-4 text-center"},De={key:1,class:"min-w-full"},Me={class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},je=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},null,-1),Fe=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}," Sample ID ",-1),Le=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Analysis ",-1),Ne=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left text-sm leading-4 text-gray-800 tracking-wider"}," Date Created ",-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"}," Date Received ",-1),Re=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),Ie={class:"bg-white"},qe=["onUpdate:modelValue","onChange"],Oe=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},null,-1),Ye={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},He={class:"text-sm leading-5 text-sky-800 font-semibold"},Ke={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Qe={class:"text-sm leading-5 text-sky-800"},$e={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ze={class:"text-sm leading-5 text-sky-800"},Ge={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Je={class:"text-sm leading-5 text-sky-800"},Xe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ze={class:"text-sm leading-5 text-sky-800"},et={class:"my-4"},tt={action:"post",class:"mb-4"},st={class:"flex justify-start items-center mr-4"},ot=e("span",{class:"text-gray-700"},"Apply QC Template",-1),at={class:"block mx-4"},lt=e("option",null,null,-1),nt=["value"],rt=X({__name:"WorkSheetAssign",setup(it){const R=L(()=>N(()=>import("./FelLoadingMessage-b4229f94.js"),["assets/FelLoadingMessage-b4229f94.js","assets/index-e62f5c21.js","assets/index-332ec99e.css"])),S=L(()=>N(()=>import("./FelButton-7b166825.js"),["assets/FelButton-7b166825.js","assets/index-e62f5c21.js","assets/index-332ec99e.css"])),c=Z(),m=ee(),C=te(),{withClientMutation:U}=le(),b=k();c.fetchWorkSheetTemplates();const E=f(()=>c.getWorkSheet),I=f(()=>c.getWorkSheetTemplates),q=async()=>{try{P.fire({title:"Are you sure?",text:"You want to apply this template to add samples?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, apply now!",cancelButtonText:"No, cancel apply!"}).then(s=>{s.isConfirmed&&U(oe,{worksheetUid:E?.value?.uid,templateUid:b.value},"updateWorksheetApplyTemplate").then(o=>{})})}catch{}};m.fetchAnalysesServices({first:void 0,after:"",text:"",sortBy:["name"]}),C.fetchSampleTypes(),m.fetchQCTemplates();const O=f(()=>m.getQCTemplates),x=k(void 0),p=se({sampleTypeUid:void 0,analysisUid:void 0}),h=k(!1),y=f(()=>{const s=B;return c.getAnalysisResults?.forEach(i=>{s?.some(v=>v.uid===i.uid)||s.push(i)}),s}),Y=()=>{W(),c.fetchForWorkSheetsAssign({first:50,after:"",text:"",sortBy:void 0,...p})},H=()=>{const s=K();try{P.fire({title:"Are you sure?",text:"You want to assign selected to worksheet?",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, assign now!",cancelButtonText:"No, cancel apply!"}).then(o=>{o.isConfirmed&&U(ae,{uid:E?.value?.uid,qcTemplateUid:x.value,analysesUids:s},"updateWorksheetApplyTemplate").then(i=>{})})}catch{}};let B=[];function W(){let s=[];return y?.value?.forEach(o=>{o.checked&&s.push(o)}),B=s,s}function K(){const s=W();let o=[];return s?.forEach(i=>o.push(i.uid)),o}function Q(s){J()?h.value=!0:h.value=!1}function $(s){s.checked=!0}function z(s){s.checked=!1}async function G(){await y?.value?.forEach(s=>h.value?$(s):z(s))}function J(){return y?.value?.every(s=>s.checked===!0)}return(s,o)=>{const i=D("motion-slide-right"),v=D("motion-slide-left");return a(),l(d,null,[e("section",null,[de,n((a(),l("form",ue,[e("div",pe,[he,e("label",_e,[n(e("select",{class:"form-select block w-full py-1","onUpdate:modelValue":o[0]||(o[0]=t=>b.value=t)},[me,(a(!0),l(d,null,_(I.value,t=>(a(),l("option",{key:t.uid,value:t.uid},r(t.name),9,ye))),128))],512),[[g,b.value]])]),n(e("button",{type:"button",onClick:o[1]||(o[1]=w(t=>q(),["prevent"])),class:"border border-sky-800 bg-sky-800 text-white rounded-sm px-2 py-1 transition-colors duration-500 ease select-none hover:bg-sky-800 focus:outline-none focus:shadow-outline"}," Apply Template ",512),[[A,re(ce.CREATE,ie.WORKSHEET)]])])])),[[i]])]),fe,ge,be,e("div",xe,[n((a(),l("form",ve,[e("div",ke,[e("label",we,[Ae,n(e("select",{name:"analyses_uids","onUpdate:modelValue":o[2]||(o[2]=t=>p.sampleTypeUid=t),class:"form-input mt-1 block w-full py-1"},[(a(!0),l(d,null,_(u(C).sampleTypes,t=>(a(),l("option",{key:t.uid,value:t.uid},r(t.name),9,Te))),128))],512),[[g,p.sampleTypeUid]])]),e("label",Se,[Ce,n(e("select",{name:"analyses_uids","onUpdate:modelValue":o[3]||(o[3]=t=>p.analysisUid=t),class:"form-input mt-1 block w-full py-1"},[(a(!0),l(d,null,_(u(m).analysesServices,t=>(a(),l("option",{key:t.uid,value:t.uid},r(t.name),9,Ue))),128))],512),[[g,p.analysisUid]])]),e("div",Ee,[n(T(u(S),{onClick:o[4]||(o[4]=w(t=>Y(),["prevent"])),color:"sky-800",class:"p-1"},{default:M(()=>[j("Apply Filters")]),_:1},512),[[A,!0]])])])])),[[v]])]),e("div",Be,[e("div",We,[u(c).fetchingAnalysisResults?(a(),l("div",Ve,[T(u(R),{message:"Fetching analytes ..."})])):(a(),l("table",De,[e("thead",null,[e("tr",null,[e("th",Me,[n(e("input",{type:"checkbox",onChange:G,"onUpdate:modelValue":o[5]||(o[5]=t=>h.value=t)},null,544),[[F,h.value]])]),je,Fe,Le,Ne,Pe,Re])]),n((a(),l("tbody",Ie,[(a(!0),l(d,null,_(y.value,t=>(a(),l("tr",{key:t?.uid},[e("td",null,[n(e("input",{type:"checkbox","onUpdate:modelValue":V=>t.checked=V,onChange:V=>Q()},null,40,qe),[[F,t.checked]])]),Oe,e("td",Ye,[e("div",He,r(t?.sample?.sampleId),1)]),e("td",Ke,[e("div",Qe,r(t?.analysis?.name),1)]),e("td",$e,[e("div",ze,r(t?.sample?.createdAt),1)]),e("td",Ge,[e("div",Je,r(t?.sample?.dateReceived),1)]),e("td",Xe,[e("div",Ze,r(t?.sample?.status),1)])]))),128))])),[[i]])]))])]),e("section",et,[e("form",tt,[e("div",st,[ot,e("label",at,[n(e("select",{class:"form-select block w-full py-1","onUpdate:modelValue":o[6]||(o[6]=t=>x.value=t)},[lt,(a(!0),l(d,null,_(O.value,t=>(a(),l("option",{key:t.uid,value:t.uid},r(t.name),9,nt))),128))],512),[[g,x.value]])])])]),n(T(u(S),{onClick:w(H,["prevent"]),color:"orange-600"},{default:M(()=>[j("Assign Analyses")]),_:1},512),[[A,!0]])])],64)}}}),ut=ne(rt,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/worksheet/_id/WorkSheetAssign.vue"]]);export{ut as default};
|