Savings account status and substatus management (#1606)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2022-12-26 23:38:53 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent d0dc2aabb2
commit e2fbfc9c2f
23 changed files with 215 additions and 125 deletions
@@ -12,9 +12,9 @@ export class SavingsButtonsConfiguration {
taskPermissionName: string,
}[];
constructor(status: string) {
constructor(status: string, substatus: any) {
this.setOptions(status);
this.setButtons(status);
this.setButtons(status, substatus);
}
get singleButtons() {
@@ -25,36 +25,60 @@ export class SavingsButtonsConfiguration {
return this.optionArray;
}
setButtons(status: string) {
setButtons(status: string, substatus: any) {
switch (status) {
case 'Active':
this.buttonsArray = [
this.buttonsArray = [];
if (!substatus.block) {
if (!substatus.blockCredit) {
this.buttonsArray.push(
{
name: 'Deposit',
icon: 'arrow-up',
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
}
);
}
if (!substatus.blockDebit) {
this.buttonsArray.push(
{
name: 'Withdrawal',
icon: 'arrow-down',
taskPermissionName: 'WITHDRAWAL_SAVINGSACCOUNT'
}
);
}
this.buttonsArray = this.buttonsArray.concat([
{
name: 'Block Account',
icon: 'lock',
taskPermissionName: 'BLOCK_SAVINGSACCOUNT'
},
{
name: 'Hold Amount',
icon: 'lock',
taskPermissionName: 'HOLDAMOUNT_SAVINGSACCOUNT'
},
{
name: 'Calculate Interest',
icon: 'table',
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
},
{
name: 'Post Interest As On',
icon: 'arrow-right',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
},
]);
} else {
this.buttonsArray = [
{
name: 'Deposit',
icon: 'arrow-up',
taskPermissionName: 'DEPOSIT_SAVINGSACCOUNT'
},
{
name: 'Withdraw',
icon: 'arrow-down',
taskPermissionName: 'WITHDRAW_SAVINGSACCOUNT'
},
{
name: 'Hold Amount',
icon: 'lock',
taskPermissionName: 'HOLDAMOUNT_SAVINGSACCOUNT'
},
{
name: 'Calculate Interest',
icon: 'table',
taskPermissionName: 'CALCULATEINTEREST_SAVINGSACCOUNT'
},
{
name: 'Post Interest As On',
icon: 'arrow-right',
taskPermissionName: 'POSTINTEREST_SAVINGSACCOUNT',
},
];
name: 'Unblock Account',
icon: 'lock-open',
taskPermissionName: 'UNBLOCK_SAVINGSACCOUNT'
}
];
}
break;
case 'Submitted and pending approval':
this.buttonsArray = [