feat(usability): preserve reporting year and locate outside-period bookings (U04)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
@inject ReportingPeriod Period
|
||||
@page "/accounts/{AccountId:int}"
|
||||
@inject IAccountService AccountService
|
||||
@inject IEntryService EntryService
|
||||
@@ -10,6 +11,13 @@
|
||||
<OperationNotice Result="fileResult" />
|
||||
@if (fileBusy) { <p role="status" aria-live="polite">Dateiaktion läuft … Bitte warten.</p> }
|
||||
|
||||
@if (savedOutsideYear.HasValue)
|
||||
{
|
||||
<div class="alert alert-info" role="status">
|
||||
Die Buchung wurde im Jahr @savedOutsideYear gespeichert und liegt außerhalb der aktuellen Ansicht.
|
||||
<button class="btn btn-outline-primary" @onclick="ShowSavedYear">Buchung im Jahr @savedOutsideYear anzeigen</button>
|
||||
</div>
|
||||
}
|
||||
@if (account == null)
|
||||
{
|
||||
<div class="text-center py-5">
|
||||
@@ -43,10 +51,11 @@
|
||||
</button>
|
||||
|
|
||||
<button class="btn btn-nav btn-primary" @onclick="OpenYearFilterDialog">
|
||||
<i class="bi bi-funnel"></i> Ansicht<br>@GetFilterLabel()
|
||||
<i class="bi bi-funnel"></i> @GetFilterLabel()
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p class="text-muted">Zeitraum für Liste und Summen: @Period.Label</p>
|
||||
@if (balance != null)
|
||||
{
|
||||
<div class="summary-section">
|
||||
@@ -96,7 +105,7 @@
|
||||
@if (entries != null)
|
||||
{
|
||||
<div class="entries-scroll-wrapper">
|
||||
<EntryTable Entries="entries" OnDeleteEntry="RequestDeleteEntry" OnRestoreEntry="RequestRestoreEntry" OnEditEntry="RequestEditEntry" />
|
||||
<EntryTable Entries="entries" EmptyMessage="emptyEntriesMessage" OnDeleteEntry="RequestDeleteEntry" OnRestoreEntry="RequestRestoreEntry" OnEditEntry="RequestEditEntry" />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@@ -104,14 +113,14 @@
|
||||
|
||||
@if (showAddEntry)
|
||||
{
|
||||
<AddEntryDialog AccountId="AccountId"
|
||||
<AddEntryDialog AccountId="AccountId" ContextYear="selectedYear"
|
||||
OnSave="HandleEntryCreated"
|
||||
OnCancel="() => showAddEntry = false" />
|
||||
}
|
||||
|
||||
@if (showAddTransfer)
|
||||
{
|
||||
<AddTransferDialog SourceAccountId="AccountId"
|
||||
<AddTransferDialog SourceAccountId="AccountId" ContextYear="selectedYear"
|
||||
OnSave="HandleTransferCreated"
|
||||
OnCancel="() => showAddTransfer = false" />
|
||||
}
|
||||
@@ -168,7 +177,7 @@
|
||||
|
||||
@if (editingEntry != null)
|
||||
{
|
||||
<AddEntryDialog AccountId="AccountId"
|
||||
<AddEntryDialog AccountId="AccountId" ContextYear="selectedYear"
|
||||
EditEntry="editingEntry"
|
||||
OnSave="HandleEntryEdited"
|
||||
OnCancel="() => editingEntry = null" />
|
||||
@@ -176,7 +185,7 @@
|
||||
|
||||
@if (editingTransferEntry != null)
|
||||
{
|
||||
<AddTransferDialog SourceAccountId="AccountId"
|
||||
<AddTransferDialog SourceAccountId="AccountId" ContextYear="selectedYear"
|
||||
EditEntry="editingTransferEntry"
|
||||
OnSave="HandleEntryEdited"
|
||||
OnCancel="() => editingTransferEntry = null" />
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class AccountDetail
|
||||
private bool showEditName;
|
||||
private bool showEditCarryover;
|
||||
private bool showYearFilterDialog;
|
||||
private int? selectedYear = DateTime.Now.Year;
|
||||
private int? selectedYear { get => Period.Year; set => Period.Year = value; }
|
||||
private List<int> availableYears = [];
|
||||
|
||||
private int? confirmDeleteEntryId;
|
||||
@@ -35,6 +35,8 @@ public partial class AccountDetail
|
||||
private FileOperationResult? fileResult;
|
||||
private bool fileBusy;
|
||||
|
||||
private int? savedOutsideYear;
|
||||
private string emptyEntriesMessage = "Noch keine Buchungen vorhanden.";
|
||||
private EntryDto? editingEntry;
|
||||
private EntryDto? editingTransferEntry;
|
||||
|
||||
@@ -62,7 +64,9 @@ public partial class AccountDetail
|
||||
account = await AccountService.GetAccountAsync(AccountId);
|
||||
balance = await BalanceQueryService.GetAccountBalanceAsync(AccountId, selectedYear);
|
||||
entries = await EntryService.GetEntriesAsync(AccountId, selectedYear);
|
||||
availableYears = await EntryService.GetEntryYearsAsync(AccountId);
|
||||
var entryYears = await EntryService.GetEntryYearsAsync(AccountId);
|
||||
availableYears = Period.Choices(entryYears);
|
||||
emptyEntriesMessage = entryYears.Count == 0 ? "Noch keine Buchungen vorhanden." : "Keine Buchungen in diesem Zeitraum. Wähle ein anderes Jahr oder Alle Jahre.";
|
||||
}
|
||||
|
||||
private void OpenYearFilterDialog()
|
||||
@@ -78,6 +82,7 @@ public partial class AccountDetail
|
||||
private async Task SelectFilterYear(int? year)
|
||||
{
|
||||
selectedYear = year;
|
||||
savedOutsideYear = null;
|
||||
showYearFilterDialog = false;
|
||||
await LoadAll();
|
||||
}
|
||||
@@ -100,18 +105,22 @@ public partial class AccountDetail
|
||||
await LoadAll();
|
||||
}
|
||||
|
||||
private async Task HandleEntryCreated()
|
||||
private async Task HandleEntryCreated(DateTime savedDate)
|
||||
{
|
||||
savedOutsideYear = selectedYear.HasValue && selectedYear.Value != savedDate.Year ? savedDate.Year : null;
|
||||
showAddEntry = false;
|
||||
await LoadAll();
|
||||
}
|
||||
|
||||
private async Task HandleTransferCreated()
|
||||
private async Task HandleTransferCreated(DateTime savedDate)
|
||||
{
|
||||
savedOutsideYear = selectedYear.HasValue && selectedYear.Value != savedDate.Year ? savedDate.Year : null;
|
||||
showAddTransfer = false;
|
||||
await LoadAll();
|
||||
}
|
||||
|
||||
private Task ShowSavedYear() => SelectFilterYear(savedOutsideYear);
|
||||
|
||||
private void RequestDeleteEntry(int entryId)
|
||||
{
|
||||
confirmDeleteEntryId = entryId;
|
||||
@@ -171,8 +180,9 @@ public partial class AccountDetail
|
||||
}
|
||||
}
|
||||
|
||||
private async Task HandleEntryEdited()
|
||||
private async Task HandleEntryEdited(DateTime savedDate)
|
||||
{
|
||||
savedOutsideYear = selectedYear.HasValue && selectedYear.Value != savedDate.Year ? savedDate.Year : null;
|
||||
editingEntry = null;
|
||||
editingTransferEntry = null;
|
||||
await LoadAll();
|
||||
@@ -226,7 +236,7 @@ public partial class AccountDetail
|
||||
|
||||
private static string FormatAmount(decimal amount) => $"{amount:N2} €";
|
||||
|
||||
private string GetFilterLabel() => selectedYear?.ToString() ?? "Alle";
|
||||
private string GetFilterLabel() => Period.Label;
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@inject ReportingPeriod Period
|
||||
@page "/"
|
||||
@inject IAccountService AccountService
|
||||
@inject IBackupService BackupService
|
||||
@@ -40,7 +41,7 @@
|
||||
</button>
|
||||
|
|
||||
<button class="btn btn-nav btn-primary" @onclick="OpenYearFilterDialog">
|
||||
<i class="bi bi-funnel"></i> Ansicht<br>@GetFilterLabel()
|
||||
<i class="bi bi-funnel"></i> @GetFilterLabel()
|
||||
</button>
|
||||
<button class="btn btn-nav btn-secondary" @onclick="ToggleThemeAsync" title="Farbmodus wechseln">
|
||||
<i class="@ThemeButtonIconClass"></i> Modus<br>@ThemeButtonLabel
|
||||
@@ -50,7 +51,7 @@
|
||||
@if (accounts != null && accounts.Any())
|
||||
{
|
||||
<div class="alert alert-secondary py-2 px-3 mb-3" role="status">
|
||||
<strong>Summe aller Konten:</strong>
|
||||
<strong>Summe aller Konten – @Period.Label:</strong>
|
||||
<span class="ms-2 @(TotalClubBalance >= 0 ? "text-success" : "text-danger")">
|
||||
@FormatCurrency(TotalClubBalance)
|
||||
</span>
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class Dashboard
|
||||
private bool showEditClubName;
|
||||
private bool showRestoreConfirm;
|
||||
private bool showYearFilterDialog;
|
||||
private int? selectedYear = DateTime.Now.Year;
|
||||
private int? selectedYear { get => Period.Year; set => Period.Year = value; }
|
||||
private List<int> availableYears = [];
|
||||
private string clubName = string.Empty;
|
||||
private string? savedPdfPath;
|
||||
@@ -67,7 +67,7 @@ public partial class Dashboard
|
||||
private async Task LoadAll()
|
||||
{
|
||||
await LoadAccounts();
|
||||
availableYears = await EntryService.GetAllEntryYearsAsync();
|
||||
availableYears = Period.Choices(await EntryService.GetAllEntryYearsAsync());
|
||||
}
|
||||
|
||||
private async Task LoadAccounts()
|
||||
@@ -207,7 +207,7 @@ public partial class Dashboard
|
||||
return amount.ToString("N2", CultureInfo.GetCultureInfo("de-DE")) + " €";
|
||||
}
|
||||
|
||||
private string GetFilterLabel() => selectedYear?.ToString() ?? "Alle";
|
||||
private string GetFilterLabel() => Period.Label;
|
||||
|
||||
private string ThemeButtonLabel => currentTheme == "dark" ? "Hell" : "Dunkel";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user