Merge pull request #463 from hargata/Hargata/unsaved.changes

updated cached view to only show when there are unsaved changes present.
This commit is contained in:
Hargata Softworks 2024-04-05 07:11:50 -06:00 committed by GitHub
commit ca749aaf1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 36 additions and 63 deletions

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddCollisionRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddCollisionRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -37,7 +37,7 @@
} }
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddGasRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddGasRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddNoteModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddNoteModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddOdometerRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddPlanRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddPlanRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddServiceRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddServiceRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddSupplyRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddSupplyRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddTaxRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddTaxRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage; var userLanguage = userConfig.UserLanguage;
} }
<div class="modal-header"> <div class="modal-header">
<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> <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, "Unsaved Changes")</small></h5>
<button type="button" class="btn-close" onclick="hideAddUpgradeRecordModal()" aria-label="Close"></button> <button type="button" class="btn-close" onclick="hideAddUpgradeRecordModal()" aria-label="Close"></button>
</div> </div>
<div class="modal-body"> <div class="modal-body">

View File

@ -15,7 +15,7 @@ function showEditCollisionRecordModal(collisionRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getCollisionRecordModelData().id; var existingId = getCollisionRecordModelData().id;
if (existingId == collisionRecordId) { if (existingId == collisionRecordId && $('[data-changed=true]').length > 0) {
$('#collisionRecordModal').modal('show'); $('#collisionRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditCollisionRecordModal(collisionRecordId, nocache) {
initDatePicker($('#collisionRecordDate')); initDatePicker($('#collisionRecordDate'));
initTagSelector($("#collisionRecordTag")); initTagSelector($("#collisionRecordTag"));
$('#collisionRecordModal').modal('show'); $('#collisionRecordModal').modal('show');
bindModalInputChanges('collisionRecordModal');
$('#collisionRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#collisionRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("collisionRecordNotes"); toggleMarkDownOverlay("collisionRecordNotes");

View File

@ -15,7 +15,7 @@ function showEditGasRecordModal(gasRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getGasRecordModelData().id; var existingId = getGasRecordModelData().id;
if (existingId == gasRecordId) { if (existingId == gasRecordId && $('[data-changed=true]').length > 0) {
$('#gasRecordModal').modal('show'); $('#gasRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditGasRecordModal(gasRecordId, nocache) {
initDatePicker($('#gasRecordDate')); initDatePicker($('#gasRecordDate'));
initTagSelector($("#gasRecordTag")); initTagSelector($("#gasRecordTag"));
$('#gasRecordModal').modal('show'); $('#gasRecordModal').modal('show');
bindModalInputChanges('gasRecordModal');
$('#gasRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#gasRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("gasRecordNotes"); toggleMarkDownOverlay("gasRecordNotes");

View File

@ -13,7 +13,7 @@ function showEditNoteModal(noteId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getNoteModelData().id; var existingId = getNoteModelData().id;
if (existingId == noteId) { if (existingId == noteId && $('[data-changed=true]').length > 0) {
$('#noteModal').modal('show'); $('#noteModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -25,6 +25,7 @@ function showEditNoteModal(noteId, nocache) {
$("#noteModalContent").html(data); $("#noteModalContent").html(data);
initTagSelector($("#noteRecordTag")); initTagSelector($("#noteRecordTag"));
$('#noteModal').modal('show'); $('#noteModal').modal('show');
bindModalInputChanges('noteModal');
$('#noteModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#noteModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("noteTextArea"); toggleMarkDownOverlay("noteTextArea");

View File

@ -15,7 +15,7 @@ function showEditOdometerRecordModal(odometerRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getOdometerRecordModelData().id; var existingId = getOdometerRecordModelData().id;
if (existingId == odometerRecordId) { if (existingId == odometerRecordId && $('[data-changed=true]').length > 0) {
$('#odometerRecordModal').modal('show'); $('#odometerRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditOdometerRecordModal(odometerRecordId, nocache) {
initDatePicker($('#odometerRecordDate')); initDatePicker($('#odometerRecordDate'));
initTagSelector($("#odometerRecordTag")); initTagSelector($("#odometerRecordTag"));
$('#odometerRecordModal').modal('show'); $('#odometerRecordModal').modal('show');
bindModalInputChanges('odometerRecordModal');
$('#odometerRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#odometerRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("odometerRecordNotes"); toggleMarkDownOverlay("odometerRecordNotes");

View File

@ -14,7 +14,7 @@ function showEditPlanRecordModal(planRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getPlanRecordModelData().id; var existingId = getPlanRecordModelData().id;
if (existingId == planRecordId) { if (existingId == planRecordId && $('[data-changed=true]').length > 0) {
$('#planRecordModal').modal('show'); $('#planRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -27,6 +27,7 @@ function showEditPlanRecordModal(planRecordId, nocache) {
//initiate datepicker //initiate datepicker
initDatePicker($('#planRecordDate')); initDatePicker($('#planRecordDate'));
$('#planRecordModal').modal('show'); $('#planRecordModal').modal('show');
bindModalInputChanges('planRecordModal');
$('#planRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#planRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("planRecordNotes"); toggleMarkDownOverlay("planRecordNotes");

View File

@ -15,7 +15,7 @@ function showEditServiceRecordModal(serviceRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getServiceRecordModelData().id; var existingId = getServiceRecordModelData().id;
if (existingId == serviceRecordId) { if (existingId == serviceRecordId && $('[data-changed=true]').length > 0) {
$('#serviceRecordModal').modal('show'); $('#serviceRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditServiceRecordModal(serviceRecordId, nocache) {
initDatePicker($('#serviceRecordDate')); initDatePicker($('#serviceRecordDate'));
initTagSelector($("#serviceRecordTag")); initTagSelector($("#serviceRecordTag"));
$('#serviceRecordModal').modal('show'); $('#serviceRecordModal').modal('show');
bindModalInputChanges('serviceRecordModal');
$('#serviceRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#serviceRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("serviceRecordNotes"); toggleMarkDownOverlay("serviceRecordNotes");

View File

@ -706,57 +706,12 @@ $(window).on('keydown', function (e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
selectAllRows(); selectAllRows();
} else if ((e.ctrlKey || e.metaKey) && e.which == 90) {
e.preventDefault();
e.stopPropagation();
showModalForCurrentTab();
} }
} }
}); });
function getCurrentTab() { function getCurrentTab() {
return $(".tab-pane.active.show").attr('id'); return $(".tab-pane.active.show").attr('id');
} }
function showModalForCurrentTab() {
var currentTab = getCurrentTab();
var modalName = "";
switch (currentTab) {
case "servicerecord-tab-pane":
modalName = "serviceRecordModal";
break;
case "gas-tab-pane":
modalName = "gasRecordModal";
break;
case "tax-tab-pane":
modalName = "taxRecordModal";
break;
case "notes-tab-pane":
modalName = "noteModal";
break;
case "accident-tab-pane":
modalName = "collisionRecordModal";
break;
case "upgrade-tab-pane":
modalName = "upgradeRecordModal";
break;
case "supply-tab-pane":
modalName = "supplyRecordModal";
break;
case "plan-tab-pane":
modalName = "planRecordModal";
break;
case "odometer-tab-pane":
modalName = "odometerRecordModal";
break;
}
if (modalName != '') {
//check if modal has content and no other modal is currently showing.
var modalContent = $(`#${modalName} .modal-content`);
if (modalContent.html().trim() != '' && $(".modal.fade.show").length == 0) {
$(`#${modalName}`).modal('show');
$('.cached-banner').show();
}
}
}
function selectAllRows() { function selectAllRows() {
clearSelectedRows(); clearSelectedRows();
$('.vehicleDetailTabContainer .table tbody tr:visible').addClass('table-active'); $('.vehicleDetailTabContainer .table tbody tr:visible').addClass('table-active');
@ -1089,4 +1044,13 @@ function waitForElement(element, callBack, callBackParameter) {
clearInterval(checkExist); clearInterval(checkExist);
} }
}, 100); // check every 100ms }, 100); // check every 100ms
}
function bindModalInputChanges(modalName) {
//bind text inputs
$(`#${modalName} input[type='text'], #${modalName} input[type='number'], #${modalName} textarea`).off('input').on('input', function (e) {
$(e.currentTarget).attr('data-changed', true);
});
$(`#${modalName} select, #${modalName} input[type='checkbox']`).off('input').on('input', function (e) {
$(e.currentTarget).attr('data-changed', true);
});
} }

View File

@ -15,7 +15,7 @@ function showEditSupplyRecordModal(supplyRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getSupplyRecordModelData().id; var existingId = getSupplyRecordModelData().id;
if (existingId == supplyRecordId) { if (existingId == supplyRecordId && $('[data-changed=true]').length > 0) {
$('#supplyRecordModal').modal('show'); $('#supplyRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditSupplyRecordModal(supplyRecordId, nocache) {
initDatePicker($('#supplyRecordDate')); initDatePicker($('#supplyRecordDate'));
initTagSelector($("#supplyRecordTag")); initTagSelector($("#supplyRecordTag"));
$('#supplyRecordModal').modal('show'); $('#supplyRecordModal').modal('show');
bindModalInputChanges('supplyRecordModal');
$('#supplyRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#supplyRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("supplyRecordNotes"); toggleMarkDownOverlay("supplyRecordNotes");

View File

@ -15,7 +15,7 @@ function showEditTaxRecordModal(taxRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getTaxRecordModelData().id; var existingId = getTaxRecordModelData().id;
if (existingId == taxRecordId) { if (existingId == taxRecordId && $('[data-changed=true]').length > 0) {
$('#taxRecordModal').modal('show'); $('#taxRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditTaxRecordModal(taxRecordId, nocache) {
initDatePicker($('#taxRecordDate')); initDatePicker($('#taxRecordDate'));
initTagSelector($("#taxRecordTag")); initTagSelector($("#taxRecordTag"));
$('#taxRecordModal').modal('show'); $('#taxRecordModal').modal('show');
bindModalInputChanges('taxRecordModal');
$('#taxRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#taxRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("taxRecordNotes"); toggleMarkDownOverlay("taxRecordNotes");

View File

@ -15,7 +15,7 @@ function showEditUpgradeRecordModal(upgradeRecordId, nocache) {
if (existingContent.trim() != '') { if (existingContent.trim() != '') {
//check if id is same. //check if id is same.
var existingId = getUpgradeRecordModelData().id; var existingId = getUpgradeRecordModelData().id;
if (existingId == upgradeRecordId) { if (existingId == upgradeRecordId && $('[data-changed=true]').length > 0) {
$('#upgradeRecordModal').modal('show'); $('#upgradeRecordModal').modal('show');
$('.cached-banner').show(); $('.cached-banner').show();
return; return;
@ -29,6 +29,7 @@ function showEditUpgradeRecordModal(upgradeRecordId, nocache) {
initDatePicker($('#upgradeRecordDate')); initDatePicker($('#upgradeRecordDate'));
initTagSelector($("#upgradeRecordTag")); initTagSelector($("#upgradeRecordTag"));
$('#upgradeRecordModal').modal('show'); $('#upgradeRecordModal').modal('show');
bindModalInputChanges('upgradeRecordModal');
$('#upgradeRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () { $('#upgradeRecordModal').off('shown.bs.modal').on('shown.bs.modal', function () {
if (getGlobalConfig().useMarkDown) { if (getGlobalConfig().useMarkDown) {
toggleMarkDownOverlay("upgradeRecordNotes"); toggleMarkDownOverlay("upgradeRecordNotes");