felicity-lims/felicity/templates/static/assets/samples-ba5194ed.js
2023-11-10 18:48:39 +02:00

1 line
7.3 KiB
JavaScript

import{y as E,S as o,M as I,N,O as b,P as L,Q as P,T as M,U as R,V as H,W as D,X as O,Y as j,Z as k,a0 as V,w as F,G as U}from"./shipment-53265c2d.js";import{c as W,d as Q,T as $}from"./_plugin-vue_export-helper-dacf3d65.js";function X(){const c=E(),{withClientMutation:s,withClientQuery:u}=F(),{toastInfo:m}=U(),p=W({samples:Q(()=>c.getSamples)}),r=async t=>c.updateSamplesStatus(t),i=async t=>c.updateSampleStatus(t),d=async t=>c.updateSamples(t),f=async t=>c.addSampleClones(t),l=async t=>{t&&c.fetchAnalysisResultsForSample(t)},h=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to cancel these samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, cancel now!",cancelButtonText:"No, do not cancel!"}).then(async n=>{n.isConfirmed&&(s(I,{samples:t},"cancelSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await o.fire("Its Happening!","Your samples have been cancelled.","success").then(e=>{}))})}catch{}},w=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to clone these samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, clone now!",cancelButtonText:"No, do not clone!"}).then(async n=>{n.isConfirmed&&(s(N,{samples:t},"cloneSamples").then(e=>{e.samples.length<=0||f(e.samples)}),await o.fire("Its Happening!","Processing in the background...","success").then(e=>{}))})}catch{}},S=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to reinstate samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, reinstate now!",cancelButtonText:"No, do not reinstate!"}).then(async n=>{n.isConfirmed&&(s(b,{samples:t},"reInstateSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await o.fire("Its Happening!","Your samples have been reinstated.","success").then(e=>{}))})}catch{}},y=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to receive samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, receice now!",cancelButtonText:"No, do not receive!"}).then(async n=>{n.isConfirmed&&(s(L,{samples:t},"receiveSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await o.fire("Its Happening!","Your samples have been received.","success").then(e=>{}))})}catch{}},B=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to recover these samples from storage",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, recover now!",cancelButtonText:"No, do not recover!"}).then(async n=>{n.isConfirmed&&(s(P,{sampleUids:t},"recoverSamples").then(e=>{e.length<=0||(d(e.samples),e.samples.length===1&&l(e.samples[0].uid))}),await o.fire("Its Happening!","Your samples have been recovered.","success").then(e=>{}))})}catch{}},C=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to publish samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, publish now!",cancelButtonText:"No, do not publish!"}).then(async n=>{n.isConfirmed&&(s(M,{samples:t},"publishSamples").then(e=>{m(e.message)}),await o.fire("Its Happening!","Your sample were submitted for impress","success").then(e=>{}))})}catch{}},g=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to download pdfs",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, download now!",cancelButtonText:"No, do not download!"}).then(async n=>{n.isConfirmed&&(u(R,{uids:t},"impressReportsDownload").then(e=>{const a=document.createElement("a");a.href=`data:application/pdf;base64,${e}`,a.setAttribute("download","impress-report.pdf"),a.click()}),await o.fire("Its Happening!","Downloading .....","success").then(e=>{}))})}catch{}},x=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to download this report",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, download now!",cancelButtonText:"No, do not download!"}).then(async n=>{n.isConfirmed&&(u(H,{uid:t},"impressReportDownload").then(e=>{const a=document.createElement("a");a.href=`data:application/pdf;base64,${e}`,a.setAttribute("download","impress-report.pdf"),a.click()}),await o.fire("Its Happening!","Downloading .....","success").then(e=>{}))})}catch{}},Y=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to flag as printed",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, flag now!",cancelButtonText:"No, do not flag!"}).then(async n=>{n.isConfirmed&&(s(D,{samples:t},"printSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await o.fire("Its Happening!","Your sample have been marked as printed.","success").then(e=>{}))})}catch{}},A=async t=>{try{await o.fire({title:"Are you sure?",text:"You want to verify sample",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, verify now!",cancelButtonText:"No, do not verify!"}).then(async n=>{n.isConfirmed&&(s(O,{samples:t},"verifySamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]))}),await o.fire("Its Happening!","Your sample have been verified.","success").then(e=>{}))})}catch{}},v=async t=>{let n=!1;try{await o.fire({title:"Are you sure?",text:"You want to invalidate sample",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, Reject now!",cancelButtonText:"No, do not reject!"}).then(async e=>{e.isConfirmed&&(s(j,{samples:t},"rejectSamples").then(a=>{n=!0,!(a.samples.length<=0)&&r(a.samples)}),await o.fire("Its Happening!","Your sample(s) have been rejected.","success").then(a=>{}))})}catch{}return n},T=async t=>{let n=[];try{await o.fire({title:"Are you sure?",text:"You want to invalidate sample",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, invalidate now!",cancelButtonText:"No, do not invalidate!"}).then(async e=>{e.isConfirmed&&(s(k,{samples:t},"invalidateSamples").then(a=>{a.samples.length<=0||(r(a.samples),i(a.samples[0]))}),await o.fire("Its Happening!","Your sample(s) have been invalidated.","success").then(a=>{}))})}catch{}return n},_=async t=>{let n=[];try{await o.fire({title:"Are you sure?",text:"You want to store these samples",icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:"Yes, store now!",cancelButtonText:"No, do not store!"}).then(async e=>{e.isConfirmed&&(s(V,{payload:t},"storeSamples").then(a=>{a.samples.length<=0||r(a.samples)}),await o.fire("Its Happening!","Your sample(s) have been added to storage.","success").then(a=>{}))})}catch{}return n};return{...$(p),cancelSamples:h,reInstateSamples:S,receiveSamples:y,recoverSamples:B,verifySamples:A,printSamples:Y,publishSamples:C,downloadSamplesImpress:g,downloadImpress:x,invalidateSamples:T,rejectSamples:v,storeSamples:_,cloneSamples:w}}export{X as u};