Files
duempelkas/src/Duempelkas.App/Pages/Dashboard.razor
T

142 lines
5.6 KiB
Plaintext
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.
@inject ToastService Toasts
@inject ReportingPeriod Period
@page "/"
@inject IAccountService AccountService
@inject IBackupService BackupService
@inject ISettingsService SettingsService
@inject IPdfStatementService PdfStatementService
@inject IFileSaveService FileSaveService
@inject IEntryService EntryService
@inject NavigationManager NavigationManager
<div class="container-fluid">
<OperationNotice Result="fileResult" />
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center flex-grow-1" style="min-width: 0;">
<h1 class="mb-0 mt-0 page-heading">
@DisplayClubName
<button class="btn-edit-pen" @onclick="() => showEditClubName = true" title="Vereinsname bearbeiten">
<i class="bi bi-pencil"></i>
</button>
</h1>
</div>
</div>
<div class="action-toolbar">
<button class="btn-nav btn-primary" @onclick="() => showAddAccount = true">
<i class="bi bi-plus-lg"></i><span>Neues Konto</span>
</button>
<button class="btn-nav btn-success" @onclick="HandleBackupAsync" disabled="@fileBusy">
<i class="bi bi-save"></i> <span>Sicherung<br /> erstellen</span>
</button>
<button class="btn-nav btn-dark" @onclick="HandleDashboardExportAsync" disabled="@fileBusy">
<i class="bi bi-file-earmark-pdf"></i> <span>Als PDF<br /> speichern</span>
</button>
<button class="btn btn-nav btn-primary" @onclick="OpenYearFilterDialog">
<i class="bi bi-funnel"></i><span>@GetFilterLabel()</span>
</button>
<button class="btn btn-nav btn-secondary" @onclick="ToggleThemeAsync" title="Farbmodus wechseln">
<i class="@ThemeButtonIconClass"></i><span>Modus<br />@ThemeButtonLabel</span>
</button>
<details class="more-actions">
<summary class="btn btn-nav btn-outline-secondary"><i class="bi bi-three-dots"></i><span>Weitere<br /> Aktionen</span></summary>
<button class="btn btn-warning mt-2" @onclick="HandleRestoreAsync" disabled="@fileBusy">
<i class="bi bi-arrow-counterclockwise"></i> Sicherung zurückspielen
</button>
</details>
</div>
@if (accounts != null && accounts.Any())
{
<div class="alert alert-secondary py-2 px-3 mb-3" role="status">
<strong>Summe aller Konten – @Period.Label:</strong>
<span class="ms-2 @(TotalClubBalance >= 0 ? "text-success" : "text-danger")">
@FormatCurrency(TotalClubBalance)
</span>
</div>
}
@if (accounts == null)
{
<div class="text-center py-5">
<div class="spinner-border" role="status"></div>
</div>
}
else if (!accounts.Any())
{
<div class="text-center py-5 text-muted">
<h4>Noch keine Konten vorhanden</h4>
<p>Erstelle dein erstes Konto, um loszulegen.</p>
<a class="btn btn-primary" href="einstieg">Kurze Einführung starten oder fortsetzen</a>
</div>
}
else
{
<AccountCardList Accounts="accounts" />
}
</div>
@if (showAddAccount)
{
<AddAccountDialog OnSave="HandleAccountCreated" OnCancel="() => showAddAccount = false" />
}
@if (showEditClubName)
{
<EditNameDialog CurrentName="@DisplayClubName" DialogTitle="Vereinsname bearbeiten" NameLabel="Vereinsname"
OnSave="HandleSaveClubName" OnCancel="() => showEditClubName = false" />
}
@if (!string.IsNullOrWhiteSpace(savedPdfPath))
{
<ConfirmDialog Title="PDF öffnen"
Message="Die PDF wurde gespeichert. Möchtest du sie jetzt öffnen?"
ConfirmText="Ja, öffnen"
CancelText="Nein"
ConfirmButtonClass="btn btn-primary"
ConfirmIconClass="bi bi-box-arrow-up-right"
OnConfirm="HandleOpenSavedPdf"
OnCancel="CancelOpenSavedPdf" />
}
@if (showRestoreConfirm)
{
<ConfirmDialog Title="Sicherung zurückspielen"
Message="Die Buchungen und Konten werden durch die gewählte Sicherung ersetzt. Vorher wird eine Rückfallsicherung erstellt. Vereinsname und Darstellung sind nicht enthalten. Möchtest du fortfahren?"
ConfirmText="Ja, wiederherstellen"
CancelText="Nein, abbrechen"
ConfirmButtonClass="btn btn-warning"
ConfirmIconClass="bi bi-arrow-counterclockwise"
OnConfirm="HandleConfirmRestore"
OnCancel="CancelRestoreConfirm" />
}
@if (showYearFilterDialog)
{
<ModalDialog Title="Jahr auswählen" OnCancel="CloseYearFilterDialog">
<h5>Filter auswählen</h5>
<p class="text-muted mb-3">Wähle ein Jahr oder alle Buchungen.</p>
<div class="filter-options-grid">
<button class="btn @(selectedYear.HasValue ? "btn-outline-secondary" : "btn-primary")" @onclick="() => SelectFilterYear(null)">
Alle Buchungen
</button>
@foreach (var year in availableYears)
{
<button class="btn @(selectedYear == year ? "btn-primary" : "btn-outline-secondary")" @onclick="() => SelectFilterYear(year)">
@year
</button>
}
</div>
<div class="d-flex justify-content-end mt-3">
<button class="btn btn-outline-secondary" @onclick="CloseYearFilterDialog">
<i class="bi bi-x-lg"></i> Schließen
</button>
</div>
</ModalDialog>
}