diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
index e86155adf..0a00d97ef 100644
--- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
+++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.html
@@ -7,6 +7,8 @@
All Transactions
+
+ {{"labels.inputs.Hide Accruals" | translate}}
diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.scss b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.scss
index ae859ea89..83f2418c0 100644
--- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.scss
+++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.scss
@@ -14,6 +14,9 @@
padding: 0 0 3px 0;
margin: 0 10%;
line-height: 25px;
+ .accruals {
+ padding-top: 1%;
+ }
}
.select-row:hover {
cursor: pointer;
diff --git a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
index f85ddc409..8671528b6 100644
--- a/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
+++ b/src/app/savings/savings-account-view/transactions-tab/transactions-tab.component.ts
@@ -1,5 +1,6 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
+import { UntypedFormControl } from '@angular/forms';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
@@ -19,6 +20,10 @@ export class TransactionsTabComponent implements OnInit {
status: any;
/** Transactions Data */
transactionsData: any;
+ /** Temporary Transaction Data */
+ tempTransaction: any;
+ /** Form control to handle accural parameter */
+ hideAccrualsParam: UntypedFormControl;
/** Columns to be displayed in transactions table. */
displayedColumns: string[] = ['id', 'date', 'transactionType', 'debit', 'credit', 'balance', 'actions'];
/** Data source for transactions table. */
@@ -36,15 +41,30 @@ export class TransactionsTabComponent implements OnInit {
private router: Router) {
this.route.parent.parent.data.subscribe((data: { savingsAccountData: any }) => {
this.transactionsData = data.savingsAccountData.transactions?.filter((transaction: any) => !transaction.reversed);
+ this.tempTransaction = this.transactionsData;
this.status = data.savingsAccountData.status.value;
});
}
ngOnInit() {
+ this.hideAccrualsParam = new UntypedFormControl(false);
+ this.setTransactions();
+ }
+
+ setTransactions(): void {
this.dataSource = new MatTableDataSource(this.transactionsData);
this.accountWithTransactions = (this.transactionsData && this.transactionsData.length > 0);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
+ this.tempTransaction.forEach((element: any) => {
+ if (this.isAccrual(element.transactionType)) {
+ this.tempTransaction = this.removeItem(this.tempTransaction, element);
+ }
+ });
+ }
+
+ private removeItem(arr: any, item: any) {
+ return arr.filter((f: any) => f !== item);
}
/**
@@ -56,6 +76,10 @@ export class TransactionsTabComponent implements OnInit {
|| transactionType.overdraftInterest === true || transactionType.withholdTax === true;
}
+ isAccrual(transactionType: any): boolean {
+ return (transactionType.accrual || transactionType.code === 'savingsAccountTransactionType.accrual');
+ }
+
/**
* Checks transaction status.
*/
@@ -87,4 +111,12 @@ export class TransactionsTabComponent implements OnInit {
$event.stopPropagation();
}
+ hideAccruals() {
+ if (!this.hideAccrualsParam.value) {
+ this.dataSource = new MatTableDataSource(this.tempTransaction);
+ } else {
+ this.dataSource = new MatTableDataSource(this.transactionsData);
+ }
+ }
+
}