Recurring Deposit account deposit and withdrawal transactions (#1919)

Co-authored-by: Jose Alberto Hernandez <alberto@blue-daemon.local>
This commit is contained in:
José Alberto Hernández
2023-12-05 00:05:16 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent a26c906d2c
commit dd7faffad7
8 changed files with 20 additions and 6 deletions
@@ -28,7 +28,7 @@ export class RecurringDepositsAccountActionsResolver implements Resolve<Object>
* @returns {Observable<any>}
*/
resolve(route: ActivatedRouteSnapshot): Observable<any> {
const actionName = route.paramMap.get('name');
const actionName: string = route.paramMap.get('name');
const recurringDepositAccountId = route.paramMap.get('recurringDepositAccountId') || route.parent.parent.paramMap.get('recurringDepositAccountId');
switch (actionName) {
case 'Add Charge':
@@ -36,7 +36,8 @@ export class RecurringDepositsAccountActionsResolver implements Resolve<Object>
case 'Close':
return this.recurringDepositsService.getRecurringDepositAccountActionResource(recurringDepositAccountId, 'close');
case 'Deposit':
return this.recurringDepositsService.getRecurringDepositAccountTransactionTemplateResource(recurringDepositAccountId, 'deposit');
case 'Withdrawal':
return this.recurringDepositsService.getRecurringDepositAccountTransactionTemplateResource(recurringDepositAccountId, actionName.toLocaleLowerCase());
default:
return undefined;
}
@@ -88,7 +88,7 @@
</mat-card-content>
<mat-card-actions fxLayout="row" fxLayout.xs="column" fxLayoutAlign="center" fxLayoutGap="5px">
<button type="button" mat-raised-button [routerLink]="['../general']">{{"labels.buttons.Cancel" | translate }}</button>
<button type="button" mat-raised-button [routerLink]="['../../general']">{{"labels.buttons.Cancel" | translate }}</button>
<button mat-raised-button color="primary" [disabled]="!depositRecurringDepositForm.valid">{{"labels.buttons.Submit" | translate }}</button>
</mat-card-actions>
@@ -38,6 +38,8 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
/** Deposits Recurring Deposit Account form. */
depositRecurringDepositForm: UntypedFormGroup;
action: string;
/**
* Retrieves action details transactions template data from `resolve`
* @param {FormBuilder} formBuilder Form Builder
@@ -62,6 +64,8 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
this.transactionAmount = this.transactionAmount + this.outstandingChargeAmount;
}
});
const name: string = this.route.snapshot.params['name'];
this.action = name.toLowerCase();
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -125,7 +129,9 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
dateFormat,
locale
};
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, 'deposit', data).subscribe(() => {
delete data['note'];
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.action, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});
}
@@ -6,4 +6,4 @@
<mifosx-add-charge-recurring-deposits-account *ngIf="actions['Add Charge']"></mifosx-add-charge-recurring-deposits-account>
<mifosx-premature-close-recurring-deposit-account *ngIf="actions['Premature Close']"></mifosx-premature-close-recurring-deposit-account>
<mifosx-close-recurring-deposits-account *ngIf="actions['Close']"></mifosx-close-recurring-deposits-account>
<mifosx-deposit-recurring-deposits-account [currency]="currency" *ngIf="actions['Deposit']"></mifosx-deposit-recurring-deposits-account>
<mifosx-deposit-recurring-deposits-account [currency]="currency" *ngIf="actions['Deposit'] || actions['Withdrawal']"></mifosx-deposit-recurring-deposits-account>
@@ -20,6 +20,7 @@ export class RecurringDepositsAccountActionsComponent {
'Premature Close': boolean
'Close': boolean
'Deposit': boolean
'Withdrawal': boolean
} = {
'Activate': false,
'Undo Approval': false,
@@ -29,7 +30,8 @@ export class RecurringDepositsAccountActionsComponent {
'Add Charge': false,
'Premature Close': false,
'Close': false,
'Deposit': false
'Deposit': false,
'Withdrawal': false
};
currency: Currency;
@@ -162,6 +162,7 @@ export class RecurringDepositsAccountViewComponent implements OnInit {
case 'Premature Close':
case 'Close':
case 'Deposit':
case 'Withdrawal':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Modify Application':
@@ -73,6 +73,9 @@ export class RecurringDepositsService {
*/
executeRecurringDepositsAccountCommand(accountId: string, command: string, data: any): Observable<any> {
const httpParams = new HttpParams().set('command', command);
if (command === 'deposit' || command === 'withdrawal') {
return this.http.post(`/recurringdepositaccounts/${accountId}/transactions`, data, { params: httpParams });
}
return this.http.post(`/recurringdepositaccounts/${accountId}`, data, { params: httpParams });
}
+1
View File
@@ -26,6 +26,7 @@
}
.account-overview {
border: none;
max-width: 240px;
font-size: 14px;