felicity-lims/felicity/templates/static/assets/shipment-165f14c9.js
2024-11-17 19:39:30 +02:00

1 line
1.5 KiB
JavaScript

import{a$ as l,S as a,b1 as u,b2 as d,b3 as p,M as m}from"./index-e62f5c21.js";function C(){const{withClientMutation:i,withClientQuery:s}=m(),r=l();return{manageSamples:(o,e,t="assign")=>{try{a.fire({title:"Are you sure?",text:`You want to ${t} selected?`,icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:`Yes, ${t} now!`,cancelButtonText:"No, cancel apply!"}).then(n=>{n.isConfirmed&&i(u,{uid:o,payload:{samples:e,action:t}},"shipmentManageSamples").then(c=>r.updateShipmentMetadata(c))})}catch{}},actionShipment:(o,e="finalise")=>{try{a.fire({title:"Are you sure?",text:`You want to ${e} the shipment?`,icon:"warning",showCancelButton:!0,confirmButtonColor:"#3085d6",cancelButtonColor:"#d33",confirmButtonText:`Yes, ${e} now!`,cancelButtonText:"No, cancel apply!"}).then(t=>{t.isConfirmed&&i(d,{uid:o,action:e},"actionShipment").then(n=>r.updateShipmentMetadata(n))})}catch{}},downloadManifest:async o=>{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 e=>{e.isConfirmed&&(s(p,{uid:o},"manifestReportDownload").then(t=>{const n=document.createElement("a");n.href=`data:application/pdf;base64,${t}`,n.setAttribute("download","manifest-report.pdf"),n.click()}),await a.fire("Its Happening!","Downloading .....","success").then(t=>{}))})}catch{}}}}export{C as u};