AccountingNext/Schaad.Accounting.UI/Components/Pages/Dialogs/WaterHeatingBillDialog.razor
Claudio Schaad 24dc89d5fb Wasser & Heizung: align labels and inputs in the dialog
Fields sit in a two-column grid with a fixed label width, so labels and inputs line up across all sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 19:40:32 +01:00

111 lines
5.5 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@implements IDialogContentComponent<Schaad.Accounting.Models.WaterHeatingBill>
@rendermode InteractiveServer
@using Schaad.Accounting.Models
<FluentDialogHeader ShowDismiss="true">
<FluentStack VerticalAlignment="VerticalAlignment.Center">
<FluentIcon Value="@(new Icons.Regular.Size24.WindowApps())" />
<FluentLabel Typo="Typography.PaneHeader">
@Dialog.Instance.Parameters.Title
</FluentLabel>
</FluentStack>
</FluentDialogHeader>
<FluentDialogBody>
<EditForm EditContext="@editContext">
<DataAnnotationsValidator />
<div class="fields">
<div class="field"><FluentDatePicker @bind-Value="@periodFrom" @bind-Value:after="SyncPeriod" Label="Von" /></div>
<div class="field"><FluentDatePicker @bind-Value="@periodTo" @bind-Value:after="SyncPeriod" Label="Bis" /></div>
</div>
<div style="@SectionStyle">NeoVac – Ablesequittung</div>
<div class="fields">
<div class="field"><FluentNumberField @bind-Value="@Content.WarmWaterM3" @bind-Value:after="Content.CalculateCosts" Label="Warmwasser (m³)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.ColdWaterM3" @bind-Value:after="Content.CalculateCosts" Label="Kaltwasser (m³)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.HeatingMwh" Label="Wärme (MWh)" /></div>
</div>
<div style="@SectionStyle">NeoVac – Anteil (‰)</div>
<div class="fields">
<div class="field"><FluentNumberField @bind-Value="@Content.WaterBasePermille" @bind-Value:after="Content.CalculateCosts" Label="Wasser Grund (‰)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.WaterConsumptionPermille" @bind-Value:after="Content.CalculateCosts" Label="Wasser Verbrauch (‰)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.HeatingPermille" @bind-Value:after="Content.CalculateCosts" Label="Heizung total (‰)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.WarmWaterHeatingPermille" @bind-Value:after="Content.CalculateCosts" Label="Heizung WW (‰)" /></div>
</div>
<div style="@SectionStyle">Verwaltung – Ihr Anteil</div>
<div class="fields">
<div class="field"><FluentNumberField @bind-Value="@Content.WaterCostsChf" @bind-Value:after="Content.CalculateCosts" Label="Wasserkosten (CHF)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.HeatingCostsChf" @bind-Value:after="Content.CalculateCosts" Label="Heizkosten (CHF)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.ManagerWaterPermille" Label="Wasser (‰, optional)" /></div>
<div class="field"><FluentNumberField @bind-Value="@Content.ManagerHeatingPermille" Label="Heizung (‰, optional)" /></div>
</div>
<div>
<FluentValidationSummary />
</div>
</EditForm>
<div style="margin-top: 12px; font-size: 13px; color: #52514e;">
Wasser: Grundkosten <strong>@Chf(Content.BaseCostsChf)</strong>
· Warmwasser <strong>@Chf(Content.WarmWaterChf)</strong>
· Kaltwasser <strong>@Chf(Content.ColdWaterChf)</strong>
</div>
<div style="margin-top: 4px; font-size: 13px; color: #52514e;">
Heizung: Warmwasser <strong>@Chf(Content.WarmWaterHeatingChf)</strong>
· Räume <strong>@Chf(Content.RoomHeatingChf)</strong>
</div>
<div style="margin-top: 4px; font-size: 13px; color: #52514e;">
Total <strong>@M3(Content.TotalM3)</strong> · <strong>@Mwh(Content.HeatingMwh)</strong> · <strong>@Chf(Content.TotalChf)</strong>
</div>
@if (Checks is { Count: > 0 } checks)
{
<div style="@SectionStyle">Kontrolle</div>
@foreach (var check in checks)
{
<div style="font-size: 13px; color: @CheckColor(check.Result);">@CheckSymbol(check.Result) @check.Text</div>
}
}
<FluentButton Appearance="Appearance.Lightweight" Style="margin-top: 12px; padding: 0; font-size: 13px;" OnClick="ShowGuideAsync">
Woher kommen die Werte? (NeoVac-Abrechnung)
</FluentButton>
</FluentDialogBody>
<FluentDialogFooter>
<FluentButton Appearance="Appearance.Neutral"
OnClick="@CancelAsync">
Abbrechen
</FluentButton>
<FluentButton Appearance="Appearance.Accent"
Disabled="@(periodFrom is null || periodTo is null)"
OnClick="@SaveAsync">
Speichern
</FluentButton>
</FluentDialogFooter>
@code {
private const string SectionStyle = "margin-top: 14px; margin-bottom: 4px; font-size: 11px; font-weight: bold; color: #898781; text-transform: uppercase;";
// Shown in its own dialog (see ShowGuideAsync) instead of expanding inline: this dialog has a
// fixed Height, and FluentDialogBody doesn't resize to fit growing content.
private RenderFragment GuideImage =>
@<img src="/images/water-heating-bill-guide.svg"
alt="Beispiel-Abrechnung mit Markierungen, welcher Wert in welches Feld gehört"
style="width: 100%; height: auto; display: block;" />;
private static string CheckSymbol(BillCheckResult result) => result switch
{
BillCheckResult.Ok => "✓",
BillCheckResult.Warning => "⚠",
_ => "·"
};
private static string CheckColor(BillCheckResult result) => result switch
{
BillCheckResult.Ok => "#1a7f37",
BillCheckResult.Warning => "#c4314b",
_ => "#52514e"
};
}