mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Cambiada la logica de descargas multiples/simple de OTs
This commit is contained in:
@ -20,7 +20,7 @@ $(function () {
|
||||
try {
|
||||
|
||||
// Create hidden iframe
|
||||
Notiflix.Block.circle('.section-block',{opacity : 1});
|
||||
Notiflix.Block.circle('.section-block', { opacity: 1 });
|
||||
const response = await getPdf(element);
|
||||
var opt = {
|
||||
margin: 2,
|
||||
@ -40,8 +40,16 @@ $(function () {
|
||||
zip.generateAsync({ type: "blob" }).then(function (blob) {
|
||||
const now = new Date();
|
||||
const pad = (n) => String(n).padStart(2, '0');
|
||||
const timestamp = `${now.getFullYear()}_${pad(now.getMonth() + 1)}_${pad(now.getDate())}_${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}`;
|
||||
const filename = `ordenes_trabajo_${timestamp}.zip`;
|
||||
const fecha = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`;
|
||||
const hora = `${pad(now.getHours())}${pad(now.getMinutes())}`;
|
||||
|
||||
let filename;
|
||||
if (ordenesTrabajo.length === 1) {
|
||||
const otId = ordenesTrabajo[0];
|
||||
filename = `OT_${otId}_${fecha}_${hora}.zip`;
|
||||
} else {
|
||||
filename = `OrdenesTrabajo_${fecha}_${hora}.zip`;
|
||||
}
|
||||
|
||||
const link = document.createElement("a");
|
||||
link.href = URL.createObjectURL(blob);
|
||||
@ -50,14 +58,10 @@ $(function () {
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
});
|
||||
}else{
|
||||
} else {
|
||||
alertError('Seleccione una OT para descargar').fire()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user