mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 08:53:00 +08:00
1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
import{W as I,C as b,D as L,at as N,S as a,au as P,av as R,aw as M,ax as H,ay as D,az as O,aA as k,aB as j,aC as F,aD as V,aE as W,aF as $,aG as U,aH as z,O as G,aj as J}from"./index-2a6c9271.js";function q(){const c=I(),{withClientMutation:s,withClientQuery:u}=G(),{toastInfo:m}=J(),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(k,{uids: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=async n=>{try{await a.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 t=>{t.isConfirmed&&(u(j,{uid:n},"impressReportDownload").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{}},A=async n=>{try{u(F,{sampleUids:n},"barcodeSamples").then(t=>{const e=document.createElement("a");e.href=`data:application/pdf;base64,${t}`,e.setAttribute("download","barcodes.pdf"),e.click()})}catch{}},Y=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(V,{samples:n},"printSamples").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 sample have been marked as printed.","success").then(e=>{}))})}catch{}},v=async n=>{try{await a.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 t=>{t.isConfirmed&&(s(W,{samples:n},"verifySamples").then(e=>{e.samples.length<=0||(r(e.samples),i(e.samples[0]))}),await a.fire("Its Happening!","Your sample have been verified.","success").then(e=>{}))})}catch{}},E=async n=>{let t=!1;try{await a.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($,{samples:n},"rejectSamples").then(o=>{t=!0,!(o.samples.length<=0)&&r(o.samples)}),await a.fire("Its Happening!","Your sample(s) have been rejected.","success").then(o=>{}))})}catch{}return t},T=async n=>{let t=[];try{await a.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(U,{samples:n},"invalidateSamples").then(o=>{o.samples.length<=0||(r(o.samples),i(o.samples[0]))}),await a.fire("Its Happening!","Your sample(s) have been invalidated.","success").then(o=>{}))})}catch{}return t},_=async n=>{let t=[];try{await a.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(z,{payload:n},"storeSamples").then(o=>{o.samples.length<=0||r(o.samples)}),await a.fire("Its Happening!","Your sample(s) have been added to storage.","success").then(o=>{}))})}catch{}return t};return{...N(p),cancelSamples:h,reInstateSamples:S,receiveSamples:y,recoverSamples:B,verifySamples:v,printSamples:Y,publishSamples:C,downloadSamplesImpress:g,downloadImpress:x,barcodeSamples:A,invalidateSamples:T,rejectSamples:E,storeSamples:_,cloneSamples:w}}export{q as u};
|