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
@@ -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();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user