felicity-lims/felicity/templates/static/assets/ShipmentSamples-185fba8d.js
2024-11-17 19:39:30 +02:00

1 line
7.1 KiB
JavaScript

import{d as H,a$ as J,N as K,r as _,x as U,q as Q,m as W,z as D,o as l,c as d,e as a,P as i,b as e,F as R,E as V,t as p,f as n,as as X,v as Y,g as Z,B as I,C as A,w as b,i as ee,at as B,I as te,D as se,A as oe,j as ae,_ as re,k as ne}from"./index-e62f5c21.js";import{u as le}from"./shipment-165f14c9.js";const ie={class:""},de=e("hr",{class:"mt-4"},null,-1),ce={class:"flex justify-between items-center"},pe={action:"post",class:"p-1"},ue={class:"flex justify-start items-center mb-4"},me={class:"flex justify-between items-center"},he=e("span",{class:"text-gray-700 mr-2 whitespace-nowrap"},"Reference Laboratory",-1),ye=["value"],_e={class:"flex justify-between items-center ml-4"},be=e("span",{class:"text-gray-700 mr-2"},"Courier",-1),fe={class:"ml-6 mt-2"},ve=e("hr",{class:"mb-4"},null,-1),ge={class:"overflow-x-auto"},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"},ke={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"},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),Ce=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),Ue={class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"},De=e("th",{class:"px-1 py-1 border-b-2 border-gray-300 text-left leading-4 text-gray-800 tracking-wider"}," Client Request Id ",-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"}," Date Collected ",-1),Ve=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),Ie=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),Ae={class:"bg-white"},Be={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ee=["onUpdate:modelValue"],Me={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},qe=e("i",{class:"fa fa-star"},null,-1),$e=[qe],je={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ne={class:"text-sm leading-5 text-gray-800 font-semibold"},Pe={key:1},Fe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Le={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Te={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},ze=e("td",{class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},[e("div",null,"tests")],-1),Oe={class:"px-1 py-1 whitespace-no-wrap border-b border-gray-500"},Ge={type:"button",class:"bg-sky-800 text-white py-1 px-2 rounded-sm leading-none"},He={class:"my-4"},Je=H({__name:"ShipmentSamples",setup(Ke){const E=ae(()=>re(()=>import("./FelButton-7b166825.js"),["assets/FelButton-7b166825.js","assets/index-e62f5c21.js","assets/index-332ec99e.css"])),u=J(),g=K();let c=_(!1),r=U(()=>u.getShipment);const x=()=>{u.fetchShipmentByUid(g.params.shipmentUid)},m=Q({laboratoryUid:void 0,comment:void 0,courier:void 0}),h=_(!1),M=()=>{h.value=!0,u.updateShipment({uid:g.params.shipmentUid,payload:m}).then(()=>{h.value=!1,x()})};function q(){return r.value?.samples?.every(o=>o.checked===!0)}function k(){let o=[];return r.value?.shippedSamples?.forEach(s=>{s?.checked&&o.push(s.sample)}),o}function $(){q()?c.value=!0:c.value=!1,y()}function j(o){if(N(o)||r.value?.state!=="preperation"){w(o);return}o.checked=!0,y()}function N(o){return["retracted","approved"].includes(o.status)}function w(o){o.checked=!1,y()}function P(){r?.value?.samples?.forEach(o=>c.value?j(o):w(o)),y()}function F(){return k().map(o=>({sampleUid:o.uid,shipedSampleUid:void 0,analyses:[]}))}let f=_(!1),v=_(!1);function y(){f.value=!1,v.value=!1;const o=k();o.length!==0&&(o.every(s=>["referred","paired"].includes(s.status??""))&&(f.value=!0),o.every(s=>s.status==="referred")&&(v.value=!0))}const L=U(()=>!["cancelled","dispatched"].includes(r.value?.state??"")),{manageSamples:T}=le(),S=o=>{const s=F();T(r?.value?.uid,s,o)};return(o,s)=>{const z=W("router-link"),O=D("motion-slide-left"),G=D("motion-slide-right");return l(),d("div",ie,[de,a((l(),d("div",ce,[a(e("form",pe,[e("div",ue,[e("label",me,[he,a(e("select",{name:"laboratory_uid","onUpdate:modelValue":s[0]||(s[0]=t=>m.laboratoryUid=t),class:"form-input mt-1 block w-full py-1"},[(l(!0),d(R,null,V(n(u).laboratories,t=>(l(),d("option",{key:t.uid,value:t.uid},p(t.name),9,ye))),128))],512),[[X,m.laboratoryUid]])]),e("label",_e,[be,a(e("input",{type:"text",class:"form-input mt-1 block w-full py-1","onUpdate:modelValue":s[1]||(s[1]=t=>m.courier=t)},null,512),[[Y,m.courier]])]),e("div",fe,[Z(n(E),{onClick:s[2]||(s[2]=b(t=>M(),["prevent"])),color:"sky-800",class:"p-1"},{default:I(()=>[A("Apply")]),_:1})])])],512),[[i,!h.value&&!n(u).shipment?.incoming]]),a(e("p",null,"updating ...",512),[[i,h.value]]),e("div",null,[e("button",{onClick:s[3]||(s[3]=b(t=>x(),["prevent"])),class:"px-1 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"}," Refresh ")])])),[[i,L.value],[O]]),ve,e("div",ge,[e("div",xe,[e("table",ke,[e("thead",null,[e("tr",null,[a(e("th",we,[a(e("input",{type:"checkbox",class:"",onChange:s[4]||(s[4]=t=>P()),"onUpdate:modelValue":s[5]||(s[5]=t=>ee(c)?c.value=t:c=t)},null,544),[[B,n(c)]])],512),[[i,n(r)?.state==="preperation"]]),Se,Ce,a(e("th",Ue," Exernal SID ",512),[[i,n(r)?.incoming]]),De,Re,Ve,Ie])]),e("tbody",Ae,[(l(!0),d(R,null,V(n(r)?.shippedSamples,t=>a((l(),d("tr",{key:t.sampleUid},[a(e("td",Be,[a(e("input",{type:"checkbox",class:"","onUpdate:modelValue":C=>t.checked=C,onChange:s[6]||(s[6]=C=>$())},null,40,Ee),[[B,t.checked]])],512),[[i,n(r)?.state==="preperation"]]),e("td",Me,[t.sample?.priority??0>0?(l(),d("span",{key:0,class:te(["font-small",{"text-orange-600":t.sample?.priority??0>1}])},[...$e],2)):se("",!0)]),e("td",je,[e("div",Ne,[t.sample?.analysisRequest?.patient?.uid?(l(),oe(z,{key:0,to:{name:"sample-detail",params:{patientUid:t.sample?.analysisRequest?.patient?.uid,sampleUid:t.sample?.uid}}},{default:I(()=>[A(p(t.sample?.sampleId),1)]),_:2},1032,["to"])):(l(),d("div",Pe,p(t.sample?.sampleId),1))])]),a(e("td",Fe,[e("div",null,p(t.extSampleId),1)],512),[[i,n(r)?.incoming]]),e("td",Le,[e("div",null,p(t.sample?.analysisRequest?.clientRequestId),1)]),e("td",Te,[e("div",null,p(t.sample?.dateCollected),1)]),ze,e("td",Oe,[e("button",Ge,p(t.sample?.status||"unknown"),1)])])),[[G]])),128))])])])]),e("section",He,[a(e("button",{onClick:s[7]||(s[7]=b(t=>S("recover"),["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"}," Remove ",512),[[i,n(f)]]),a(e("button",{onClick:s[8]||(s[8]=b(t=>S("recall"),["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"}," Pair ",512),[[i,n(v)]])])])}}}),Xe=ne(Je,[["__file","/home/aurthurm/Documents/Development/felicity/felicity-lims/webapp/views/shipment/_id/ShipmentSamples.vue"]]);export{Xe as default};