Savings account status and substatus management (#1606)
Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
d0dc2aabb2
commit
e2fbfc9c2f
@@ -15,7 +15,9 @@
|
||||
<mat-card-title fxLayout="row" fxLayout.lt-md="column">
|
||||
<h3 fxFlex="95%">
|
||||
<i class="fa fa-stop" [ngClass]="savingsAccountData.status.code | statusLookup"
|
||||
[matTooltip]="savingsAccountData.status.value"></i>
|
||||
[matTooltip]="savingsAccountData.status.value" *ngIf="!savingsAccountData.subStatus.block"></i>
|
||||
<i class="fa fa-stop" [ngClass]="savingsAccountData.subStatus.value | statusLookup"
|
||||
[matTooltip]="savingsAccountData.subStatus.value" *ngIf="savingsAccountData.subStatus.block"></i>
|
||||
Savings Product : {{savingsAccountData.savingsProductName}}<span class="m-l-10">({{savingsAccountData.accountNo}})</span>
|
||||
</h3>
|
||||
<div fxFlex="5%">
|
||||
@@ -53,7 +55,7 @@
|
||||
</button>
|
||||
</ng-container>
|
||||
|
||||
<ng-container *ngIf="buttonConfig.options">
|
||||
<ng-container *ngIf="buttonConfig.options && !savingsAccountData.subStatus.block">
|
||||
<button mat-menu-item [matMenuTriggerFor]="More">More</button>
|
||||
<mat-menu #More="matMenu">
|
||||
<span *ngFor="let option of buttonConfig.options">
|
||||
|
||||
@@ -12,6 +12,7 @@ import { ToggleWithholdTaxDialogComponent } from './custom-dialogs/toggle-withho
|
||||
/** Custom Buttons Configuration */
|
||||
import { SavingsButtonsConfiguration } from './savings-buttons.config';
|
||||
import { SavingsService } from '../savings.service';
|
||||
import { ConfirmationDialogComponent } from 'app/shared/confirmation-dialog/confirmation-dialog.component';
|
||||
|
||||
/**
|
||||
* Savings Account View Component
|
||||
@@ -64,7 +65,8 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
*/
|
||||
setConditionalButtons() {
|
||||
const status = this.savingsAccountData.status.value;
|
||||
this.buttonConfig = new SavingsButtonsConfiguration(status);
|
||||
const subStatus = this.savingsAccountData.subStatus;
|
||||
this.buttonConfig = new SavingsButtonsConfiguration(status, subStatus);
|
||||
if (this.savingsAccountData.clientId) {
|
||||
this.buttonConfig.addOption({
|
||||
name: 'Transfer Funds',
|
||||
@@ -108,7 +110,6 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Refetches data foe the component
|
||||
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
||||
@@ -137,7 +138,6 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
case 'Add Charge':
|
||||
case 'Hold Amount':
|
||||
case 'Block Account':
|
||||
case 'Unblock Account':
|
||||
case 'Unassign Staff':
|
||||
case 'Withdraw By Client':
|
||||
case 'Apply Annual Fees':
|
||||
@@ -168,6 +168,9 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
const queryParams: any = { savingsId: this.savingsAccountData.id, accountType: 'fromsavings' };
|
||||
this.router.navigate(['transfer-funds/make-account-transfer'], { relativeTo: this.route, queryParams: queryParams });
|
||||
break;
|
||||
case 'Unblock Account':
|
||||
this.unblockSavingsAccount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,4 +252,20 @@ export class SavingsAccountViewComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Unblock Savings Account.
|
||||
*/
|
||||
private unblockSavingsAccount() {
|
||||
const unblockSavingsAccountDialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
data: { heading: 'Unblock Savings Account', dialogContext: 'Are you sure you want Unblock this Savings Account' }
|
||||
});
|
||||
unblockSavingsAccountDialogRef.afterClosed().subscribe((response: { confirm: any }) => {
|
||||
if (response.confirm) {
|
||||
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, 'unblock', { })
|
||||
.subscribe(() => {
|
||||
this.reload();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
+9
-9
@@ -50,20 +50,20 @@
|
||||
{{ transactionData.date | dateFormat }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Currency
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.currency.displayLabel }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Amount
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.amount }}
|
||||
{{ transactionData.currency.displaySymbol }} {{ transactionData.amount | number }} ({{ transactionData.currency.code }})
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Currency
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ transactionData.currency.name }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
|
||||
Reference in New Issue
Block a user