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
@@ -17,13 +17,10 @@
</mat-error>
</mat-form-field>
<mat-form-field>
<mat-label>{{"labels.inputs.Transaction Amount" | translate}}</mat-label>
<input type="number" formControlName="transactionAmount" required matInput />
<mat-error *ngIf="editTransactionForm.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]="editTransactionForm.controls.transactionAmount"
[inputLabel]="'Transaction Amount'">
</mifosx-input-amount>
<mat-form-field>
<mat-label>{{"labels.inputs.External Id" | translate}}</mat-label>
@@ -7,6 +7,7 @@ import { Dates } from 'app/core/utils/dates';
/** Custom Services */
import { LoansService } from 'app/loans/loans.service';
import { SettingsService } from 'app/settings/settings.service';
import { Currency } from 'app/shared/models/general.model';
/**
* Edit Transaction component.
@@ -38,6 +39,7 @@ export class EditTransactionComponent implements OnInit {
loanAccountId: string;
/** Transaction Template */
transactionTemplateData: any;
currency: Currency;
/**
* Retrieves the Loan Account transaction template data from `resolve`.
@@ -56,6 +58,9 @@ export class EditTransactionComponent implements OnInit {
private settingsService: SettingsService) {
this.route.data.subscribe((data: { loansAccountTransactionTemplate: any }) => {
this.transactionTemplateData = data.loansAccountTransactionTemplate;
if (data.loansAccountTransactionTemplate.currency) {
this.currency = data.loansAccountTransactionTemplate.currency;
}
this.paymentTypeOptions = this.transactionTemplateData.paymentTypeOptions;
});
this.loanAccountId = this.route.snapshot.params['loanId'];
@@ -123,6 +128,7 @@ export class EditTransactionComponent implements OnInit {
dateFormat,
locale
};
data['transactionAmount'] = data['transactionAmount'] * 1;
this.loansService.executeLoansAccountTransactionsCommand(this.loanAccountId, 'modify', data, this.transactionTemplateData.id)
.subscribe((res: any) => {
this.router.navigate(['../'], { relativeTo: this.route });