New input control for Transaction Amounts

This commit is contained in:
Jose Alberto Hernandez
2024-06-09 22:38:28 -06:00
committed by Jose Alberto Hernandez
parent 83f9a0e499
commit 9b51ec4694
48 changed files with 318 additions and 122 deletions
@@ -20,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">{{ currencyCode }}</span>
<span fxFlex="auto"></span>
<input type="number" class="right-input" formControlName="transactionAmount" required matInput />
<mat-error *ngIf="savingAccountTransactionForm.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]="savingAccountTransactionForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{'labels.inputs.Payment Type' | translate}}</mat-label>
@@ -1,5 +1,5 @@
/** Angular Imports */
import { Component, Input, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { UntypedFormGroup, UntypedFormBuilder, Validators, UntypedFormControl } from '@angular/forms';
import { Router, ActivatedRoute } from '@angular/router';
@@ -7,6 +7,7 @@ import { Router, ActivatedRoute } from '@angular/router';
import { SavingsService } from '../../savings.service';
import { SettingsService } from 'app/settings/settings.service';
import { Dates } from 'app/core/utils/dates';
import { Currency } from 'app/shared/models/general.model';
/**
* Create savings account transactions component.
@@ -18,8 +19,6 @@ import { Dates } from 'app/core/utils/dates';
})
export class SavingsAccountTransactionsComponent implements OnInit {
@Input() currencyCode: string;
/** Minimum Due Date allowed. */
minDate = new Date(2000, 0, 1);
/** Maximum Due Date allowed. */
@@ -42,6 +41,7 @@ export class SavingsAccountTransactionsComponent implements OnInit {
transactionCommand: string;
/** saving account's Id */
savingAccountId: string;
currency: Currency | null = null;
/**
* Retrieves the Saving Account transaction template data from `resolve`.
@@ -60,6 +60,9 @@ export class SavingsAccountTransactionsComponent implements OnInit {
private settingsService: SettingsService) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.paymentTypeOptions = data.savingsAccountActionData.paymentTypeOptions;
if (data.savingsAccountActionData.currency) {
this.currency = data.savingsAccountActionData.currency;
}
});
this.transactionCommand = this.route.snapshot.params['name'].toLowerCase();
this.transactionType[this.transactionCommand] = true;
@@ -122,6 +125,7 @@ export class SavingsAccountTransactionsComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.savingsService.executeSavingsAccountTransactionsCommand(this.savingAccountId, this.transactionCommand, data).subscribe(res => {
this.router.navigate(['../../transactions'], { relativeTo: this.route });
});