diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs index 9fa0893..8dba7a8 100644 --- a/Controllers/VehicleController.cs +++ b/Controllers/VehicleController.cs @@ -130,10 +130,10 @@ namespace CarCareTracker.Controllers if (isNewAddition) { _userLogic.AddUserAccessToVehicle(GetUserID(), vehicleInput.Id); - StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.Generic($"{vehicleInput.Year} {vehicleInput.Make} {vehicleInput.Model}", "vehicle.add", User.Identity.Name, vehicleInput.Id.ToString())); + StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.Generic($"Created Vehicle {vehicleInput.Year} {vehicleInput.Make} {vehicleInput.Model}({StaticHelper.GetVehicleIdentifier(vehicleInput)})", "vehicle.add", User.Identity.Name, vehicleInput.Id.ToString())); } else { - StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.Generic($"{vehicleInput.Year} {vehicleInput.Make} {vehicleInput.Model}", "vehicle.update", User.Identity.Name, vehicleInput.Id.ToString())); + StaticHelper.NotifyAsync(_config.GetWebHookUrl(), WebHookPayload.Generic($"Updated Vehicle {vehicleInput.Year} {vehicleInput.Make} {vehicleInput.Model}({StaticHelper.GetVehicleIdentifier(vehicleInput)})", "vehicle.update", User.Identity.Name, vehicleInput.Id.ToString())); } return Json(result); } diff --git a/Models/Shared/WebHookPayload.cs b/Models/Shared/WebHookPayload.cs index f49b896..7a91d40 100644 --- a/Models/Shared/WebHookPayload.cs +++ b/Models/Shared/WebHookPayload.cs @@ -200,9 +200,9 @@ { Type = actionType, Data = payloadDictionary, - VehicleId = string.IsNullOrWhiteSpace(vehicleId) ? "N/A" : "", + VehicleId = string.IsNullOrWhiteSpace(vehicleId) ? "N/A" : vehicleId, Username = userName, - Action = string.IsNullOrWhiteSpace(payload) ? GetFriendlyActionType(actionType) : "" + Action = string.IsNullOrWhiteSpace(payload) ? GetFriendlyActionType(actionType) : payload }; } } diff --git a/wwwroot/js/shared.js b/wwwroot/js/shared.js index 5bc1309..ef30cd1 100644 --- a/wwwroot/js/shared.js +++ b/wwwroot/js/shared.js @@ -28,6 +28,21 @@ function errorToast(message) { } }) } +function infoToast(message) { + Swal.fire({ + toast: true, + position: "top-end", + showConfirmButton: false, + timer: 3000, + title: message, + timerProgressBar: true, + icon: "info", + didOpen: (toast) => { + toast.onmouseenter = Swal.stopTimer; + toast.onmouseleave = Swal.resumeTimer; + } + }) +} function viewVehicle(vehicleId) { window.location.href = `/Vehicle/Index?vehicleId=${vehicleId}`; } diff --git a/wwwroot/js/taxrecord.js b/wwwroot/js/taxrecord.js index 6e7ad93..95336ae 100644 --- a/wwwroot/js/taxrecord.js +++ b/wwwroot/js/taxrecord.js @@ -181,9 +181,11 @@ function getAndValidateTaxRecordValues() { } function checkRecurringTaxes() { - $.post('/Vehicle/CheckRecurringTaxRecords', { vehicleId: GetVehicleId().vehicleId }, function (data) { + let vehicleId = GetVehicleId().vehicleId + $.post('/Vehicle/CheckRecurringTaxRecords', { vehicleId: vehicleId }, function (data) { if (data) { - viewVehicle(GetVehicleId().vehicleId); + //notify users that recurring tax records were updated and they should refresh the page to see the new changes. + infoToast(`Recurring Tax Records Updated!

Refresh to see new records`); } }) } \ No newline at end of file