feat(usability): preserve reporting year and locate outside-period bookings (U04)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user