fix: add date range validation translations for all languages (#2851)
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
{{ param.label }} {{ 'labels.commons.is' | translate }}
|
||||
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
||||
</mat-error>
|
||||
<mat-error *ngIf="reportForm.controls[param.name].hasError('endBeforeStart')">
|
||||
{{ param.label }} {{ 'labels.commons.must be after or equal to start date' | translate }}
|
||||
</mat-error>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="form-field" *ngSwitchCase="'select'">
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
/** Angular Imports */
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, RouterLink } from '@angular/router';
|
||||
import { UntypedFormControl, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
||||
import {
|
||||
AbstractControl,
|
||||
UntypedFormControl,
|
||||
UntypedFormGroup,
|
||||
ValidatorFn,
|
||||
Validators,
|
||||
ReactiveFormsModule
|
||||
} from '@angular/forms';
|
||||
|
||||
/** Custom Services */
|
||||
import { ReportsService } from '../reports.service';
|
||||
@@ -176,6 +183,7 @@ export class RunReportComponent implements OnInit {
|
||||
}
|
||||
this.decimalChoice.patchValue('0');
|
||||
this.setChildControls();
|
||||
this.addDateRangeValidator();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -206,6 +214,62 @@ export class RunReportComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
addDateRangeValidator(): void {
|
||||
const dateParams = this.paramData.filter((param: ReportParameter) => param.displayType === 'date');
|
||||
const startParam = dateParams.find((param: ReportParameter) => this.isStartDateParam(param));
|
||||
const endParam = dateParams.find((param: ReportParameter) => this.isEndDateParam(param));
|
||||
|
||||
if (!startParam || !endParam) {
|
||||
return;
|
||||
}
|
||||
|
||||
const startControl = this.reportForm.get(startParam.name);
|
||||
const endControl = this.reportForm.get(endParam.name);
|
||||
|
||||
if (!startControl || !endControl) {
|
||||
return;
|
||||
}
|
||||
|
||||
endControl.addValidators(this.endDateAfterStartValidator(startParam.name));
|
||||
endControl.updateValueAndValidity({ emitEvent: false });
|
||||
startControl.valueChanges.subscribe(() => endControl.updateValueAndValidity({ emitEvent: false }));
|
||||
}
|
||||
|
||||
endDateAfterStartValidator(startControlName: string): ValidatorFn {
|
||||
return (control: AbstractControl) => {
|
||||
const startControl = control.parent?.get(startControlName);
|
||||
const startValue = startControl?.value;
|
||||
const endValue = control.value;
|
||||
|
||||
if (!startValue || !endValue) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const startDate = new Date(startValue);
|
||||
const endDate = new Date(endValue);
|
||||
|
||||
if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (endDate < startDate) {
|
||||
return { endBeforeStart: true };
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
isStartDateParam(param: ReportParameter): boolean {
|
||||
const identifier = `${param.name}${param.variable}${param.label}`.toLowerCase();
|
||||
return identifier.includes('start') || identifier.includes('from');
|
||||
}
|
||||
|
||||
isEndDateParam(param: ReportParameter): boolean {
|
||||
const identifier = `${param.name}${param.variable}${param.label}`.toLowerCase();
|
||||
return identifier.includes('end') || identifier.includes('to');
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribes to changes in parent parameters value, builds child parameter vis-a-vis parent's value.
|
||||
*/
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Musí být alespoň",
|
||||
"Must be less or equal to": "Musí být menší nebo rovno"
|
||||
"Must be less or equal to": "Musí být menší nebo rovno",
|
||||
"must be after or equal to start date": "musí být po nebo rovno datu zahájení"
|
||||
},
|
||||
"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:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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",
|
||||
"Must be at least": "Muss mindestens",
|
||||
"Must be less or equal to": "Muss kleiner oder gleich sein"
|
||||
"Must be less or equal to": "Muss kleiner oder gleich sein",
|
||||
"must be after or equal to start date": "muss nach oder gleich dem Startdatum sein"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Liste der Konten, die mit verschiedenen Finanzaktivitäten verknüpft sind. Um mehr zu erfahren, klicken Sie:",
|
||||
|
||||
@@ -811,7 +811,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Must be at least",
|
||||
"Must be less or equal to": "Must be less or equal to"
|
||||
"Must be less or equal to": "Must be less or equal to",
|
||||
"must be after or equal to start date": "must be after or equal to start date"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "List of accounts linked to different financial activities. To know more click:",
|
||||
|
||||
@@ -806,7 +806,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Debe ser al menos",
|
||||
"Must be less or equal to": "Debe ser menor o igual a"
|
||||
"Must be less or equal to": "Debe ser menor o igual a",
|
||||
"must be after or equal to start date": "debe ser posterior o igual a la fecha de inicio"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:",
|
||||
|
||||
@@ -806,7 +806,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Debe ser al menos",
|
||||
"Must be less or equal to": "Debe ser menor o igual a"
|
||||
"Must be less or equal to": "Debe ser menor o igual a",
|
||||
"must be after or equal to start date": "debe ser posterior o igual a la fecha de inicio"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Doit être au moins",
|
||||
"Must be less or equal to": "Doit être inférieur ou égal à"
|
||||
"Must be less or equal to": "Doit être inférieur ou égal à",
|
||||
"must be after or equal to start date": "doit être postérieure ou égale à la date de début"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Liste des comptes liés aux différentes activités financières. Pour en savoir plus cliquez :",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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",
|
||||
"Must be at least": "Deve essere almeno",
|
||||
"Must be less or equal to": "Deve essere minore o uguale a"
|
||||
"Must be less or equal to": "Deve essere minore o uguale a",
|
||||
"must be after or equal to start date": "deve essere successiva o uguale alla data di inizio"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Elenco dei conti collegati a diverse attività finanziarie. Per saperne di più clicca:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"on": "~에",
|
||||
"Password validation": "비밀번호는 최소 자여야 하며 대문자, 소문자 및 특수 문자 1개가 포함되어야 하며 반복되는 문자나 공백으로 구성되어서는 안 됩니다.",
|
||||
"Must be at least": "최소한이어야 합니다",
|
||||
"Must be less or equal to": "이보다 작거나 같아야 합니다."
|
||||
"Must be less or equal to": "이보다 작거나 같아야 합니다.",
|
||||
"must be after or equal to start date": "시작 날짜 이후이거나 같아야 합니다"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "다양한 금융 활동과 연결된 계정 목록입니다. 자세한 내용을 보려면 다음을 클릭하세요.",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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",
|
||||
"Must be at least": "Turi būti bent jau",
|
||||
"Must be less or equal to": "Turi būti mažesnis arba lygus"
|
||||
"Must be less or equal to": "Turi būti mažesnis arba lygus",
|
||||
"must be after or equal to start date": "turi būti po pradžios datos arba jai lygi"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Sąskaitų, susietų su įvairia finansine veikla, sąrašas. Norėdami sužinoti daugiau, spustelėkite:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Jābūt vismaz",
|
||||
"Must be less or equal to": "Jābūt mazākam vai vienādam ar"
|
||||
"Must be less or equal to": "Jābūt mazākam vai vienādam ar",
|
||||
"must be after or equal to start date": "jābūt pēc sākuma datuma vai vienādam ar to"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Ar dažādām finanšu darbībām saistīto kontu saraksts. Lai uzzinātu vairāk, noklikšķiniet:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"on": "मा",
|
||||
"Password validation": "पासवर्डमा कम्तिमा १२ क्यारेक्टरहरू हुनुपर्छ, जसमा १ अपरकेस, लोअरकेस र स्पेशल क्यारेक्टरहरू हुनुपर्छ र दोहोरिएका क्यारेक्टरहरू वा सेतो-स्पेसहरू समावेश हुनु हुँदैन।",
|
||||
"Must be at least": "कम्तिमा हुनुपर्छ",
|
||||
"Must be less or equal to": "कम वा बराबर हुनुपर्छ"
|
||||
"Must be less or equal to": "कम वा बराबर हुनुपर्छ",
|
||||
"must be after or equal to start date": "सुरु मिति पछि वा बराबर हुनुपर्छ"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "विभिन्न वित्तीय गतिविधिहरु संग जोडिएको खाताहरु को सूची। थप जान्नको लागि क्लिक गर्नुहोस्:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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",
|
||||
"Must be at least": "Deve ser pelo menos",
|
||||
"Must be less or equal to": "Deve ser menor ou igual a"
|
||||
"Must be less or equal to": "Deve ser menor ou igual a",
|
||||
"must be after or equal to start date": "deve ser posterior ou igual à data de início"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Lista de contas vinculadas a diferentes atividades financeiras. Para saber mais clique:",
|
||||
|
||||
@@ -807,7 +807,8 @@
|
||||
"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.",
|
||||
"Must be at least": "Lazima iwe angalau",
|
||||
"Must be less or equal to": "Lazima iwe chini au sawa na"
|
||||
"Must be less or equal to": "Lazima iwe chini au sawa na",
|
||||
"must be after or equal to start date": "lazima iwe baada ya au sawa na tarehe ya kuanza"
|
||||
},
|
||||
"heading": {
|
||||
"Account Linked Financial": "Orodha ya akaunti zilizounganishwa na shughuli tofauti za kifedha. Kujua zaidi bofya:",
|
||||
|
||||
Reference in New Issue
Block a user