From 6ef18a1f742a9da39bff92eeffd1617119fd46e4 Mon Sep 17 00:00:00 2001 From: Servan42 Date: Thu, 24 Jul 2025 23:55:28 +0200 Subject: [PATCH 1/2] fix: error message in console for undefined filters on startup --- .../src/app/transactions/transactions.component.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BankingService.Api/ClientApp/src/app/transactions/transactions.component.ts b/BankingService.Api/ClientApp/src/app/transactions/transactions.component.ts index c928a4d..9d281a2 100644 --- a/BankingService.Api/ClientApp/src/app/transactions/transactions.component.ts +++ b/BankingService.Api/ClientApp/src/app/transactions/transactions.component.ts @@ -25,7 +25,13 @@ import { TransactionService } from '../services/transaction.service'; export class TransactionsComponent implements OnInit { transactions: Transaction[] = []; - filters: TransactionFilters | undefined; + filters: TransactionFilters = { + category: undefined, + type: undefined, + search: undefined, + startDate: undefined, + endDate: undefined, + }; constructor(private dbService: TransactionService) { } From 72ec3264832e50ca49a3d15b6a2c54c88dce4083 Mon Sep 17 00:00:00 2001 From: Servan42 Date: Thu, 24 Jul 2025 23:56:24 +0200 Subject: [PATCH 2/2] feat: Search feild is now accent insensitive --- .../src/app/pipe/filter-transactions.pipe.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/BankingService.Api/ClientApp/src/app/pipe/filter-transactions.pipe.ts b/BankingService.Api/ClientApp/src/app/pipe/filter-transactions.pipe.ts index 9684851..03ab0f1 100644 --- a/BankingService.Api/ClientApp/src/app/pipe/filter-transactions.pipe.ts +++ b/BankingService.Api/ClientApp/src/app/pipe/filter-transactions.pipe.ts @@ -17,11 +17,12 @@ export class FilterTransactionsPipe implements PipeTransform { const search = filters.search; if (search !== undefined && search !== '') { + const normalizedSearch = this.normalize(search); newTransactions = newTransactions.filter( (x) => - x.label.toLowerCase().includes(search.toLowerCase()) || - x.comment.toLowerCase().includes(search.toLowerCase()) || - x.autoComment.toLowerCase().includes(search.toLowerCase()) + this.normalize(x.label).includes(normalizedSearch) || + this.normalize(x.comment).includes(normalizedSearch) || + this.normalize(x.autoComment).includes(normalizedSearch) ); } @@ -43,4 +44,8 @@ export class FilterTransactionsPipe implements PipeTransform { return newTransactions; } + + private normalize (str: string) { + return str.normalize('NFD').replace(/[\u0300-\u036f]/g, '').toLowerCase(); + } }