From 196df07a24f8d785821f32ca98ce53945c9618b9 Mon Sep 17 00:00:00 2001 From: Eric Gullickson <16152721+ericgullickson@users.noreply.github.com> Date: Sun, 20 Jul 2025 15:07:26 -0500 Subject: [PATCH] Added Simplied Fuel Entry --- Controllers/Vehicle/GasController.cs | 8 ++ Helper/ConfigHelper.cs | 1 + Helper/StaticHelper.cs | 2 +- Models/UserConfig.cs | 1 + Views/Vehicle/Gas/_GasModal.cshtml | 129 +++++++++++++++++---------- wwwroot/js/gasrecord.js | 114 ++++++++++++++++++++++- 6 files changed, 207 insertions(+), 48 deletions(-) diff --git a/Controllers/Vehicle/GasController.cs b/Controllers/Vehicle/GasController.cs index 163127a..3d3aca1 100644 --- a/Controllers/Vehicle/GasController.cs +++ b/Controllers/Vehicle/GasController.cs @@ -133,6 +133,14 @@ namespace MotoVaultPro.Controllers return Json(result); } [HttpPost] + public IActionResult SaveSimpleFuelEntryPreference(bool useSimpleFuelEntry) + { + var currentConfig = _config.GetUserConfig(User); + currentConfig.UseSimpleFuelEntry = useSimpleFuelEntry; + var result = _config.SaveUserConfig(User, currentConfig); + return Json(result); + } + [HttpPost] public IActionResult GetGasRecordsEditModal(List recordIds) { var extraFields = _extraFieldDataAccess.GetExtraFieldsById((int)ImportMode.GasRecord).ExtraFields; diff --git a/Helper/ConfigHelper.cs b/Helper/ConfigHelper.cs index 8bcb1ed..ebaff68 100644 --- a/Helper/ConfigHelper.cs +++ b/Helper/ConfigHelper.cs @@ -337,6 +337,7 @@ namespace MotoVaultPro.Helper PreferredGasMileageUnit = CheckString(nameof(UserConfig.PreferredGasMileageUnit)), PreferredGasUnit = CheckString(nameof(UserConfig.PreferredGasUnit)), UseUnitForFuelCost = CheckBool(CheckString(nameof(UserConfig.UseUnitForFuelCost))), + UseSimpleFuelEntry = CheckBool(CheckString(nameof(UserConfig.UseSimpleFuelEntry))), UserLanguage = CheckString(nameof(UserConfig.UserLanguage), "en_US"), HideSoldVehicles = CheckBool(CheckString(nameof(UserConfig.HideSoldVehicles))), EnableShopSupplies = CheckBool(CheckString(nameof(UserConfig.EnableShopSupplies))), diff --git a/Helper/StaticHelper.cs b/Helper/StaticHelper.cs index b775157..6e0324f 100644 --- a/Helper/StaticHelper.cs +++ b/Helper/StaticHelper.cs @@ -12,7 +12,7 @@ namespace MotoVaultPro.Helper /// public static class StaticHelper { - public const string VersionNumber = "1.4.9"; + public const string VersionNumber = "1.0.0"; public const string DbName = "data/cartracker.db"; public const string UserConfigPath = "data/config/userConfig.json"; public const string ServerConfigPath = "data/config/serverConfig.json"; diff --git a/Models/UserConfig.cs b/Models/UserConfig.cs index ee90dff..74704c1 100644 --- a/Models/UserConfig.cs +++ b/Models/UserConfig.cs @@ -22,6 +22,7 @@ public string PreferredGasUnit { get; set; } = string.Empty; public string PreferredGasMileageUnit { get; set; } = string.Empty; public bool UseUnitForFuelCost { get; set; } + public bool UseSimpleFuelEntry { get; set; } public bool ShowCalendar { get; set; } public bool ShowVehicleThumbnail { get; set; } public List UserColumnPreferences { get; set; } = new List(); diff --git a/Views/Vehicle/Gas/_GasModal.cshtml b/Views/Vehicle/Gas/_GasModal.cshtml index dce064d..d28e2d0 100644 --- a/Views/Vehicle/Gas/_GasModal.cshtml +++ b/Views/Vehicle/Gas/_GasModal.cshtml @@ -13,6 +13,7 @@ var useHours = Model.UseHours; var isNew = Model.GasRecord.Id == 0; var useUnitFuelCost = userConfig.UseUnitForFuelCost; + var useSimpleFuelEntry = userConfig.UseSimpleFuelEntry; string consumptionUnit; string distanceUnit; if (useKwh) @@ -40,8 +41,16 @@ } }