added kwh setting

This commit is contained in:
DESKTOP-GENO133\IvanPlex 2024-01-06 08:53:45 -07:00
parent 1c2368f5a1
commit 25db16c47f
6 changed files with 14 additions and 6 deletions

View File

@ -45,7 +45,8 @@ namespace CarCareTracker.Controllers
UseDarkMode = bool.Parse(_config[nameof(UserConfig.UseDarkMode)]),
UseMPG = bool.Parse(_config[nameof(UserConfig.UseMPG)]),
UseDescending = bool.Parse(_config[nameof(UserConfig.UseDescending)]),
EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)])
EnableAuth = bool.Parse(_config[nameof(UserConfig.EnableAuth)]),
UsekWh = bool.Parse(_config[nameof(UserConfig.UsekWh)])
};
return PartialView("_Settings", userConfig);
}

View File

@ -6,7 +6,7 @@ namespace CarCareTracker.External.Implementations
{
public class CollisionRecordDataAccess : ICollisionRecordDataAccess
{
private static string dbName = "cartracker.db";
private static string dbName = "db/cartracker.db";
private static string tableName = "collisionrecords";
public List<CollisionRecord> GetCollisionRecordsByVehicleId(int vehicleId)
{

View File

@ -3,6 +3,7 @@
public class UserConfig
{
public bool UseDarkMode { get; set; }
public bool UsekWh { get; set; }
public bool EnableCsvImports { get; set; }
public bool UseMPG { get; set; }
public bool UseDescending { get; set; }

View File

@ -16,7 +16,11 @@
</div>
<div class="form-check form-switch">
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="useMPG" checked="@Model.UseMPG">
<label class="form-check-label" for="useMPG">Use Imperial Units for Fuel Economy Calculations(Miles, Gallons)</label>
<label class="form-check-label" for="useMPG">Use Imperial Calculation for Fuel Economy Calculations(MPG)<small class="text-body-secondary">Will also change units to miles and gallons</small></label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" onChange="updateSettings()" type="checkbox" role="switch" id="usekWh" checked="@Model.UsekWh">
<label class="form-check-label" for="usekWh">Electric Car(Gas Consumption Units will be replaced with kWh)</label>
</div>
</div>
<div class="col-12 col-md-6">
@ -76,7 +80,8 @@
useDarkMode: $("#enableDarkMode").is(':checked'),
enableCsvImports: $("#enableCsvImports").is(':checked'),
useMPG: $("#useMPG").is(':checked'),
useDescending: $("#useDescending").is(':checked')
useDescending: $("#useDescending").is(':checked'),
usekWh: $("#usekWh").is(':checked')
}
$.post('/Home/WriteToSettings', { userConfig: userConfigObject}, function(data){
if (data) {

View File

@ -19,5 +19,6 @@
"UseDescending": false,
"EnableAuth": false,
"UserNameHash": "",
"UserPasswordHash": ""
"UserPasswordHash": "",
"UsekWh": false
}

View File

@ -1 +1 @@
{"UseDarkMode":true,"EnableCsvImports":false,"UseMPG":true,"UseDescending":false,"EnableAuth":false,"UserNameHash":"","UserPasswordHash":""}
{"UseDarkMode":true,"UsekWh":false,"EnableCsvImports":false,"UseMPG":true,"UseDescending":false,"EnableAuth":false,"UserNameHash":"","UserPasswordHash":""}