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
@@ -4,7 +4,6 @@
<h2 mat-title *ngIf="transactionType.holdamount">Hold Amount</h2>
<h2 mat-title *ngIf="transactionType.blockaccount">Block Savings Account</h2>
<h2 mat-title *ngIf="transactionType.unblockaccount">Unblock Savings Account</h2>
<form [formGroup]="manageSavingsAccountForm" (ngSubmit)="submit()">
@@ -27,10 +27,10 @@ export class ManageSavingsAccountComponent implements OnInit {
transactionType: {
holdamount: boolean,
blockaccount: boolean,
unblockaccount: boolean
blockaccount: boolean
} = {
holdamount: false, blockaccount: false, unblockaccount: false };
holdamount: false, blockaccount: false
};
/**
* @param {FormBuilder} formBuilder Form Builder
@@ -41,12 +41,12 @@ export class ManageSavingsAccountComponent implements OnInit {
* @param {SettingsService} settingsService Setting service
*/
constructor(private formBuilder: FormBuilder,
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private systemService: SystemService,
private settingsService: SettingsService) {
private savingsService: SavingsService,
private dateUtils: Dates,
private route: ActivatedRoute,
private router: Router,
private systemService: SystemService,
private settingsService: SettingsService) {
this.transactionCommand = this.route.snapshot.params['name'].toLowerCase().replaceAll(' ', '');
this.transactionType[this.transactionCommand] = true;
this.savingAccountId = this.route.parent.snapshot.params['savingAccountId'];
@@ -83,15 +83,15 @@ export class ManageSavingsAccountComponent implements OnInit {
}
/**
* Creates the post interest savings account form.
* Creates the manage savings account form.
*/
createManageSavingsAccountForm() {
if (this.transactionType.holdamount) {
this.manageSavingsAccountForm = this.formBuilder.group({
'reasonForBlock': ['', Validators.required],
'transactionDate': ['', Validators.required],
'transactionAmount': [0.0, Validators.required]
});
this.manageSavingsAccountForm = this.formBuilder.group({
'reasonForBlock': ['', Validators.required],
'transactionDate': ['', Validators.required],
'transactionAmount': [0.0, Validators.required]
});
} else {
this.manageSavingsAccountForm = this.formBuilder.group({
'reasonForBlock': ['', Validators.required]
@@ -101,7 +101,7 @@ export class ManageSavingsAccountComponent implements OnInit {
submit() {
let command = '';
let payload = { };
let payload = {};
if (this.transactionType.holdamount) {
const manageSavingsAccountFormData = this.manageSavingsAccountForm.value;
@@ -119,7 +119,6 @@ export class ManageSavingsAccountComponent implements OnInit {
command = 'holdAmount';
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, command, payload).subscribe((response: any) => {
console.log(response);
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
} else {
@@ -131,7 +130,6 @@ export class ManageSavingsAccountComponent implements OnInit {
}
this.savingsService.executeSavingsAccountCommand(this.savingAccountId, command, payload).subscribe((response: any) => {
console.log(response);
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});
}
@@ -10,4 +10,4 @@
<mifosx-savings-transactions *ngIf="actions['Withdrawal'] || actions['Deposit']"></mifosx-savings-transactions>
<mifosx-close-savings-account *ngIf="actions['Close']"></mifosx-close-savings-account>
<mifosx-apply-annual-fees-savings-account *ngIf="actions['Apply Annual Fees']"></mifosx-apply-annual-fees-savings-account>
<mifosx-manage-savings-account *ngIf="actions['Hold Amount']"></mifosx-manage-savings-account>
<mifosx-manage-savings-account *ngIf="actions['Hold Amount'] || actions['Block Account']"></mifosx-manage-savings-account>