diff --git a/Controllers/VehicleController.cs b/Controllers/VehicleController.cs
index df973c4..0294b87 100644
--- a/Controllers/VehicleController.cs
+++ b/Controllers/VehicleController.cs
@@ -2340,6 +2340,12 @@ namespace CarCareTracker.Controllers
}
#endregion
#region "Shared Methods"
+ [TypeFilter(typeof(CollaboratorFilter))]
+ public IActionResult GetMaxMileage(int vehicleId)
+ {
+ var result = _vehicleLogic.GetMaxMileage(vehicleId);
+ return Json(result);
+ }
public IActionResult MoveRecord(int recordId, ImportMode source, ImportMode destination)
{
var genericRecord = new GenericRecord();
diff --git a/Helper/StaticHelper.cs b/Helper/StaticHelper.cs
index 109d12b..0e76097 100644
--- a/Helper/StaticHelper.cs
+++ b/Helper/StaticHelper.cs
@@ -8,7 +8,7 @@ namespace CarCareTracker.Helper
///
public static class StaticHelper
{
- public static string VersionNumber = "1.2.9";
+ public static string VersionNumber = "1.3.0";
public static string DbName = "data/cartracker.db";
public static string UserConfigPath = "config/userConfig.json";
public static string GenericErrorMessage = "An error occurred, please try again later";
diff --git a/Views/Vehicle/_CollisionRecordModal.cshtml b/Views/Vehicle/_CollisionRecordModal.cshtml
index df28530..2c18c73 100644
--- a/Views/Vehicle/_CollisionRecordModal.cshtml
+++ b/Views/Vehicle/_CollisionRecordModal.cshtml
@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
@@ -17,14 +17,22 @@
}
-
+
@if (isNew)
{
@await Html.PartialAsync("_SupplyStore", "RepairRecord")
}
-
+
-
+
@if (Model.Files.Any())
{
@await Html.PartialAsync("_UploadedFiles", Model.Files)
-
+
-
@translator.Translate(userLanguage,"Max File Size: 28.6MB")
+
@translator.Translate(userLanguage, "Max File Size: 28.6MB")
}
else
@@ -75,13 +83,15 @@
}
-
+
-
@translator.Translate(userLanguage,"Max File Size: 28.6MB")
+
+
+
@translator.Translate(userLanguage, "Max File Size: 28.6MB")
}
@@ -96,25 +106,25 @@
}
-
+
}
-
+
@if (isNew)
{
-
+
}
else if (!isNew)
{
-
+
}
@await Html.PartialAsync("_SupplyRequisitionHistory", Model.RequisitionHistory)
@@ -129,7 +139,7 @@
{
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
}
- }
+ }
function getCollisionRecordModelData() {
return { id: @Model.Id}
}
diff --git a/Views/Vehicle/_GasModal.cshtml b/Views/Vehicle/_GasModal.cshtml
index 687a814..1105d2d 100644
--- a/Views/Vehicle/_GasModal.cshtml
+++ b/Views/Vehicle/_GasModal.cshtml
@@ -52,7 +52,15 @@
-
+
diff --git a/Views/Vehicle/_ServiceRecordModal.cshtml b/Views/Vehicle/_ServiceRecordModal.cshtml
index c1ed530..2b64bd0 100644
--- a/Views/Vehicle/_ServiceRecordModal.cshtml
+++ b/Views/Vehicle/_ServiceRecordModal.cshtml
@@ -22,8 +22,16 @@
-
-
+
+
@if (isNew)
diff --git a/Views/Vehicle/_UpgradeRecordModal.cshtml b/Views/Vehicle/_UpgradeRecordModal.cshtml
index 24a215d..4f2f2f7 100644
--- a/Views/Vehicle/_UpgradeRecordModal.cshtml
+++ b/Views/Vehicle/_UpgradeRecordModal.cshtml
@@ -8,7 +8,7 @@
var userLanguage = userConfig.UserLanguage;
}
@@ -17,14 +17,22 @@
}
-
+
@if (isNew)
{
@await Html.PartialAsync("_SupplyStore", "UpgradeRecord")
}
-
+
-
+
@if (Model.Files.Any())
{
@await Html.PartialAsync("_UploadedFiles", Model.Files)
-
+
-
@translator.Translate(userLanguage,"Max File Size: 28.6MB")
+
@translator.Translate(userLanguage, "Max File Size: 28.6MB")
}
else
@@ -75,13 +83,15 @@
}
-
@translator.Translate(userLanguage,"Max File Size: 28.6MB")
+
+
+
@translator.Translate(userLanguage, "Max File Size: 28.6MB")
}
@@ -96,25 +106,25 @@
}
-
+
}
-
+
@if (isNew)
{
-
+
}
else if (!isNew)
{
-
+
}
@await Html.PartialAsync("_SupplyRequisitionHistory", Model.RequisitionHistory)
@@ -129,7 +139,7 @@
{
@:uploadedFiles.push({ name: "@filesUploaded.Name", location: "@filesUploaded.Location" });
}
- }
+ }
function getUpgradeRecordModelData() {
return { id: @Model.Id}
}
diff --git a/wwwroot/js/vehicle.js b/wwwroot/js/vehicle.js
index f018fbd..b3b98fe 100644
--- a/wwwroot/js/vehicle.js
+++ b/wwwroot/js/vehicle.js
@@ -607,4 +607,38 @@ function getAndValidateSelectedRecurringReminder() {
}
}
}
+}
+function getLastOdometerReadingAndIncrement(odometerFieldName) {
+ Swal.fire({
+ title: 'Increment Last Reported Odometer Reading',
+ html: `
+
+ `,
+ confirmButtonText: 'Add',
+ focusConfirm: false,
+ preConfirm: () => {
+ const odometerIncrement = parseInt(globalParseFloat($("#inputOdometerIncrement").val()));
+ if (isNaN(odometerIncrement) || odometerIncrement <= 0) {
+ Swal.showValidationMessage(`Please enter a non-zero amount to increment`);
+ }
+ return { odometerIncrement }
+ },
+ }).then(function (result) {
+ if (result.isConfirmed) {
+ var amountToIncrement = result.value.odometerIncrement;
+ $.get(`/Vehicle/GetMaxMileage?vehicleId=${GetVehicleId().vehicleId}`, function (data) {
+ var newAmount = data + amountToIncrement;
+ if (!isNaN(newAmount)) {
+ var odometerField = $(`#${odometerFieldName}`);
+ if (odometerField.length > 0) {
+ odometerField.val(newAmount);
+ } else {
+ errorToast(genericErrorMessage());
+ }
+ } else {
+ errorToast(genericErrorMessage());
+ }
+ });
+ }
+ });
}
\ No newline at end of file