feat(entries): search and sort bookings with explicit result totals (U15)
This commit is contained in:
@@ -1,3 +1,19 @@
|
||||
<div class="entry-filters">
|
||||
<div><label for="entry-search">Buchungen suchen</label>
|
||||
<input id="entry-search" type="search" class="form-control" @bind="searchText" @bind:event="oninput" placeholder="Beschreibung, Nummer, Datum oder Betrag" /></div>
|
||||
<div><label for="entry-sort">Sortierung</label>
|
||||
<select id="entry-sort" @bind="sort">
|
||||
<option value="date-asc">Datum: älteste zuerst</option><option value="date-desc">Datum: neueste zuerst</option>
|
||||
<option value="amount-asc">Betrag: aufsteigend</option><option value="amount-desc">Betrag: absteigend</option>
|
||||
<option value="title">Beschreibung: A–Z</option>
|
||||
</select></div>
|
||||
<button type="button" class="btn btn-outline-secondary filter-reset" @onclick="ResetFilters">Filter zurücksetzen</button>
|
||||
</div>
|
||||
@if (!string.IsNullOrWhiteSpace(searchText))
|
||||
{
|
||||
<p class="search-summary" role="status">@VisibleEntries.Count Treffer. Summe der wirksamen Treffer: @ResultSum.ToString("N2", System.Globalization.CultureInfo.GetCultureInfo("de-DE")) €.
|
||||
Der Kontostand des gewählten Zeitraums oben bleibt unverändert.</p>
|
||||
}
|
||||
@if (Entries.Any(e => e.IsDeleted))
|
||||
{
|
||||
<label class="history-toggle"><input type="checkbox" @bind="showDeleted" /> Gelöschte Buchungen anzeigen (@Entries.Count(e => e.IsDeleted))</label>
|
||||
@@ -24,6 +40,6 @@
|
||||
|
||||
@if (!VisibleEntries.Any())
|
||||
{
|
||||
<div class="text-center py-3 text-muted">@EmptyMessage</div>
|
||||
<div class="text-center py-3 text-muted">@(string.IsNullOrWhiteSpace(searchText) ? EmptyMessage : "Keine Treffer. Filter zurücksetzen zeigt wieder die Buchungen des gewählten Zeitraums.")</div>
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ namespace Duempelkas.App.Components.Accounts;
|
||||
public partial class EntryTable
|
||||
{
|
||||
private bool showDeleted;
|
||||
private IEnumerable<EntryDto> VisibleEntries => Entries.Where(e => !e.IsDeleted || showDeleted);
|
||||
private string searchText = string.Empty;
|
||||
private string sort = "date-asc";
|
||||
private List<EntryDto> VisibleEntries => Duempelkas.App.Services.EntryListQuery.Apply(Entries, searchText, showDeleted, sort);
|
||||
private decimal ResultSum => VisibleEntries.Where(e => !e.IsDeleted).Sum(Duempelkas.App.Services.EntryListQuery.SignedAmount);
|
||||
private void ResetFilters() { searchText = string.Empty; sort = "date-asc"; showDeleted = false; }
|
||||
[Parameter] public int? HighlightedEntryId { get; set; }
|
||||
[Parameter] public string EmptyMessage { get; set; } = "Keine Buchungen vorhanden.";
|
||||
#region Parameters
|
||||
|
||||
Reference in New Issue
Block a user