Added Confirmation before deleting vehicle, started work on collisions.

This commit is contained in:
ivancheahhh
2024-01-03 09:57:03 -07:00
parent f83d677e84
commit 9381da5d17
9 changed files with 79 additions and 15 deletions

View File

@@ -49,12 +49,33 @@ function getVehicleServiceRecords(vehicleId) {
}
})
}
function DeleteVehicle(vehicleId) {
$.post('/Vehicle/DeleteVehicle', { vehicleId: vehicleId }, function (data) {
function editVehicle(vehicleId) {
$.get(`/Vehicle/GetEditVehiclePartialViewById?vehicleId=${vehicleId}`, function (data) {
if (data) {
window.location.href = '/Home';
$("#editVehicleModalContent").html(data);
$('#editVehicleModal').modal('show');
}
})
});
}
function hideEditVehicleModal() {
$('#editVehicleModal').modal('hide');
}
function deleteVehicle(vehicleId) {
Swal.fire({
title: "Confirm Deletion?",
text: "This will also delete all data tied to this vehicle. Deleted Vehicles and their associated data cannot be restored.",
showCancelButton: true,
confirmButtonText: "Delete",
confirmButtonColor: "#dc3545"
}).then((result) => {
if (result.isConfirmed) {
$.post('/Vehicle/DeleteVehicle', { vehicleId: vehicleId }, function (data) {
if (data) {
window.location.href = '/Home';
}
})
}
});
}
function getVehicleGasRecords(vehicleId) {
$.get(`/Vehicle/GetGasRecordsByVehicleId?vehicleId=${vehicleId}`, function (data) {