Skip to content

Commit

Permalink
Merge pull request #120 from pkuehnel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
pkuehnel authored Jun 3, 2022
2 parents cdab682 + 350e2d8 commit ad614a6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions SmartTeslaAmpSetter/Client/Pages/CarSettings.razor
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ else
<div class="shadow p-3 mb-5 bg-white rounded">
<b>@carBasicConfiguration.CarName</b>
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="minAmpere">Min Ampere:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.MinimumAmpere" type="number" id="minAmpere" name="minAmpere" min="1" max="32"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="minAmpere">Min Ampere:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.MinimumAmpere" type="number" id="minAmpere" name="minAmpere" min="1" max="32"
@onchange="@(e => carBasicConfiguration.MinimumAmpere = Int32.Parse(e.Value?.ToString() ?? "1"))">
</p>
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="maxAmpere">Max Ampere:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.MaximumAmpere" type="number" id="maxAmpere" name="maxAmpere" min="1" max="32"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="maxAmpere">Max Ampere:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.MaximumAmpere" type="number" id="maxAmpere" name="maxAmpere" min="1" max="32"
@onchange="@(e => carBasicConfiguration.MaximumAmpere = Int32.Parse(e.Value?.ToString() ?? "1"))">
</p>
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="usableEnergy">Usable kWh:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.UsableEnergy" type="number" id="usableEnergy" name="usableEnergy" min="1" max="120"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="usableEnergy">Usable kWh:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@carBasicConfiguration.UsableEnergy" type="number" id="usableEnergy" name="usableEnergy" min="1" max="120"
@onchange="@(e => carBasicConfiguration.UsableEnergy = Int32.Parse(e.Value?.ToString() ?? "1"))">
</p>
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="usableEnergy">Auto Set Amp:</label>
<input class="col-sm-6 col-md-3 col-lg-2" checked="@carBasicConfiguration.ShouldBeManaged" type="checkbox" id="ShouldBeManaged" name="ShouldBeManaged" min="1" max="120"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="usableEnergy">Auto Set Amp:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" checked="@carBasicConfiguration.ShouldBeManaged" type="checkbox" id="ShouldBeManaged" name="ShouldBeManaged" min="1" max="120"
@onchange="@(e => carBasicConfiguration.ShouldBeManaged = Boolean.Parse(e.Value?.ToString() ?? "true"))">
</p>
<p><button class="btn btn-success col-sm-10 col-md-6 col-lg-4" @onclick="() => UpdateCarConfiguration(carBasicConfiguration.CarId, carBasicConfiguration)">@_saveButtonTexts[carBasicConfiguration.CarId]</button></p>
<p><button class="btn btn-success col-11 col-sm-10 col-md-6 col-lg-4" @onclick="() => UpdateCarConfiguration(carBasicConfiguration.CarId, carBasicConfiguration)">@_saveButtonTexts[carBasicConfiguration.CarId]</button></p>
</div>
}
}
Expand Down
20 changes: 10 additions & 10 deletions SmartTeslaAmpSetter/Client/Pages/Index.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ else
}
<div class="@(_settings.Overage > 0 ? "text-success" : "text-danger")"><i class="fa-solid fa-bolt"></i> @(Math.Abs(_settings.Overage)) W</div>
<div><i class="fa-solid fa-car"></i> @_settings.Cars.Sum(c => c.CarState.ChargingPowerAtHome) W</div>
<button class="btn btn-primary col-sm-5 col-md-3" @onclick="() => RefreshSettings()">@_refreshButtonText</button>
<button class="btn btn-primary col-6 col-sm-6 col-md-3" @onclick="() => RefreshSettings()">@_refreshButtonText</button>
</div>
@foreach (var car in _settings.Cars)
{
Expand All @@ -34,31 +34,31 @@ else
<i class="fa-solid fa-circle-exclamation"></i>
}
<div><b>@(car.CarState.Name)</b>: @(car.CarState.SoC)% (@(car.CarState.SocLimit)%) @car.CarState.ChargingPowerAtHome W</div>
<div class="col-sm-4 col-md-3">@car.CarConfiguration.ChargeMode.ToFriendlyString()</div> <button class="btn btn-primary col-sm-5 col-md-3" @onclick="() => ChangeChargeMode(car.Id)">@_chargemodeChangeButtonTexts[car.Id]</button>
<label class="col-5 col-sm-4 col-md-3 col-lg-2">@car.CarConfiguration.ChargeMode.ToFriendlyString()</label> <button class="btn btn-primary col-6 col-sm-6 col-md-3 col-lg-2" @onclick="() => ChangeChargeMode(car.Id)">@_chargemodeChangeButtonTexts[car.Id]</button>
@if (car.CarConfiguration.ChargeMode == ChargeMode.PvAndMinSoc || car.CarConfiguration.ChargeMode == ChargeMode.PvOnly)
{
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="minSoc">Min SOC:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.MinimumSoC" type="number" id="minSoc" name="minSoc" min="0" max="100"
@onchange="@(e => car.CarConfiguration.MinimumSoC = Int32.Parse(e.Value?.ToString() ?? "0"))">%
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="minSoc">Min SOC (%):</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.MinimumSoC" type="number" id="minSoc" name="minSoc" min="0" max="100"
@onchange="@(e => car.CarConfiguration.MinimumSoC = Int32.Parse(e.Value?.ToString() ?? "0"))">
</p>
}
@if (car.CarConfiguration.ChargeMode == ChargeMode.PvOnly)
{
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="date">Date:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.LatestTimeToReachSoC.Date.ToString("yyyy-MM-dd")" type="date" id="date" name="date"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="date">Date:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.LatestTimeToReachSoC.Date.ToString("yyyy-MM-dd")" type="date" id="date" name="date"
@onchange="@(e => car.CarConfiguration.LatestTimeToReachSoC = DateTime.Parse(e.Value?.ToString() ?? DateTime.MaxValue.ToString(CultureInfo.CurrentCulture)).Date.AddHours(car.CarConfiguration.LatestTimeToReachSoC.Hour).AddMinutes(car.CarConfiguration.LatestTimeToReachSoC.Minute))">
</p>
<p>
<label class="col-sm-4 col-md-3 col-lg-2" for="time">Time:</label>
<input class="col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.LatestTimeToReachSoC.ToString("HH:mm")" type="time" id="time" name="time"
<label class="col-5 col-sm-4 col-md-3 col-lg-2" for="time">Time:</label>
<input class="col-6 col-sm-6 col-md-3 col-lg-2" value="@car.CarConfiguration.LatestTimeToReachSoC.ToString("HH:mm")" type="time" id="time" name="time"
@onchange="@(e => car.CarConfiguration.LatestTimeToReachSoC = car.CarConfiguration.LatestTimeToReachSoC.Date.AddHours(TimeSpan.Parse(e.Value?.ToString() ?? "00:00").Hours).AddMinutes(TimeSpan.Parse(e.Value?.ToString() ?? "00:00").Minutes))">
</p>
}
@if (car.CarConfiguration.ChargeMode == ChargeMode.PvAndMinSoc || car.CarConfiguration.ChargeMode == ChargeMode.PvOnly)
{
<p><button class="btn btn-success col-sm-10 col-md-6 col-lg-4" @onclick="() => UpdateCarConfiguration(car.Id, car.CarConfiguration)">@_saveButtonTexts[car.Id]</button></p>
<p><button class="btn btn-success col-11 col-sm-10 col-md-6 col-lg-4" @onclick="() => UpdateCarConfiguration(car.Id, car.CarConfiguration)">@_saveButtonTexts[car.Id]</button></p>
}
</div>
}
Expand Down

0 comments on commit ad614a6

Please sign in to comment.