fix: Recurring Deposit accounts issues

This commit is contained in:
Jose Alberto Hernandez
2024-06-09 23:06:30 -06:00
committed by Jose Alberto Hernandez
parent 9b51ec4694
commit b23efd3e1c
23 changed files with 402 additions and 121 deletions
@@ -1,6 +1,7 @@
<div class="container">
<mat-card>
<h2 mat-title *ngIf="transactionType.withdrawal">{{'labels.menus.' + actionName | translate }} {{'labels.heading.Recurring Deposit Transactions' | translate}}</h2>
<form [formGroup]="depositRecurringDepositForm" (ngSubmit)="submit()">
@@ -19,15 +20,10 @@
</mat-error>
</mat-form-field>
<mat-form-field appearance="fill">
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<span matTextSuffix class="m-l-10">{{ currency.code }}</span>
<span fxFlex="auto"></span>
<input type="number" matInput required class="right-input" formControlName="transactionAmount">
<mat-error *ngIf="depositRecurringDepositForm.controls.transactionAmount.hasError('required')">
{{"labels.inputs.Transaction Amount" | translate}} {{"labels.commons.is" | translate}} <strong>{{"labels.commons.required" | translate}}</strong>
</mat-error>
</mat-form-field>
<mifosx-input-amount [currency]="currency" [isRequired]="true"
[inputFormControl]="depositRecurringDepositForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.Payment Type Id" | translate }}</mat-label>
@@ -39,6 +39,9 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
depositRecurringDepositForm: UntypedFormGroup;
action: string;
actionName: string;
transactionCommand: string;
transactionType: { deposit: boolean, withdrawal: boolean } = { deposit: false, withdrawal: false };
/**
* Retrieves action details transactions template data from `resolve`
@@ -64,8 +67,10 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
this.transactionAmount = this.transactionAmount + this.outstandingChargeAmount;
}
});
const name: string = this.route.snapshot.params['name'];
this.action = name.toLowerCase();
this.actionName = this.route.snapshot.params['name'];
this.action = this.actionName.toLowerCase();
this.transactionCommand = this.action.toLowerCase();
this.transactionType[this.transactionCommand] = true;
this.accountId = this.route.parent.snapshot.params['recurringDepositAccountId'];
}
@@ -80,7 +85,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
createdepositRecurringDepositForm() {
this.depositRecurringDepositForm = this.formBuilder.group({
'transactionDate': [new Date(), Validators.required],
'transactionAmount': [this.transactionAmount, Validators.required],
'transactionAmount': [0.0, Validators.required],
'paymentTypeId': ['', Validators.required],
'note': ''
});
@@ -131,6 +136,7 @@ export class DepositRecurringDepositsAccountComponent implements OnInit {
};
delete data['note'];
data['transactionAmount'] = data['transactionAmount'] * 1;
this.recurringDepositsService.executeRecurringDepositsAccountCommand(this.accountId, this.action, data).subscribe(() => {
this.router.navigate(['../../'], { relativeTo: this.route });
});