Merge branch 'fronkdev2' into 'master'

Preorder AHA Report Download

See merge request fronk/thetool!703
This commit is contained in:
Frank Schubert
2024-11-08 15:57:25 +00:00
35 changed files with 172586 additions and 31 deletions
+37 -2
View File
@@ -830,14 +830,16 @@
if(trenches) {
trenches.forEach((trench) => {
var trench_line = L.polyline(trench, {
color: "limegreen"
color: "maroon",
weight: 7
}).addTo(map);
});
}
if(home_trench) {
var home_line = L.polyline(home_trench, {
color: "aqua"
color: "blue",
weight: 7
}).addTo(map);
}
@@ -1041,5 +1043,38 @@
return false;
}
async function downloadWorkorderAha(workorder_id) {
if(!workorder_id) return false;
var filename;
await fetch('<?=self::getUrl("RimoWorkorder", "downloadAha")?>?id=' + workorder_id)
.then(resp => {
const header = resp.headers.get("Content-disposition");
let matches = header.match(/filename=['"]?([^'"]+)/i);
filename = matches[1];
if(!filename) {
window.notify("error", "Fehler beim Download des AH-Blatts");
return false;
}
return resp.blob();
})
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
window.notify("success", "Download gestartet...");
})
.catch(() => {
window.notify("error", "Fehler beim Download des AH-Blatts");
});
}
</script>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/footer.php"); ?>
@@ -397,9 +397,13 @@
<div class="col-6">
<h3>Workorder</h3>
<?php if(is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)): ?>
<?php if($preorder->adb_wohneinheit_id && is_array($preorder->adb_wohneinheit->rimo_workorders) && count($preorder->adb_wohneinheit->rimo_workorders)): ?>
<?php foreach($preorder->adb_wohneinheit->rimo_workorders as $wo): ?>
<h4><?=$wo->rimo_name?></h4>
<h4>
<?=$wo->rimo_name?>
<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?>">
<tr>