fix plans not updating when deleted.
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user