Added AHA Report to download in Preorder Index
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -401,7 +401,8 @@
|
||||
<?php foreach($preorder->adb_wohneinheit->rimo_workorders as $wo): ?>
|
||||
<h4>
|
||||
<?=$wo->rimo_name?>
|
||||
<a href="<?=self::getUrl("RimoWorkorder", "downloadAh", ["id" => $wo->id])?>" onclick="event.preventDefault(); downloadWorkorderAh(<?=$wo->id?>);"><i class="fas fa-fw fa-file-download ml-2"></i> AH Blatt</a>
|
||||
<a href="<?=self::getUrl("RimoWorkorder", "downloadAh", ["id" => $wo->id])?>" onclick="event.preventDefault(); downloadWorkorderAha(<?=$wo->id?>);"><i class="fas fa-fw fa-file-download ml-2"></i> AHA Blatt</a>
|
||||
<small class="text-danger">(beta)</small>
|
||||
</h4>
|
||||
<small id="preorder-detail-<?=$preorder->id?>-workorder-<?=$wo->id?>-del"><a href="#" onclick="if(confirm('Achtung: Löscht die Workorder in thetool, aber NICHT in RIMO!')) return deleteWorkorder(<?=$preorder->id?>, <?=$wo->id?>)" class="text-danger"><i class="far fa-times-circle"></i> Workorder löschen</a></small>
|
||||
<table class="table table-sm table-striped" id="preorder-detail-<?=$preorder->id?>-workorder-<?=$wo->id?>">
|
||||
|
||||
Reference in New Issue
Block a user