Added AHA Report to download in Preorder Index

This commit is contained in:
Frank Schubert
2024-11-08 16:40:47 +01:00
parent 482e1a4989
commit 95e36d1626
8 changed files with 64 additions and 35 deletions
+6 -4
View File
@@ -939,12 +939,12 @@
return false;
}
async function downloadWorkorderAh(workorder_id) {
async function downloadWorkorderAha(workorder_id) {
if(!workorder_id) return false;
var filename;
await fetch('<?=self::getUrl("RimoWorkorder", "downloadAh")?>?id=' + workorder_id)
await fetch('<?=self::getUrl("RimoWorkorder", "downloadAha")?>?id=' + workorder_id)
.then(resp => {
const header = resp.headers.get("Content-disposition");
let matches = header.match(/filename=['"]?([^'"]+)/i);
@@ -953,7 +953,7 @@
window.notify("error", "Fehler beim Download des AH-Blatts");
return false;
}
resp.blob()
return resp.blob();
})
.then(blob => {
const url = window.URL.createObjectURL(blob);
@@ -968,7 +968,9 @@
window.notify("success", "Download gestartet...");
//alert('your file has downloaded!'); // or you know, something with better UX...
})
.catch(() => window.notify("Fehler beim Download des AH-Blatts"));
.catch(() => {
window.notify("error", "Fehler beim Download des AH-Blatts");
});
}
</script>