Support for Recurring Deposits undo Activation
This commit is contained in:
committed by
Adam Saghy
parent
ff491250e4
commit
3e589894ce
+1
-1
@@ -1,5 +1,5 @@
|
||||
<mifosx-activate-recurring-deposits-account *ngIf="actions['Activate']"></mifosx-activate-recurring-deposits-account>
|
||||
<mifosx-undo-approval-recurring-deposits-account *ngIf="actions['Undo Approval']"></mifosx-undo-approval-recurring-deposits-account>
|
||||
<mifosx-undo-approval-recurring-deposits-account *ngIf="actions['Undo Approval'] || actions['Undo Activation']"></mifosx-undo-approval-recurring-deposits-account>
|
||||
<mifosx-approve-recurring-deposits-account *ngIf="actions['Approve']"></mifosx-approve-recurring-deposits-account>
|
||||
<mifosx-reject-recurring-deposits-account *ngIf="actions['Reject']"></mifosx-reject-recurring-deposits-account>
|
||||
<mifosx-withdraw-by-client-recurring-deposits-account *ngIf="actions['Withdrawn by client']"></mifosx-withdraw-by-client-recurring-deposits-account>
|
||||
|
||||
+2
@@ -12,6 +12,7 @@ export class RecurringDepositsAccountActionsComponent {
|
||||
/** Flag object to store possible actions and render appropriate UI to the user */
|
||||
actions: {
|
||||
'Activate': boolean
|
||||
'Undo Activation': boolean
|
||||
'Undo Approval': boolean
|
||||
'Approve': boolean
|
||||
'Reject': boolean
|
||||
@@ -23,6 +24,7 @@ export class RecurringDepositsAccountActionsComponent {
|
||||
'Withdrawal': boolean
|
||||
} = {
|
||||
'Activate': false,
|
||||
'Undo Activation': false,
|
||||
'Undo Approval': false,
|
||||
'Approve': false,
|
||||
'Reject': false,
|
||||
|
||||
+17
-3
@@ -20,6 +20,9 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
|
||||
undoApprovalRecurringDepositsAccountForm: UntypedFormGroup;
|
||||
/** Recurring Deposits Account Id */
|
||||
accountId: any;
|
||||
/** Action to be Undo */
|
||||
undoAction: string;
|
||||
undoCommand: string;
|
||||
|
||||
/**
|
||||
* @param {FormBuilder} formBuilder Form Builder
|
||||
@@ -31,6 +34,11 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
|
||||
private recurringDepositsService: RecurringDepositsService,
|
||||
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['recurringDepositAccountId'];
|
||||
}
|
||||
|
||||
@@ -58,9 +66,15 @@ export class UndoApprovalRecurringDepositsAccountComponent implements OnInit {
|
||||
const data = {
|
||||
...this.undoApprovalRecurringDepositsAccountForm.value,
|
||||
};
|
||||
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
if (this.undoAction === 'Undo Activation') {
|
||||
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.undoCommand, data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
} else {
|
||||
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'undoapproval', data).subscribe(() => {
|
||||
this.router.navigate(['../../'], { relativeTo: this.route });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user