Fixed Deposit account view update (#1881)
Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
co-authored by
Jose Alberto Hernandez
parent
d92f6c1c5e
commit
c7fe21e74a
+1
-1
@@ -1,7 +1,7 @@
|
||||
<mifosx-approve-fixed-deposits-account *ngIf="actions['Approve']"></mifosx-approve-fixed-deposits-account>
|
||||
<mifosx-reject-fixed-deposits-account *ngIf="actions['Reject']"></mifosx-reject-fixed-deposits-account>
|
||||
<mifosx-activate-fixed-deposits-account *ngIf="actions['Activate']"></mifosx-activate-fixed-deposits-account>
|
||||
<mifosx-undo-approval-fixed-deposits-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-fixed-deposits-account>
|
||||
<mifosx-undo-approval-fixed-deposits-account *ngIf="actions['Undo Approval'] || actions['Undo Activation']"></mifosx-undo-approval-fixed-deposits-account>
|
||||
<mifosx-withdraw-by-client-fixed-deposits-account *ngIf="actions['Withdraw By Client']"></mifosx-withdraw-by-client-fixed-deposits-account>
|
||||
<mifosx-add-charge-fixed-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-fixed-deposits-account>
|
||||
<mifosx-premature-close-fixed-deposits-account *ngIf="actions['Premature Close']"></mifosx-premature-close-fixed-deposits-account>
|
||||
|
||||
+2
@@ -19,6 +19,7 @@ export class FixedDepositsAccountActionsComponent {
|
||||
'Activate': boolean
|
||||
'Close': boolean
|
||||
'Undo Approval': boolean
|
||||
'Undo Activation': boolean
|
||||
'Add Charge': boolean
|
||||
'Premature Close': boolean
|
||||
'Withdraw By Client': boolean
|
||||
@@ -28,6 +29,7 @@ export class FixedDepositsAccountActionsComponent {
|
||||
'Activate': false,
|
||||
'Close': false,
|
||||
'Undo Approval': false,
|
||||
'Undo Activation': false,
|
||||
'Add Charge': false,
|
||||
'Premature Close': false,
|
||||
'Withdraw By Client': false
|
||||
|
||||
+19
-3
@@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
/** Custom Services */
|
||||
import { SavingsService } from 'app/savings/savings.service';
|
||||
import { FixedDepositsService } from '../../fixed-deposits.service';
|
||||
|
||||
/**
|
||||
* Undo Approval Fixed Deposits Account Component
|
||||
@@ -20,6 +21,9 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
|
||||
undoApprovalFixedDepositsAccountForm: UntypedFormGroup;
|
||||
/** Fixed Deposits Account Id */
|
||||
accountId: any;
|
||||
/** Action to be Undo */
|
||||
undoAction: string;
|
||||
undoCommand: string;
|
||||
|
||||
/**
|
||||
* Fixed deposits endpoint is not supported so using Savings endpoint.
|
||||
@@ -30,8 +34,14 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
|
||||
*/
|
||||
constructor(private formBuilder: UntypedFormBuilder,
|
||||
private savingsService: SavingsService,
|
||||
private fixedDepositsService: FixedDepositsService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router) {
|
||||
this.undoCommand = 'undoapproval'; // Default command
|
||||
this.undoAction = this.route.snapshot.params['name'];
|
||||
if (this.undoAction === 'Undo Activation') {
|
||||
this.undoCommand = 'undoactivate';
|
||||
}
|
||||
this.accountId = this.route.parent.snapshot.params['fixedDepositAccountId'];
|
||||
}
|
||||
|
||||
@@ -59,9 +69,15 @@ export class UndoApprovalFixedDepositsAccountComponent implements OnInit {
|
||||
const data = {
|
||||
...this.undoApprovalFixedDepositsAccountForm.value,
|
||||
};
|
||||
this.savingsService.executeSavingsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
if (this.undoAction === 'Undo Activation') {
|
||||
this.fixedDepositsService.executeFixedDepositsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
} else {
|
||||
this.savingsService.executeSavingsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user