felicity-lims/felicity/templates/static/assets/samples-bf6a37c1.js

2 lines
7.4 KiB
JavaScript
Raw Normal View History

2024-11-01 14:48:45 +08:00
import{X as I,C as b,D as L,ab as N,S as a,ac as P,ad as R,ae as M,af as H,ag as D,ah as O,ai as j,aj as k,ak as V,al as F,am as U,an as W,ao as $,ap as q,O as J,aq as Q}from"./index-e48f6898.js";function z(){const c=I(),{withClientMutation:s,withClientQuery:u}=J(),{toastInfo:m}=Q(),p=b({samples:L(()=>c.getSamples)}),r=async n=>c.updateSamplesStatus(n),i=async n=>c.updateSampleStatus(n),d=async n=>c.updateSamples(n),f=async n=>c.addSampleClones(n),l=async n=>{n&&c.fetchAnalysisResultsForSample(n)},h=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(P,{samples:n},"cancelSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await a.fire("Its Happening!","Your samples have been cancelled.","success").then(e=>{}))})}catch{}},w=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(R,{samples:n},"cloneSamples").then(e=>{e.samples.length<=0||f(e.samples)}),await a.fire("Its Happening!","Processing in the background...","success").then(e=>{}))})}catch{}},S=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(M,{samples:n},"reInstateSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await a.fire("Its Happening!","Your samples have been reinstated.","success").then(e=>{}))})}catch{}},y=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(H,{samples:n},"receiveSamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]),e.samples.length===1&&l(e.samples[0].uid))}),await a.fire("Its Happening!","Your samples have been received.","success").then(e=>{}))})}catch{}},B=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(D,{sampleUids:n},"recoverSamples").then(e=>{e.length<=0||(d(e.samples),e.samples.length===1&&l(e.samples[0].uid))}),await a.fire("Its Happening!","Your samples have been recovered.","success").then(e=>{}))})}catch{}},C=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(O,{samples:n},"publishSamples").then(e=>{m(e.message)}),await a.fire("Its Happening!","Your sample were submitted for impress","success").then(e=>{}))})}catch{}},g=async n=>{try{await a.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 t=>{t.isConfirmed&&(u(j,{sampleIds:n},"impressReportsDownload").then(e=>{const o=document.createElement("a");o.href=`data:application/pdf;base64,${e}`,o.setAttribute("download","impress-report.pdf"),o.click()}),await a.fire("Its Happening!","Downloading .....","success").then(e=>{}))})}catch{}},x=asyn