A new page (/electricity) to record one electricity bill per billing
period (1 July-30 June) with a grid, add/edit dialog, and two Chart.js
charts (kWh split grid/PV per period, CHF/kWh as a line).
- ElectricityBill (Common): Grid/PV kWh and CHF, side costs, advance
payment; computed TotalKwh, PvShare, TotalChf, Balance, ChfPerKwh.
- Stored once per mandator at {DataPath}/{mandator}/electricity.json
instead of per year, since the billing period doesn't align with
calendar years (new ISettingsService.GetMandatorPath(),
BaseRepository gets a directory-aware SaveAsync overload).
- electricity.json is also editable through the JSON editor
(RawDataRepository).
- charts.js: stackedBar/line charts can now show a unit other than
CHF (defaults to CHF, so the Analyse page is unaffected).
- The add/edit dialog links to an annotated example (SVG, placeholder
data) showing which value on the real NeoVac bill goes into which
field; opens in its own dialog since the main dialog has a fixed
height.
- Tests for the computed properties and the new repositories.
Also bumps the TargetFramework to net10.0 and updates the local
DataPath in appsettings.Development.json.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
64 lines
No EOL
3.6 KiB
Text
64 lines
No EOL
3.6 KiB
Text
@using Microsoft.FluentUI.AspNetCore.Components.Icons.Regular
|
|
@rendermode InteractiveServer
|
|
|
|
<!-- https://www.fluentui-blazor.net/Icon#explorer -->
|
|
|
|
<div class="navmenu hidePrint">
|
|
<nav class="sitenav" aria-labelledby="main-menu">
|
|
<FluentNavMenu Id="main-menu" Collapsible="true" Width="250" Title="Navigation menu" @bind-Expanded="expanded" CustomToggle="true">
|
|
<FluentNavLink Href="/" Match="NavLinkMatch.All" Icon="@(new Size20.Home())" IconColor="Color.Accent">Home</FluentNavLink>
|
|
<FluentNavLink Href="transactions" Icon="@(new Size20.NumberSymbolSquare())" IconColor="Color.Accent">Transaktionen</FluentNavLink>
|
|
<FluentNavLink Href="banktransactions" Icon="@(new Size20.BuildingBank())" IconColor="Color.Accent">Bank Transaktionen</FluentNavLink>
|
|
<FluentNavLink Href="electricity" Icon="@(new Size20.Flash())" IconColor="Color.Accent">Strom</FluentNavLink>
|
|
<FluentNavGroup Title="Stammdaten" Icon="@(new Size32.BookDatabase())">
|
|
<FluentNavLink Href="bookingrules" Icon="@(new Size20.Check())" IconColor="Color.Accent">Buchungsregeln</FluentNavLink>
|
|
<FluentNavLink Href="bookingtexts" Icon="@(new Size32.Text())" IconColor="Color.Accent">Buchungstexte</FluentNavLink>
|
|
<FluentNavLink Href="Classes" Icon="@(new Icons.Filled.Size20.Class())" IconColor="Color.Accent">Klassen</FluentNavLink>
|
|
<FluentNavLink Href="Accounts" Icon="@(new Size20.PersonAccounts())" IconColor="Color.Accent">Konten</FluentNavLink>
|
|
<FluentNavLink Href="json-editor" Icon="@(new Size20.Code())" IconColor="Color.Accent">JSON-Editor</FluentNavLink>
|
|
<FluentNavLink Href="text-cleanup" Icon="@(new Size20.TextEditStyle())" IconColor="Color.Accent">Texte bereinigen</FluentNavLink>
|
|
</FluentNavGroup>
|
|
<FluentNavGroup Title="Charts" Icon="@(new Size32.ChartMultiple())">
|
|
<FluentNavLink Href="analytics" Icon="@(new Size20.DataHistogram())" IconColor="Color.Accent">Analyse</FluentNavLink>
|
|
</FluentNavGroup>
|
|
<FluentNavGroup Title="Reports" Icon="@(new Size32.DocumentPrint())">
|
|
<FluentNavLink Href="ProfitLossReport" Icon="@(new Size32.DataTrending())" IconColor="Color.Accent">Erfolgsrechnung</FluentNavLink>
|
|
<FluentNavLink Href="DetailReport" Icon="@(new Size32.Feed())" IconColor="Color.Accent">Detailaufstellung</FluentNavLink>
|
|
<FluentNavLink Href="BalanceReport" Icon="@(new Size32.Feed())" IconColor="Color.Accent">Bilanz</FluentNavLink>
|
|
<FluentNavLink Href="BalanceSheetReport" Icon="@(new Size32.Receipt())" IconColor="Color.Accent">Jahresabschluss</FluentNavLink>
|
|
</FluentNavGroup>
|
|
</FluentNavMenu>
|
|
</nav>
|
|
</div>
|
|
|
|
@code {
|
|
// Below this width the expanded menu would take half the screen, so it starts collapsed
|
|
// (icons only); the toggle still opens it.
|
|
private const int CollapseBelowWidth = 700;
|
|
|
|
private bool expanded = true;
|
|
|
|
[Inject]
|
|
private IJSRuntime js { get; set; } = null!;
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender == false)
|
|
{
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
await using var viewport = await js.InvokeAsync<IJSObjectReference>("import", "./js/viewport.js");
|
|
if (await viewport.InvokeAsync<int>("width") < CollapseBelowWidth)
|
|
{
|
|
expanded = false;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
catch (JSDisconnectedException)
|
|
{
|
|
// Circuit gone before the first render finished; nothing to adjust.
|
|
}
|
|
}
|
|
} |