Merge branch 'fronkdev' into 'master'
Error handling for Workorder Creation in Preorder/Index See merge request fronk/thetool!741
This commit is contained in:
@@ -1019,14 +1019,24 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
$.post("<?=self::getUrl("Preorder","Api")?>",
|
||||
{
|
||||
'do': "createWorkorder",
|
||||
id: pid,
|
||||
$("#preorder-detail-" + pid + "-rimo button.create-workorder").prop("disabled", true);
|
||||
$("#preorder-detail-" + pid + "-rimo .workorder-container").append("<img src='<?=self::getResourcePath()?>img/ajax-loader.gif' />");
|
||||
|
||||
|
||||
$.ajax({
|
||||
url: "<?=self::getUrl("Preorder","Api")?>",
|
||||
method: "POST",
|
||||
data: {
|
||||
do: "createWorkorder",
|
||||
id: pid,
|
||||
},
|
||||
function(success) {
|
||||
if(success.status == "OK") {
|
||||
wo = success.result;
|
||||
context: {
|
||||
pid: pid
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if(response.status == "OK") {
|
||||
wo = response.result;
|
||||
html = '<h4> \
|
||||
' + wo.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> \
|
||||
@@ -1052,13 +1062,28 @@
|
||||
</tr> \
|
||||
</table>';
|
||||
|
||||
$("#preorder-detail-" + wo.preorder_id + "-rimo img").remove();
|
||||
$("#preorder-detail-" + wo.preorder_id + "-rimo .workorder-container img").remove();
|
||||
$("#preorder-detail-" + wo.preorder_id + "-rimo button.create-workorder").remove();
|
||||
$("#preorder-detail-" + wo.preorder_id + "-rimo .workorder-container").append(html);
|
||||
$("button.create-workorder").remove();
|
||||
|
||||
} else {
|
||||
restoreBlankWorkorderView(this.pid);
|
||||
window.notify("error", "Workorder konnte nicht erstellt werden!");
|
||||
}
|
||||
},
|
||||
'json');
|
||||
error: function() {
|
||||
restoreBlankWorkorderView(this.pid);
|
||||
window.notify("error", "Workorder konnte nicht erstellt werden!");
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
function restoreBlankWorkorderView(pid) {
|
||||
$("#preorder-detail-" + pid + "-rimo .workorder-container img").remove();
|
||||
$("#preorder-detail-" + pid + "-rimo button.create-workorder").prop("disabled", false);
|
||||
}
|
||||
|
||||
function deleteWorkorder(pid, wid) {
|
||||
|
||||
Reference in New Issue
Block a user