mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Merge branch 'mod/ot_pdf_numero' into 'main'
Cambiada la logica de descargas multiples/simple de OTs See merge request jjimenez/safekat!880
This commit is contained in:
@ -40,8 +40,16 @@ $(function () {
|
|||||||
zip.generateAsync({ type: "blob" }).then(function (blob) {
|
zip.generateAsync({ type: "blob" }).then(function (blob) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const pad = (n) => String(n).padStart(2, '0');
|
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 fecha = `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`;
|
||||||
const filename = `ordenes_trabajo_${timestamp}.zip`;
|
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");
|
const link = document.createElement("a");
|
||||||
link.href = URL.createObjectURL(blob);
|
link.href = URL.createObjectURL(blob);
|
||||||
@ -54,10 +62,6 @@ $(function () {
|
|||||||
alertError('Seleccione una OT para descargar').fire()
|
alertError('Seleccione una OT para descargar').fire()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user