added logic to overwrite consumption units with kwh
This commit is contained in:
@@ -2,6 +2,18 @@
|
||||
@{
|
||||
var enableCsvImports = bool.Parse(Configuration[nameof(UserConfig.EnableCsvImports)]);
|
||||
var useMPG = bool.Parse(Configuration[nameof(UserConfig.UseMPG)]);
|
||||
var useKwh = bool.Parse(Configuration[nameof(UserConfig.UsekWh)]);
|
||||
string consumptionUnit;
|
||||
string fuelEconomyUnit;
|
||||
if (useKwh)
|
||||
{
|
||||
consumptionUnit = "kWh";
|
||||
fuelEconomyUnit = useMPG ? "mi/kWh" : "kWh/100km";
|
||||
} else
|
||||
{
|
||||
consumptionUnit = useMPG ? "gal" : "l";
|
||||
fuelEconomyUnit = useMPG ? "mpg" : "l/100km";
|
||||
}
|
||||
}
|
||||
@model List<GasRecordViewModel>
|
||||
<div class="row">
|
||||
@@ -40,8 +52,8 @@
|
||||
<tr class="d-flex">
|
||||
<th scope="col" class="col-2">Date Refueled</th>
|
||||
<th scope="col" class="col-2">Odometer(@(useMPG ? "mi." : "km"))</th>
|
||||
<th scope="col" class="col-2">Consumption(@(useMPG ? "gal" : "l"))</th>
|
||||
<th scope="col" class="col-2">Fuel Economy(@(useMPG ? "mpg" : "l/100km"))</th>
|
||||
<th scope="col" class="col-2">Consumption(@(consumptionUnit))</th>
|
||||
<th scope="col" class="col-2">Fuel Economy(@(fuelEconomyUnit))</th>
|
||||
<th scope="col" class="col-2">Cost</th>
|
||||
<th scope="col" class="col-2">Unit Cost</th>
|
||||
</tr>
|
||||
|
||||
@@ -2,7 +2,17 @@
|
||||
@model GasRecordInput
|
||||
@{
|
||||
var useMPG = bool.Parse(Configuration[nameof(UserConfig.UseMPG)]);
|
||||
var useKwh = bool.Parse(Configuration[nameof(UserConfig.UsekWh)]);
|
||||
var isNew = Model.Id == 0;
|
||||
string consumptionUnit;
|
||||
if (useKwh)
|
||||
{
|
||||
consumptionUnit = "kWh";
|
||||
}
|
||||
else
|
||||
{
|
||||
consumptionUnit = useMPG ? "gallons" : "liters";
|
||||
}
|
||||
}
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">@(isNew ? "Add New Gas Record" : "Edit Gas Record")</h5>
|
||||
@@ -21,7 +31,7 @@
|
||||
</div>
|
||||
<label for="gasRecordMileage">Odometer Reading(@(useMPG ? "miles" : "kilometers"))</label>
|
||||
<input type="number" id="gasRecordMileage" class="form-control" placeholder="Odometer reading when refueled" value="@(isNew ? "" : Model.Mileage)">
|
||||
<label for="gasRecordGallons">Fuel Consumption(@(useMPG ? "gallons" : "liters"))</label>
|
||||
<label for="gasRecordGallons">Fuel Consumption(@(consumptionUnit))</label>
|
||||
<input type="text" id="gasRecordGallons" class="form-control" placeholder="Amount of gas refueled" value="@(isNew ? "" : Model.Gallons)">
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="gasIsFillToFull" checked="@Model.IsFillToFull">
|
||||
|
||||
Reference in New Issue
Block a user