added garage level supplies

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-02-08 15:30:24 -07:00
parent 27126638be
commit 4bfe947ce1
5 changed files with 153 additions and 114 deletions

View File

@@ -222,27 +222,6 @@ function editVehicle(vehicleId) {
function hideEditVehicleModal() {
$('#editVehicleModal').modal('hide');
}
function exportVehicleData(mode) {
var vehicleId = GetVehicleId().vehicleId;
$.get('/Vehicle/ExportFromVehicleToCsv', { vehicleId: vehicleId, mode: mode }, function (data) {
if (!data) {
errorToast(genericErrorMessage());
} else {
window.location.href = data;
}
});
}
function showBulkImportModal(mode) {
$.get(`/Vehicle/GetBulkImportModalPartialView?mode=${mode}`, function (data) {
if (data) {
$("#bulkImportModalContent").html(data);
$("#bulkImportModal").modal('show');
}
})
}
function hideBulkImportModal(){
$("#bulkImportModal").modal('hide');
}
function deleteVehicle(vehicleId) {
Swal.fire({
title: "Confirm Deletion?",
@@ -260,32 +239,6 @@ function deleteVehicle(vehicleId) {
}
});
}
function uploadVehicleFilesAsync(event) {
let formData = new FormData();
var files = event.files;
for (var x = 0; x < files.length; x++) {
formData.append("file", files[x]);
}
sloader.show();
$.ajax({
url: "/Files/HandleMultipleFileUpload",
data: formData,
cache: false,
processData: false,
contentType: false,
type: 'POST',
success: function (response) {
sloader.hide();
if (response.length > 0) {
uploadedFiles.push.apply(uploadedFiles, response);
}
},
error: function () {
sloader.hide();
errorToast("An error has occurred, please check the file size and try again later.")
}
});
}
function showAddReminderModal(reminderModalInput) {
if (reminderModalInput != undefined) {
$.post('/Vehicle/GetAddReminderRecordPartialView', {reminderModel: reminderModalInput}, function (data) {
@@ -318,47 +271,6 @@ function getVehicleHaveImportantReminders(vehicleId) {
});
}, 500);
}
function printTab() {
setTimeout(function () {
window.print();
}, 500);
}
function deleteFileFromUploadedFiles(fileLocation, event) {
event.parentElement.parentElement.parentElement.remove();
uploadedFiles = uploadedFiles.filter(x => x.location != fileLocation);
}
function editFileName(fileLocation, event) {
Swal.fire({
title: 'Rename File',
html: `
<input type="text" id="newFileName" class="swal2-input" placeholder="New File Name">
`,
confirmButtonText: 'Rename',
focusConfirm: false,
preConfirm: () => {
const newFileName = $("#newFileName").val();
if (!newFileName) {
Swal.showValidationMessage(`Please enter a valid file name`)
}
return { newFileName }
},
}).then(function (result) {
if (result.isConfirmed) {
var linkDisplayObject = $(event.parentElement.parentElement).find('a')[0];
linkDisplayObject.text = result.value.newFileName;
var editFileIndex = uploadedFiles.findIndex(x => x.location == fileLocation);
uploadedFiles[editFileIndex].name = result.value.newFileName;
}
});
}
var scrollPosition = 0;
function saveScrollPosition() {
scrollPosition = $(".vehicleDetailTabContainer").scrollTop();
}
function restoreScrollPosition() {
$(".vehicleDetailTabContainer").scrollTop(scrollPosition);
scrollPosition = 0;
}
function moveRecord(recordId, source, dest) {
$("#workAroundInput").show();
var friendlySource = "";
@@ -415,25 +327,4 @@ function moveRecord(recordId, source, dest) {
$("#workAroundInput").hide();
}
});
}
function toggleMarkDownOverlay(textAreaName) {
var textArea = $(`#${textAreaName}`);
if ($(".markdown-overlay").length > 0) {
$(".markdown-overlay").remove();
return;
}
var text = textArea.val();
if (text == undefined) {
return;
}
if (text.length > 0) {
var formatted = markdown(text);
//var overlay div
var overlayDiv = `<div class='markdown-overlay' style="z-index: 1060; position:absolute; top:${textArea.css('top')}; left:${textArea.css('left')}; width:${textArea.css('width')}; height:${textArea.css('height')}; padding:${textArea.css('padding')}; overflow-y:auto; background-color:var(--bs-modal-bg);">${formatted}</div>`;
textArea.parent().children(`label[for=${textAreaName}]`).append(overlayDiv);
}
}
function showLinks(e) {
var textAreaName = $(e.parentElement).attr("for");
toggleMarkDownOverlay(textAreaName);
}