Moved template modal outside of add modal.

This commit is contained in:
DESKTOP-GENO133\IvanPlex 2024-04-05 19:36:26 -06:00
parent 4c30939339
commit c582f5f5c7
3 changed files with 4 additions and 9 deletions

View File

@ -101,10 +101,6 @@
</button>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" onclick="savePlanRecordTemplate()">@translator.Translate(userLanguage, "Save as Template")</a></li>
@if (!Model.CreatedFromReminder)
{
<li><a class="dropdown-item" href="#" onclick="showPlanRecordTemplatesModal()">@translator.Translate(userLanguage, "View Templates")</a></li>
}
</ul>
</div>
}

View File

@ -28,6 +28,8 @@
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#" onclick="showBulkImportModal('PlanRecord')">@translator.Translate(userLanguage,"Import via CSV")</a></li>
<li><a class="dropdown-item" href="#" onclick="exportVehicleData('PlanRecord')">@translator.Translate(userLanguage,"Export to CSV")</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#" onclick="showPlanRecordTemplatesModal()">@translator.Translate(userLanguage, "View Templates")</a></li>
</ul>
</div>
}
@ -102,7 +104,7 @@
</div>
</div>
<div class="modal fade" data-bs-focus="false" id="planRecordTemplateModal" tabindex="-1" role="dialog" aria-hidden="true" data-bs-backdrop="static" data-bs-keyboard="false">
<div class="modal fade" data-bs-focus="false" id="planRecordTemplateModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content" id="planRecordTemplateModalContent">
</div>

View File

@ -98,22 +98,19 @@ function showPlanRecordTemplatesModal() {
$.get(`/Vehicle/GetPlanRecordTemplatesForVehicleId?vehicleId=${vehicleId}`, function (data) {
if (data) {
$("#planRecordTemplateModalContent").html(data);
hideAddPlanRecordModal();
$('#planRecordTemplateModal').modal('show');
}
});
}
function hidePlanRecordTemplatesModal() {
$('#planRecordTemplateModal').modal('hide');
$('#planRecordModal').modal('show');
}
function usePlannerRecordTemplate(planRecordTemplateId) {
$.post(`/Vehicle/ConvertPlanRecordTemplateToPlanRecord?planRecordTemplateId=${planRecordTemplateId}`, function (data) {
if (data.success) {
var vehicleId = GetVehicleId().vehicleId;
successToast(data.message);
$('#planRecordTemplateModal').modal('hide');
hideAddPlanRecordModal();
hidePlanRecordTemplatesModal();
saveScrollPosition();
getVehiclePlanRecords(vehicleId);
} else {