felicity-lims/felicity/templates/static/assets/RejectSamples-53428f3c.js

1 line
3.9 KiB
JavaScript

import{f as S,c as j,M as k,d as C,v as V,h as l,k as c,F as u,ak as v,x as s,D as n,ag as _,u as D,B as N,y as q,_ as E}from"./_plugin-vue_export-helper-3f67fb71.js";import{w as I}from"./billing-356772f3.js";import{u as M}from"./samples-6869bb19.js";import{a as B,u as T}from"./index-3189f120.js";import{d as U,v as A,b as P,a as F}from"./runtime-dom.esm-bundler-6e07ef74.js";const O=s("h4",null,"Sample Rejection",-1),$=s("hr",{class:"my-4"},null,-1),J={class:"text-gray-800 font-bold"},L={class:"grid grid-cols-12 gap-1 mt-2"},z={class:"col-span-6 grid grid-cols-2 gap-1"},G={class:"col-span-1"},H={class:"flex w-full"},K=s("span",{class:"text-gray-700 font-semibold w-4/12"},"Sample Type",-1),Q={class:"flex w-full"},W=s("span",{class:"text-gray-700 font-semibold w-4/12"},"Client Sample ID",-1),X={class:"flex w-full"},Y=s("span",{class:"text-gray-700 font-semibold w-4/12"},"Anayses",-1),Z={class:"col-span-1"},ss={class:"flex w-full"},es=s("span",{class:"text-gray-700 font-semibold w-4/12"},"Patient",-1),ts={class:"flex w-full"},os=s("span",{class:"text-gray-700 font-semibold w-4/12"},"Client Patient ID",-1),ns={class:"col-span-5"},as={class:"grid grid-cols-2 gap-2"},ls={class:"col-span-1"},cs={class:"flex flex-col whitespace-nowrap w-full"},is=s("span",{class:"text-gray-800 font-bold"},"Rejection Reasons",-1),rs=s("hr",null,null,-1),ds=["onUpdate:modelValue"],us=s("option",{value:""},null,-1),_s=["value"],ps={class:"col-span-1"},hs={class:"flex flex-col whitespace-nowrap w-full"},fs=s("span",{class:"text-gray-700 font-bold"},"Other",-1),ms=s("hr",null,null,-1),vs=["onUpdate:modelValue"],ys={class:"col-span-1 pt-4 pl-4"},ws=["onClick"],gs=S({__name:"RejectSamples",setup(xs){B();const d=T(),p=I(),{rejectSamples:y}=M(),h=d.options.history.state,i=j({rejections:[]}),w=JSON.parse(window.history.state.samples);let f=[];for(let t of w)t.reasons=[],t.other=void 0,f.push(t);i.rejections=f,k(()=>p.fetchRejectionReasons());const g=(t,o)=>{let r=[];return t?.forEach(e=>r.push(e.name)),o?.forEach(e=>r.push(e.name)),r.join(", ")},x=t=>{i.rejections?.forEach(o=>{o.reasons=t.reasons,o.other=t.other})},b=C(()=>p.getRejectionReasons),R=async()=>{const t=[];i.rejections?.forEach(o=>{t.push({uid:o?.uid,reasons:o?.reasons,other:o?.other})}),await y(t).then(o=>{t.length==1&&h.back?.toString().includes("patient")?d.push({path:h.back.toString()}):d.push({name:"samples-listing"})})};return(t,o)=>{const r=V("font-awesome-icon");return l(),c(u,null,[O,(l(!0),c(u,null,v(i.rejections,(e,m)=>(l(),c("div",{key:m},[$,s("h2",J,n(e?.sampleId)+" → "+n(e?.status),1),s("div",L,[s("div",z,[s("div",G,[s("div",H,[K,s("span",null,n(e?.sampleType?.name),1)]),s("div",Q,[W,s("span",null,n(e?.analysisRequest?.clientRequestId),1)]),s("div",X,[Y,s("span",null,n(g(e?.profiles,e?.analyses)),1)])]),s("div",Z,[s("div",ss,[es,s("span",null,n(e?.analysisRequest?.patient?.firstName)+" "+n(e?.analysisRequest?.patient?.lastName),1)]),s("div",ts,[os,s("span",null,n(e?.analysisRequest?.patient?.clientPatientId),1)])])]),s("div",ns,[s("div",as,[s("div",ls,[s("label",cs,[is,rs,_(s("select",{name:"reasons",rows:"3",class:"form-input mt-1",multiple:"","onUpdate:modelValue":a=>e.reasons=a},[us,(l(!0),c(u,null,v(D(b),a=>(l(),c("option",{key:a.uid,value:a.uid},n(a.reason),9,_s))),128))],8,ds),[[U,e.reasons]])])]),s("div",ps,[s("label",hs,[fs,ms,_(s("input",{type:"text",class:"form-input mt-1 block w-full","onUpdate:modelValue":a=>e.other=a},null,8,vs),[[A,e.other]])])])])]),s("div",ys,[_(s("button",{class:"ml-4 mt-4",onClick:a=>x(e)},[N(r,{icon:"level-down-alt"})],8,ws),[[P,m===0]])])])]))),128)),i.rejections?.length>0?(l(),c("button",{key:0,onClick:o[0]||(o[0]=F(e=>R(),["prevent"])),class:"px-2 py-1 mr-2 border-orange-600 border text-orange-600 rounded-sm transition duration-300 hover:bg-orange-600 hover:text-white focus:outline-none"}," Reject Samples ")):q("v-if",!0)],64)}}}),Cs=E(gs,[["__file","/home/aurthurm/Development/felicity-lims/webapp/views/sample/RejectSamples.vue"]]);export{Cs as default};