Add functionality to order insufficient supplies for plan templates.
This commit is contained in:
@@ -150,6 +150,9 @@ function usePlannerRecordTemplate(planRecordTemplateId) {
|
||||
saveScrollPosition();
|
||||
getVehiclePlanRecords(vehicleId);
|
||||
} else {
|
||||
if (data.message == "Insufficient Supplies") {
|
||||
data.message += `<br /><br /><a class='text-link' style='cursor:pointer;' onclick='orderPlanSupplies(${planRecordTemplateId}, true)'>Order Required Supplies</a>`
|
||||
}
|
||||
errorToast(data.message);
|
||||
}
|
||||
});
|
||||
@@ -325,4 +328,24 @@ function updatePlanRecordProgress(newProgress) {
|
||||
draggedId = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
function orderPlanSupplies(planRecordTemplateId, closeSwal) {
|
||||
if (closeSwal) {
|
||||
Swal.close();
|
||||
}
|
||||
$.get(`/Vehicle/OrderPlanSupplies?planRecordTemplateId=${planRecordTemplateId}`, function (data) {
|
||||
if (data.success != undefined && !data.success) {
|
||||
//success is provided.
|
||||
errorToast(data.message);
|
||||
} else {
|
||||
//hide plan record template modal.
|
||||
hidePlanRecordTemplatesModal();
|
||||
$("#planRecordTemplateSupplyOrderModalContent").html(data);
|
||||
$("#planRecordTemplateSupplyOrderModal").modal('show');
|
||||
}
|
||||
})
|
||||
}
|
||||
function hideOrderSupplyModal() {
|
||||
$("#planRecordTemplateSupplyOrderModal").modal('hide');
|
||||
showPlanRecordTemplatesModal();
|
||||
}
|
||||
Reference in New Issue
Block a user