AccountingNext/Schaad.Accounting.UI/Components/Pages/BankTransactions.razor.cs
Claudio Schaad 0c48539ce6 PR U-9: FluentSearch filter on grid pages
Accounts, BookingRules, BookingTexts, BankTransactions each get an
<FluentSearch> above the grid, backed by a computed Filtered
IQueryable over an in-memory source list. FluentSearch is Immediate,
so filtering happens on each keystroke; data sizes are small enough
for per-render LINQ.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-07-04 10:10:43 +02:00

29 lines
1.1 KiB
C#

using Microsoft.AspNetCore.Components;
using Schaad.Accounting.Interfaces;
using Schaad.Accounting.Models;
namespace Schaad.Accounting.UI.Components.Pages;
public partial class BankTransactions : ComponentBase
{
[Inject]
private IBankTransactionRepository bankTransactionRepository { get; set; } = null!;
private IReadOnlyList<BankTransaction> source = [];
private string filter = "";
private IQueryable<BankTransaction> Filtered =>
string.IsNullOrWhiteSpace(filter)
? source.AsQueryable()
: source.AsQueryable().Where(t =>
(t.Text != null && t.Text.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(t.Debtor != null && t.Debtor.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
(t.Creditor != null && t.Creditor.Contains(filter, StringComparison.OrdinalIgnoreCase)) ||
t.Value.ToString().Contains(filter));
protected override async Task OnInitializedAsync()
{
source = await bankTransactionRepository.GetBankTransactionListAsync();
await base.OnInitializedAsync();
}
}