AccountingNext/Schaad.Accounting.UI/Components/Pages/Water.razor
Claudio Schaad 1e9e19ebad Add "Wasser" page for the water bills
Same layout as the Strom page: grid and dialog for the bills (warm and
cold water in m3 and CHF, base costs; total m3 and CHF are computed),
stored per mandator in water.json, and charts for consumption and total
costs with the period toggle (bill, calendar year, half-year).

The period grouping is now generic: ElectricityPeriod becomes
BillPeriod<T> over IPeriodBill<T>, implemented by ElectricityBill and
WaterBill. water.json can be edited in the JSON editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 20:56:18 +01:00

67 lines
4 KiB
Text

@page "/water"
@rendermode InteractiveServer
@using Schaad.Accounting.UI.Components.Pages.Analytics
<PageTitle>Wasser</PageTitle>
<div class="water">
<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="@($"Warm- und Kaltwasserverbrauch {PerPeriod}, gestapelte Balken in m³")" />
</FluentCard>
<FluentCard class="chart-card">
<div class="card-title">Gesamtkosten @PerPeriod</div>
<ChartJsChart Kind="line" Data="@costData" Height="360px"
AriaLabel="@($"Gesamtkosten {PerPeriod}")" />
</FluentCard>
</div>
}
<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="Warmwasser m³" Property="@(p => p.WarmWaterM3)" Format="#,0.00" Align="Align.End" />
<PropertyColumn Title="Kaltwasser m³" Property="@(p => p.ColdWaterM3)" Format="#,0.00" Align="Align.End" />
<PropertyColumn Title="Total m³" Property="@(p => p.TotalM3)" Format="#,0.00" Align="Align.End" />
<PropertyColumn Title="Warmwasser-Anteil" Property="@(p => p.WarmWaterShare)" Format="P1" Align="Align.End" />
<PropertyColumn Title="Warmwasser CHF" Property="@(p => p.WarmWaterChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Kaltwasser CHF" Property="@(p => p.ColdWaterChf)" Format="C2" Align="Align.End" />
<PropertyColumn Title="Grundkosten" Property="@(p => p.BaseCostsChf)" 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>