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(); + } } 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) { }