Skip to content

Commit

Permalink
Merge pull request #475 from hargata/Hargata/update.readme
Browse files Browse the repository at this point in the history
check if function exists.
  • Loading branch information
hargata authored Apr 8, 2024
2 parents 224970a + 9c3f7d2 commit 23ae36e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 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
23 changes: 12 additions & 11 deletions wwwroot/js/planrecord.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ function showEditPlanRecordTemplateModal(planRecordTemplateId, nocache) {
}
function hideAddPlanRecordModal() {
$('#planRecordModal').modal('hide');
if (getPlanRecordModelData().createdFromReminder) {
//show reminder Modal
$("#reminderRecordModal").modal("show");
}
if (getPlanRecordModelData().isTemplate) {
showPlanRecordTemplatesModal();
}
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 @@ -89,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 @@ -166,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 23ae36e

Please sign in to comment.