Skip to content

Commit

Permalink
fix plans not updating when deleted.
Browse files Browse the repository at this point in the history
  • Loading branch information
hargata committed Apr 8, 2024
1 parent 0832983 commit 9c3f7d2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Views/Vehicle/_PlanRecordItem.cshtml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@model PlanRecord
<div class="taskCard @(Model.Progress == PlanProgress.Done ? "nodrag" : "") text-dark user-select-none mt-2 mb-2" draggable="@(Model.Progress == PlanProgress.Done ? "false" : "true")" ondragstart="dragStart(event, @Model.Id)" onclick="@(Model.Progress == PlanProgress.Done ? $"deletePlanRecord({Model.Id})" : $"showEditPlanRecordModal({Model.Id})")">
<div class="taskCard @(Model.Progress == PlanProgress.Done ? "nodrag" : "") text-dark user-select-none mt-2 mb-2" draggable="@(Model.Progress == PlanProgress.Done ? "false" : "true")" ondragstart="dragStart(event, @Model.Id)" onclick="@(Model.Progress == PlanProgress.Done ? $"deletePlanRecord({Model.Id}, true)" : $"showEditPlanRecordModal({Model.Id})")">
<div class="card-body">
<div class="row">
<div class="col-12 col-lg-8 text-truncate">
Expand Down
11 changes: 5 additions & 6 deletions wwwroot/js/planrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,15 @@ function showEditPlanRecordTemplateModal(planRecordTemplateId, nocache) {
}
function hideAddPlanRecordModal() {
$('#planRecordModal').modal('hide');
if (getPlanRecordModelData != undefined) {
if (getPlanRecordModelData().createdFromReminder) {
//show reminder Modal
$("#reminderRecordModal").modal("show");
}
if (getPlanRecordModelData().isTemplate) {
showPlanRecordTemplatesModal();
}
}
}
function deletePlanRecord(planRecordId) {
function deletePlanRecord(planRecordId, noModal) {
$("#workAroundInput").show();
Swal.fire({
title: "Confirm Deletion?",
Expand All @@ -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);
Expand Down Expand Up @@ -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());
}
Expand Down

0 comments on commit 9c3f7d2

Please sign in to comment.