AccountingNext/Schaad.Accounting.UI/Components/Pages/Electricity.razor
Claudio Schaad dee1e0dde0 Strom page: toggle charts between bill, calendar year and half-year (#10)
Co-authored-by: Claudio Schaad <c.schaad@pog.ch>
Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
2026-10-30 19:07:54 +00:00

73 lines
4.2 KiB
Text

@page "/electricity"
@rendermode InteractiveServer
@using Schaad.Accounting.UI.Components.Pages.Analytics
<PageTitle>Strom</PageTitle>
<div class="electricity">
<FluentStack Orientation="Orientation.Horizontal" VerticalAlignment="VerticalAlignment.Center">
<FluentButton IconStart="@(new Icons.Regular.Size16.Add())" Appearance="Appearance.Neutral" OnClick="AddAsync">Neue Abrechnung hinzufügen</FluentButton>
</FluentStack>
@if (source.Count == 0)
{
<FluentMessageBar Intent="MessageIntent.Info" AllowDismiss="false">Noch keine Abrechnungen erfasst.</FluentMessageBar>
}
else
{
<FluentStack Orientation="Orientation.Horizontal" VerticalAlignment="VerticalAlignment.Center" Wrap="true">
<div class="segmented" role="group" aria-label="Zeitraum">
@foreach (var kind in PeriodKinds)
{
<FluentButton Appearance="@(kind == periodKind ? Appearance.Accent : Appearance.Neutral)"
aria-pressed="@(kind == periodKind ? "true" : "false")"
OnClick="@(() => SetPeriodKind(kind))">@PeriodKindName(kind)</FluentButton>
}
</div>
@if (isSplit)
{
<span class="split-note">Werte anteilig auf die Monate der Abrechnungsperiode verteilt</span>
}
</FluentStack>
<div class="pair">
<FluentCard class="chart-card">
<div class="card-title">Verbrauch @PerPeriod</div>
<ChartJsChart Kind="stackedBar" Data="@barData" Height="360px"
AriaLabel="@($"Netzbezug und PV-Produktion {PerPeriod}, gestapelte Balken in kWh")" />
</FluentCard>
<FluentCard class="chart-card">
<div class="card-title">Preis pro kWh</div>
<ChartJsChart Kind="line" Data="@lineData" Height="360px"
AriaLabel="@($"Preis pro kWh für Netz, PV und Total {PerPeriod}")" />
</FluentCard>
</div>
<FluentCard class="chart-card">
<div class="card-title">Gesamtkosten @PerPeriod</div>
<ChartJsChart Kind="line" Data="@costData" Height="320px"
AriaLabel="@($"Gesamtkosten {PerPeriod}")" />
</FluentCard>
}
<div class="table-scroll">
<FluentDataGrid Items="@source.AsQueryable()" RowSize="DataGridRowSize.Medium">
<PropertyColumn Title="Von" Property="@(p => p.PeriodFrom)" Format="dd.MM.yyyy" Sortable="true" IsDefaultSortColumn="true" InitialSortDirection="SortDirection.Descending" />
<PropertyColumn Title="Bis" Property="@(p => p.PeriodTo)" Format="dd.MM.yyyy" Sortable="true" />
<PropertyColumn Title="Netz kWh" Property="@(p => p.GridKwh)" Format="#,0.0" Align="Align.End" />
<PropertyColumn Title="PV kWh" Property="@(p => p.PvKwh)" Format="#,0.0" Align="Align.End" />
<PropertyColumn Title="Total kWh" Property="@(p => p.TotalKwh)" Format="#,0.0" Align="Align.End" />
<PropertyColumn Title="PV-Anteil" Property="@(p => p.PvShare)" Format="P1" Align="Align.End" />
<PropertyColumn Title="Netz CHF" Property="@(p => p.GridChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="PV CHF" Property="@(p => p.PvChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Nebenkosten" Property="@(p => p.SideCostsChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Total CHF" Property="@(p => p.TotalChf)" Format="C2" Align="Align.End" />
<TemplateColumn Align="Align.Center" Width="50px">
<FluentButton IconEnd="@(new Icons.Regular.Size16.Delete())" Appearance="Appearance.Neutral" title="Löschen" aria-label="Löschen" OnClick="@(() => DeleteAsync(context.Id))" />
</TemplateColumn>
<TemplateColumn Align="Align.Center" Width="50px">
<FluentButton IconEnd="@(new Icons.Regular.Size16.Edit())" Appearance="Appearance.Neutral" title="Bearbeiten" aria-label="Bearbeiten" OnClick="@(() => EditAsync(context.Id))" />
</TemplateColumn>
</FluentDataGrid>
</div>
</div>