Cache the record the user was viewing if they didn't save, delete, or move it.

This commit is contained in:
DESKTOP-GENO133\IvanPlex
2024-04-02 21:51:02 -06:00
parent bfc0b58728
commit d05afe41d6
20 changed files with 128 additions and 19 deletions

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Repair Record") : translator.Translate(userLanguage, "Edit Repair Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Repair Record") : translator.Translate(userLanguage, "Edit Repair Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditCollisionRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddCollisionRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -37,7 +37,7 @@
}
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Gas Record") : translator.Translate(userLanguage,"Edit Gas Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Gas Record") : translator.Translate(userLanguage, "Edit Gas Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditGasRecordModal({Model.GasRecord.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddGasRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Note") : translator.Translate(userLanguage, "Edit Note"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Note") : translator.Translate(userLanguage, "Edit Note"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditNoteModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddNoteModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Odometer Record") : translator.Translate(userLanguage,"Edit Odometer Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Odometer Record") : translator.Translate(userLanguage, "Edit Odometer Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditOdometerRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Plan Record") : translator.Translate(userLanguage, "Edit Plan Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Plan Record") : translator.Translate(userLanguage, "Edit Plan Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditPlanRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddPlanRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Service Record") : translator.Translate(userLanguage,"Edit Service Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Service Record") : translator.Translate(userLanguage, "Edit Service Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditServiceRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddServiceRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Supply Record") : translator.Translate(userLanguage,"Edit Supply Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Supply Record") : translator.Translate(userLanguage, "Edit Supply Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditSupplyRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddSupplyRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage,"Add New Tax Record") : translator.Translate(userLanguage,"Edit Tax Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Tax Record") : translator.Translate(userLanguage, "Edit Tax Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditTaxRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddTaxRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

View File

@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
<div class="modal-header">
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Upgrade Record") : translator.Translate(userLanguage, "Edit Upgrade Record"))</h5>
<h5 class="modal-title">@(isNew ? translator.Translate(userLanguage, "Add New Upgrade Record") : translator.Translate(userLanguage, "Edit Upgrade Record"))<small style="display:none; @(isNew ? "" : "cursor:pointer;")" class="cached-banner ms-2 text-body-secondary" onclick='@(isNew ? "" : $"showEditUpgradeRecordModal({Model.Id}, true)" )'>@translator.Translate(userLanguage, "Cached")</small></h5>
<button type="button" class="btn-close" onclick="hideAddUpgradeRecordModal()" aria-label="Close"></button>
</div>
<div class="modal-body">

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditCollisionRecordModal(collisionRecordId) {
function showEditCollisionRecordModal(collisionRecordId, nocache) {
if (!nocache) {
var existingContent = $("#collisionRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getCollisionRecordModelData().id;
if (existingId == collisionRecordId) {
$('#collisionRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetCollisionRecordForEditById?collisionRecordId=${collisionRecordId}`, function (data) {
if (data) {
$("#collisionRecordModalContent").html(data);

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditGasRecordModal(gasRecordId) {
function showEditGasRecordModal(gasRecordId, nocache) {
if (!nocache) {
var existingContent = $("#gasRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getGasRecordModelData().id;
if (existingId == gasRecordId) {
$('#gasRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetGasRecordForEditById?gasRecordId=${gasRecordId}`, function (data) {
if (data) {
$("#gasRecordModalContent").html(data);

View File

@@ -7,7 +7,19 @@
}
});
}
function showEditNoteModal(noteId) {
function showEditNoteModal(noteId, nocache) {
if (!nocache) {
var existingContent = $("#noteModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getNoteModelData().id;
if (existingId == noteId) {
$('#noteModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetNoteForEditById?noteId=${noteId}`, function (data) {
if (data) {
$("#noteModalContent").html(data);

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditOdometerRecordModal(odometerRecordId) {
function showEditOdometerRecordModal(odometerRecordId, nocache) {
if (!nocache) {
var existingContent = $("#odometerRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getOdometerRecordModelData().id;
if (existingId == odometerRecordId) {
$('#odometerRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetOdometerRecordForEditById?odometerRecordId=${odometerRecordId}`, function (data) {
if (data) {
$("#odometerRecordModalContent").html(data);

View File

@@ -8,7 +8,19 @@
}
});
}
function showEditPlanRecordModal(planRecordId) {
function showEditPlanRecordModal(planRecordId, nocache) {
if (!nocache) {
var existingContent = $("#planRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getPlanRecordModelData().id;
if (existingId == planRecordId) {
$('#planRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetPlanRecordForEditById?planRecordId=${planRecordId}`, function (data) {
if (data) {
$("#planRecordModalContent").html(data);

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditServiceRecordModal(serviceRecordId) {
function showEditServiceRecordModal(serviceRecordId, nocache) {
if (!nocache) {
var existingContent = $("#serviceRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getServiceRecordModelData().id;
if (existingId == serviceRecordId) {
$('#serviceRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetServiceRecordForEditById?serviceRecordId=${serviceRecordId}`, function (data) {
if (data) {
$("#serviceRecordModalContent").html(data);

View File

@@ -753,6 +753,7 @@ function showModalForCurrentTab() {
var modalContent = $(`#${modalName} .modal-content`);
if (modalContent.html().trim() != '' && $(".modal.fade.show").length == 0) {
$(`#${modalName}`).modal('show');
$('.cached-banner').show();
}
}
}

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditSupplyRecordModal(supplyRecordId) {
function showEditSupplyRecordModal(supplyRecordId, nocache) {
if (!nocache) {
var existingContent = $("#supplyRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getSupplyRecordModelData().id;
if (existingId == supplyRecordId) {
$('#supplyRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetSupplyRecordForEditById?supplyRecordId=${supplyRecordId}`, function (data) {
if (data) {
$("#supplyRecordModalContent").html(data);

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditTaxRecordModal(taxRecordId) {
function showEditTaxRecordModal(taxRecordId, nocache) {
if (!nocache) {
var existingContent = $("#taxRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getTaxRecordModelData().id;
if (existingId == taxRecordId) {
$('#taxRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetTaxRecordForEditById?taxRecordId=${taxRecordId}`, function (data) {
if (data) {
$("#taxRecordModalContent").html(data);

View File

@@ -9,7 +9,19 @@
}
});
}
function showEditUpgradeRecordModal(upgradeRecordId) {
function showEditUpgradeRecordModal(upgradeRecordId, nocache) {
if (!nocache) {
var existingContent = $("#upgradeRecordModalContent").html();
if (existingContent.trim() != '') {
//check if id is same.
var existingId = getUpgradeRecordModelData().id;
if (existingId == upgradeRecordId) {
$('#upgradeRecordModal').modal('show');
$('.cached-banner').show();
return;
}
}
}
$.get(`/Vehicle/GetUpgradeRecordForEditById?upgradeRecordId=${upgradeRecordId}`, function (data) {
if (data) {
$("#upgradeRecordModalContent").html(data);