WEB-446: Validation of re-Age amount during submission
This commit is contained in:
@@ -42,6 +42,9 @@ export class FormatAmountDirective implements OnInit {
|
||||
) {}
|
||||
|
||||
parse(value: any) {
|
||||
if (value == '') {
|
||||
return '' + this.sufix;
|
||||
}
|
||||
return formatCurrency(value, this.locale, this.displaySymbol, this.currencyCode, this.digitsInfo) + this.sufix;
|
||||
}
|
||||
}
|
||||
|
||||
+11
-1
@@ -1,8 +1,18 @@
|
||||
<div class="container mat-elevation-z8">
|
||||
<mat-card>
|
||||
<form [formGroup]="reagingLoanForm" (ngSubmit)="submit()">
|
||||
<form [formGroup]="reagingLoanForm" (ngSubmit)="submit()" *ngIf="loanTransactionData !== null">
|
||||
<mat-card-content>
|
||||
<div class="layout-column">
|
||||
<mifosx-input-amount
|
||||
[currency]="loanTransactionData.currency"
|
||||
[isRequired]="false"
|
||||
[inputFormControl]="reagingLoanForm.controls.transactionAmount"
|
||||
[inputLabel]="'Transaction Amount'"
|
||||
[minVal]="0.01"
|
||||
[maxVal]="loanTransactionData.amount"
|
||||
>
|
||||
</mifosx-input-amount>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-label>{{ 'labels.inputs.Number of Installments' | translate }}</mat-label>
|
||||
<input type="number" matInput required formControlName="numberOfInstallments" />
|
||||
|
||||
+12
-9
@@ -9,13 +9,16 @@ import { SettingsService } from 'app/settings/settings.service';
|
||||
import { OptionData } from 'app/shared/models/option-data.model';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
import { ReAgePreviewDialogComponent } from './re-age-preview-dialog/re-age-preview-dialog.component';
|
||||
import { InputAmountComponent } from 'app/shared/input-amount/input-amount.component';
|
||||
import { LoanTransactionTemplate } from 'app/loans/models/loan-transaction-type.model';
|
||||
|
||||
@Component({
|
||||
selector: 'mifosx-loan-reaging',
|
||||
templateUrl: './loan-reaging.component.html',
|
||||
styleUrls: ['./loan-reaging.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
InputAmountComponent
|
||||
]
|
||||
})
|
||||
export class LoanReagingComponent implements OnInit {
|
||||
@@ -34,7 +37,7 @@ export class LoanReagingComponent implements OnInit {
|
||||
/** Maximum Date allowed. */
|
||||
maxDate = new Date();
|
||||
|
||||
currencyCode: string = '';
|
||||
loanTransactionData: LoanTransactionTemplate | null = null;
|
||||
|
||||
constructor(
|
||||
private formBuilder: UntypedFormBuilder,
|
||||
@@ -49,17 +52,13 @@ export class LoanReagingComponent implements OnInit {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.loanTransactionData = this.dataObject;
|
||||
|
||||
this.maxDate = this.settingsService.maxFutureDate;
|
||||
|
||||
this.reAgeReasonOptions = this.dataObject.reAgeReasonOptions;
|
||||
this.reAgeInterestHandlingOptions = this.dataObject.reAgeInterestHandlingOptions;
|
||||
this.periodFrequencyOptions = this.dataObject.periodFrequencyOptions;
|
||||
|
||||
const loanDetailsData = this.route.parent?.parent?.snapshot.data['loanDetailsData'];
|
||||
if (loanDetailsData?.currency?.code) {
|
||||
this.currencyCode = loanDetailsData.currency.code;
|
||||
}
|
||||
|
||||
this.createReagingLoanForm();
|
||||
}
|
||||
|
||||
@@ -84,6 +83,10 @@ export class LoanReagingComponent implements OnInit {
|
||||
reAgeInterestHandling: [
|
||||
this.reAgeInterestHandlingOptions[0]
|
||||
],
|
||||
transactionAmount: [
|
||||
this.loanTransactionData.amount,
|
||||
[Validators.max(this.loanTransactionData.amount)]
|
||||
],
|
||||
note: '',
|
||||
externalId: '',
|
||||
reasonCodeValueId: null
|
||||
@@ -116,7 +119,7 @@ export class LoanReagingComponent implements OnInit {
|
||||
|
||||
this.loanService.getReAgePreview(this.loanId, data).subscribe({
|
||||
next: (response: RepaymentSchedule) => {
|
||||
const currencyCode = response.currency?.code || this.currencyCode;
|
||||
const currencyCode = response.currency?.code || this.loanTransactionData.currency.code;
|
||||
|
||||
if (!currencyCode) {
|
||||
console.error('Currency code is not available in API response or loan details');
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import { CodeValue, Currency } from 'app/shared/models/general.model';
|
||||
import { OptionData } from 'app/shared/models/option-data.model';
|
||||
|
||||
export interface LoanTransactionType {
|
||||
id: number;
|
||||
code: string;
|
||||
@@ -41,3 +44,17 @@ export interface LoanTransactionType {
|
||||
buyDownFeeAdjustment: boolean;
|
||||
buyDownFeeAmortizationAdjustment: boolean;
|
||||
}
|
||||
|
||||
export interface LoanTransactionTemplate {
|
||||
loanId: number;
|
||||
externalLoanId: string;
|
||||
type: LoanTransactionType;
|
||||
date: number[];
|
||||
currency: Currency;
|
||||
amount: number;
|
||||
netDisbursalAmount: number;
|
||||
manuallyReversed: boolean;
|
||||
reAgeReasonOptions: CodeValue[];
|
||||
periodFrequencyOptions: string[];
|
||||
reAgeInterestHandlingOptions: OptionData[];
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@
|
||||
<mat-hint class="right-hint" *ngIf="displayHint">{{
|
||||
inputFormControl.value | currency: currency.code : currency.displaySymbol : '1.2-2'
|
||||
}}</mat-hint>
|
||||
<mat-error *ngIf="minVal && inputFormControl.hasError('min')">
|
||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.Must be at least' | translate }} {{ minVal }}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="maxVal && inputFormControl.hasError('max')">
|
||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.Must be less or equal to' | translate }} {{ maxVal }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field appearance="fill" class="flex-100" *ngIf="!isRequired">
|
||||
<mat-label>{{ 'labels.inputs.' + inputLabel | translate }}</mat-label>
|
||||
@@ -37,4 +43,10 @@
|
||||
<mat-hint class="right-hint" *ngIf="displayHint">{{
|
||||
inputFormControl.value | currency: currency.code : currency.displaySymbol : '1.2-2'
|
||||
}}</mat-hint>
|
||||
<mat-error *ngIf="minVal && inputFormControl.hasError('min')">
|
||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.Must be at least' | translate }} {{ minVal }}
|
||||
</mat-error>
|
||||
<mat-error *ngIf="maxVal && inputFormControl.hasError('max')">
|
||||
{{ 'labels.inputs.Amount' | translate }} {{ 'labels.commons.Must be less or equal to' | translate }} {{ maxVal }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Currency } from '../models/general.model';
|
||||
import { UntypedFormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { NgIf, CurrencyPipe } from '@angular/common';
|
||||
import { MatFormField, MatLabel, MatError, MatHint, MatSuffix } from '@angular/material/form-field';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { CurrencyPipe } from '@angular/common';
|
||||
import { MatHint } from '@angular/material/form-field';
|
||||
import { FormatAmountDirective } from '../../directives/format-amount.directive';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@@ -22,6 +22,8 @@ export class InputAmountComponent {
|
||||
@Input() currency: Currency;
|
||||
@Input() inputLabel: string;
|
||||
@Input() inputFormControl: UntypedFormControl;
|
||||
@Input() minVal: number;
|
||||
@Input() maxVal: number;
|
||||
|
||||
displayHint = false;
|
||||
|
||||
@@ -39,12 +41,4 @@ export class InputAmountComponent {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inputBlur(): void {
|
||||
this.displayHint = false;
|
||||
}
|
||||
|
||||
inputFocus(): void {
|
||||
this.displayHint = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "požadováno a nemůže být záporné",
|
||||
"should": "by měl",
|
||||
"on": "na",
|
||||
"Password validation": "Heslo by mělo obsahovat minimálně {{minchar}} znaků, které by měly obsahovat 1 velké písmeno, malé písmeno a speciální znak a nemělo by se skládat z opakujících se znaků nebo mezer."
|
||||
"Password validation": "Heslo by mělo obsahovat minimálně {{minchar}} znaků, které by měly obsahovat 1 velké písmeno, malé písmeno a speciální znak a nemělo by se skládat z opakujících se znaků nebo mezer.",
|
||||
"Must be at least": "Musí být alespoň",
|
||||
"Must be less or equal to": "Musí být menší nebo rovno"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Seznam účtů spojených s různými finančními aktivitami. Chcete-li vědět více, klikněte:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "erforderlich und darf nicht negativ sein",
|
||||
"should": "sollen",
|
||||
"on": "An",
|
||||
"Password validation": "Das Passwort sollte mindestens {{michar}} Zeichen enthalten, aus 1 Großbuchstaben, Kleinbuchstaben und Sonderzeichen bestehen und darf nicht aus wiederholten Zeichen oder Leerzeichen bestehen"
|
||||
"Password validation": "Das Passwort sollte mindestens {{michar}} Zeichen enthalten, aus 1 Großbuchstaben, Kleinbuchstaben und Sonderzeichen bestehen und darf nicht aus wiederholten Zeichen oder Leerzeichen bestehen",
|
||||
"Must be at least": "Muss mindestens",
|
||||
"Must be less or equal to": "Muss kleiner oder gleich sein"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Liste der Konten, die mit verschiedenen Finanzaktivitäten verknüpft sind. Um mehr zu erfahren, klicken Sie:",
|
||||
|
||||
@@ -807,7 +807,9 @@
|
||||
"required and cannot be negative": "required and cannot be negative",
|
||||
"should": "should",
|
||||
"on": "on",
|
||||
"Password validation": "The password should contain a minimum of {{minchar}} characters, including 1 uppercase, 1 lowercase and a special character and should not include repeated characters or spaces."
|
||||
"Password validation": "The password should contain a minimum of {{minchar}} characters, including 1 uppercase, 1 lowercase and a special character and should not include repeated characters or spaces.",
|
||||
"Must be at least": "Must be at least",
|
||||
"Must be less or equal to": "Must be less or equal to"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "List of accounts linked to different financial activities. To know more click:",
|
||||
|
||||
@@ -802,7 +802,9 @@
|
||||
"required and cannot be negative": "requerido y no puede ser negativo",
|
||||
"should": "debería",
|
||||
"on": "en",
|
||||
"Password validation": "La contraseña debe contener un mínimo de {{minchar}} caracteres, que deben incluir 1 carácter mayúscula, minúscula y especial y no debe constar de caracteres repetidos ni espacios en blanco."
|
||||
"Password validation": "La contraseña debe contener un mínimo de {{minchar}} caracteres, que deben incluir 1 carácter mayúscula, minúscula y especial y no debe constar de caracteres repetidos ni espacios en blanco.",
|
||||
"Must be at least": "Debe ser al menos",
|
||||
"Must be less or equal to": "Debe ser menor o igual a"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:",
|
||||
|
||||
@@ -802,7 +802,9 @@
|
||||
"required and cannot be negative": "requerido y no puede ser negativo",
|
||||
"should": "debería",
|
||||
"on": "en",
|
||||
"Password validation": "La contraseña debe contener un mínimo de {{minchar}} caracteres, que deben incluir 1 carácter mayúscula, minúscula y especial y no debe constar de caracteres repetidos ni espacios en blanco."
|
||||
"Password validation": "La contraseña debe contener un mínimo de {{minchar}} caracteres, que deben incluir 1 carácter mayúscula, minúscula y especial y no debe constar de caracteres repetidos ni espacios en blanco.",
|
||||
"Must be at least": "Debe ser al menos",
|
||||
"Must be less or equal to": "Debe ser menor o igual a"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "obligatoire et ne peut pas être négatif",
|
||||
"should": "devrait",
|
||||
"on": "sur",
|
||||
"Password validation": "Le mot de passe doit contenir au minimum {{minchar}} caractères, dont 1 majuscule, 1 minuscule et un caractère spécial et ne doit pas être composé de caractères répétés ou d'espaces blancs."
|
||||
"Password validation": "Le mot de passe doit contenir au minimum {{minchar}} caractères, dont 1 majuscule, 1 minuscule et un caractère spécial et ne doit pas être composé de caractères répétés ou d'espaces blancs.",
|
||||
"Must be at least": "Doit être au moins",
|
||||
"Must be less or equal to": "Doit être inférieur ou égal à"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Liste des comptes liés aux différentes activités financières. Pour en savoir plus cliquez :",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "obbligatorio e non può essere negativo",
|
||||
"should": "Dovrebbe",
|
||||
"on": "SU",
|
||||
"Password validation": "La password deve contenere almeno {{minchar}} caratteri, di cui 1 carattere maiuscolo, minuscolo e speciale e non deve essere composta da caratteri ripetuti o spazi bianchi"
|
||||
"Password validation": "La password deve contenere almeno {{minchar}} caratteri, di cui 1 carattere maiuscolo, minuscolo e speciale e non deve essere composta da caratteri ripetuti o spazi bianchi",
|
||||
"Must be at least": "Deve essere almeno",
|
||||
"Must be less or equal to": "Deve essere minore o uguale a"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Elenco dei conti collegati a diverse attività finanziarie. Per saperne di più clicca:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "필수이며 음수일 수 없습니다.",
|
||||
"should": "~해야 한다",
|
||||
"on": "~에",
|
||||
"Password validation": "비밀번호는 최소 자여야 하며 대문자, 소문자 및 특수 문자 1개가 포함되어야 하며 반복되는 문자나 공백으로 구성되어서는 안 됩니다."
|
||||
"Password validation": "비밀번호는 최소 자여야 하며 대문자, 소문자 및 특수 문자 1개가 포함되어야 하며 반복되는 문자나 공백으로 구성되어서는 안 됩니다.",
|
||||
"Must be at least": "최소한이어야 합니다",
|
||||
"Must be less or equal to": "이보다 작거나 같아야 합니다."
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "다양한 금융 활동과 연결된 계정 목록입니다. 자세한 내용을 보려면 다음을 클릭하세요.",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "privaloma ir negali būti neigiama",
|
||||
"should": "turėtų",
|
||||
"on": "įjungta",
|
||||
"Password validation": "Slaptažodį turi sudaryti ne mažiau kaip {{minchar}} simbolių, iš kurių turi būti 1 didžioji, mažoji raidė ir specialus simbolis, o jį neturėtų sudaryti pasikartojantys simboliai ar tarpai"
|
||||
"Password validation": "Slaptažodį turi sudaryti ne mažiau kaip {{minchar}} simbolių, iš kurių turi būti 1 didžioji, mažoji raidė ir specialus simbolis, o jį neturėtų sudaryti pasikartojantys simboliai ar tarpai",
|
||||
"Must be at least": "Turi būti bent jau",
|
||||
"Must be less or equal to": "Turi būti mažesnis arba lygus"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Sąskaitų, susietų su įvairia finansine veikla, sąrašas. Norėdami sužinoti daugiau, spustelėkite:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "obligāti un nevar būt negatīvs",
|
||||
"should": "vajadzētu",
|
||||
"on": "ieslēgts",
|
||||
"Password validation": "Parolē jābūt vismaz {{minchar}} rakstzīmēm, tai jābūt 1 lielajam, mazajam un speciālajām rakstzīmēm, un tā nedrīkst sastāvēt no atkārtotām rakstzīmēm vai atstarpēm."
|
||||
"Password validation": "Parolē jābūt vismaz {{minchar}} rakstzīmēm, tai jābūt 1 lielajam, mazajam un speciālajām rakstzīmēm, un tā nedrīkst sastāvēt no atkārtotām rakstzīmēm vai atstarpēm.",
|
||||
"Must be at least": "Jābūt vismaz",
|
||||
"Must be less or equal to": "Jābūt mazākam vai vienādam ar"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Ar dažādām finanšu darbībām saistīto kontu saraksts. Lai uzzinātu vairāk, noklikšķiniet:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "आवश्यक छ र नकारात्मक हुन सक्दैन",
|
||||
"should": "गर्नुपर्छ",
|
||||
"on": "मा",
|
||||
"Password validation": "पासवर्डमा कम्तिमा १२ क्यारेक्टरहरू हुनुपर्छ, जसमा १ अपरकेस, लोअरकेस र स्पेशल क्यारेक्टरहरू हुनुपर्छ र दोहोरिएका क्यारेक्टरहरू वा सेतो-स्पेसहरू समावेश हुनु हुँदैन।"
|
||||
"Password validation": "पासवर्डमा कम्तिमा १२ क्यारेक्टरहरू हुनुपर्छ, जसमा १ अपरकेस, लोअरकेस र स्पेशल क्यारेक्टरहरू हुनुपर्छ र दोहोरिएका क्यारेक्टरहरू वा सेतो-स्पेसहरू समावेश हुनु हुँदैन।",
|
||||
"Must be at least": "कम्तिमा हुनुपर्छ",
|
||||
"Must be less or equal to": "कम वा बराबर हुनुपर्छ"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "विभिन्न वित्तीय गतिविधिहरु संग जोडिएको खाताहरु को सूची। थप जान्नको लागि क्लिक गर्नुहोस्:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "obrigatório e não pode ser negativo",
|
||||
"should": "deve",
|
||||
"on": "sobre",
|
||||
"Password validation": "A senha deve conter no mínimo {{minchar}} caracteres, que deve conter 1 letra maiúscula, minúscula e caractere especial e não deve consistir em caracteres repetidos ou espaços em branco"
|
||||
"Password validation": "A senha deve conter no mínimo {{minchar}} caracteres, que deve conter 1 letra maiúscula, minúscula e caractere especial e não deve consistir em caracteres repetidos ou espaços em branco",
|
||||
"Must be at least": "Deve ser pelo menos",
|
||||
"Must be less or equal to": "Deve ser menor ou igual a"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Lista de contas vinculadas a diferentes atividades financeiras. Para saber mais clique:",
|
||||
|
||||
@@ -803,7 +803,9 @@
|
||||
"required and cannot be negative": "inahitajika na haiwezi kuwa hasi",
|
||||
"should": "lazima",
|
||||
"on": "juu",
|
||||
"Password validation": "Nenosiri lazima liwe na herufi {{minchar}}, ambazo zinafaa kuingiza herufi 1 kubwa, ndogo na maalum na haipaswi kuwa na herufi zinazorudiwa au nafasi nyeupe."
|
||||
"Password validation": "Nenosiri lazima liwe na herufi {{minchar}}, ambazo zinafaa kuingiza herufi 1 kubwa, ndogo na maalum na haipaswi kuwa na herufi zinazorudiwa au nafasi nyeupe.",
|
||||
"Must be at least": "Lazima iwe angalau",
|
||||
"Must be less or equal to": "Lazima iwe chini au sawa na"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Orodha ya akaunti zilizounganishwa na shughuli tofauti za kifedha. Kujua zaidi bofya:",
|
||||
|
||||
Reference in New Issue
Block a user