Updated preorder api

This commit is contained in:
Frank Schubert
2023-11-09 14:55:10 +01:00
parent 36c6036ed9
commit 19cd396175
9 changed files with 137 additions and 21 deletions

View File

@@ -313,21 +313,25 @@
<div class="col-6">
<h3>Workorder</h3>
<table class="table table-sm table-striped">
<tr>
<th>Name</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_name?></td>
</tr><tr>
<th>External ID</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_id?></td>
</tr><tr>
<th>Status</th>
<td><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_status?></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=($preorder->adb_wohneinheit->rimo_workorder->id) ? date("d.m.Y H:i:s", $preorder->adb_wohneinheit->rimo_workorder->create) : ""?></td>
</tr>
</table>
<?php if(is_object($preorder->adb_wohneinheit->rimo_workorder) && $preorder->adb_wohneinheit->rimo_workorder->id): ?>
<small id="preorder-detail-<?=$preorder->id?>-workorder-del"><a href="#" onclick="if(confirm('Achtung: Löscht die Workorder in thetool, aber NICHT in RIMO!')) return deleteWorkorder(<?=$preorder->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">
<tr>
<th>Name</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_name?></td>
</tr><tr>
<th>External ID</th>
<td class="text-monospace"><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_id?></td>
</tr><tr>
<th>Status</th>
<td><?=$preorder->adb_wohneinheit->rimo_workorder->rimo_status?></td>
</tr><tr>
<th>Erstellt</th>
<td class="text-monospace"><?=(is_object($preorder->adb_wohneinheit->rimo_workorder)) ? date("d.m.Y H:i:s", $preorder->adb_wohneinheit->rimo_workorder->create) : ""?></td>
</tr>
</table>
<?php endif; ?>
</div>
@@ -402,4 +406,29 @@
},
'json');
}
function deleteWorkorder(pid) {
console.log("in delete workorder");
if(!Number.isInteger(pid) || pid < 1) {
return false;
}
$.post("<?=self::getUrl("Preorder","Api")?>",
{
'do': "deleteWorkorder",
id: pid,
},
function(success) {
if(success.status == "OK") {
$("#preorder-detail-" + success.result.id + "-workorder td").each(function() {
$(this).html("<em class='text-monospace'>--gelöscht--</em>");
});
$("#preorder-detail-" + success.result.id + "-workorder-del").remove();
}
},
'json');
return false;
}
</script>