From 9c3f7d20f55e196a9429926345279173f0f6e257 Mon Sep 17 00:00:00 2001 From: "DESKTOP-GENO133\\IvanPlex" Date: Sun, 7 Apr 2024 21:01:06 -0600 Subject: [PATCH] fix plans not updating when deleted. --- Views/Vehicle/_PlanRecordItem.cshtml | 2 +- wwwroot/js/planrecord.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Views/Vehicle/_PlanRecordItem.cshtml b/Views/Vehicle/_PlanRecordItem.cshtml index 21cff13..a2880f7 100644 --- a/Views/Vehicle/_PlanRecordItem.cshtml +++ b/Views/Vehicle/_PlanRecordItem.cshtml @@ -1,5 +1,5 @@ @model PlanRecord -
+
diff --git a/wwwroot/js/planrecord.js b/wwwroot/js/planrecord.js index 1f85916..99c9127 100644 --- a/wwwroot/js/planrecord.js +++ b/wwwroot/js/planrecord.js @@ -69,7 +69,6 @@ function showEditPlanRecordTemplateModal(planRecordTemplateId, nocache) { } function hideAddPlanRecordModal() { $('#planRecordModal').modal('hide'); - if (getPlanRecordModelData != undefined) { if (getPlanRecordModelData().createdFromReminder) { //show reminder Modal $("#reminderRecordModal").modal("show"); @@ -77,9 +76,8 @@ function hideAddPlanRecordModal() { if (getPlanRecordModelData().isTemplate) { showPlanRecordTemplatesModal(); } - } } -function deletePlanRecord(planRecordId) { +function deletePlanRecord(planRecordId, noModal) { $("#workAroundInput").show(); Swal.fire({ title: "Confirm Deletion?", @@ -91,7 +89,9 @@ function deletePlanRecord(planRecordId) { if (result.isConfirmed) { $.post(`/Vehicle/DeletePlanRecordById?planRecordId=${planRecordId}`, function (data) { if (data) { - hideAddPlanRecordModal(); + if (!noModal) { + hideAddPlanRecordModal(); + } successToast("Plan Record Deleted"); var vehicleId = GetVehicleId().vehicleId; getVehiclePlanRecords(vehicleId); @@ -168,9 +168,8 @@ function deletePlannerRecordTemplate(planRecordTemplateId) { $.post(`/Vehicle/DeletePlanRecordTemplateById?planRecordTemplateId=${planRecordTemplateId}`, function (data) { $("#workAroundInput").hide(); if (data) { - successToast("Template Deleted"); + successToast("Plan Template Deleted"); hideAddPlanRecordModal(); - hidePlanRecordTemplatesModal(); } else { errorToast(genericErrorMessage()); }