diff --git a/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html b/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html index cc97bc7ab..1b4c0b587 100644 --- a/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html +++ b/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html @@ -29,7 +29,7 @@ @for (conditionType of conditionTypeData; track conditionType) { - {{ conditionType.value }} + {{ conditionLabelService.getConditionLabel(conditionType.value) }} } diff --git a/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts b/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts index 4efd67787..0117c4b49 100644 --- a/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts +++ b/src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts @@ -5,8 +5,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -import { Component, OnInit, inject } from '@angular/core'; +import { Component, OnInit, DestroyRef, inject } from '@angular/core'; +import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; import { MatDialogRef, MAT_DIALOG_DATA, @@ -15,10 +15,12 @@ import { MatDialogActions, MatDialogClose } from '@angular/material/dialog'; -import { UntypedFormBuilder, UntypedFormGroup, Validators, ReactiveFormsModule } from '@angular/forms'; -import { TranslateService } from '@ngx-translate/core'; +import { UntypedFormBuilder, UntypedFormGroup, Validators } from '@angular/forms'; import { CdkScrollable } from '@angular/cdk/scrolling'; +import { TranslateService } from '@ngx-translate/core'; + import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; +import { ConditionLabelService } from 'app/shared/common-logic/condition-label.service'; @Component({ selector: 'mifosx-deposit-product-incentive-form-dialog', @@ -34,20 +36,24 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; ] }) export class DepositProductIncentiveFormDialogComponent implements OnInit { - dialogRef = inject>(MatDialogRef); + private destroyRef = inject(DestroyRef); + + private dialogRef = inject>(MatDialogRef); + data = inject(MAT_DIALOG_DATA); + private formBuilder = inject(UntypedFormBuilder); + + protected conditionLabelService = inject(ConditionLabelService); + private translateService = inject(TranslateService); - layout: { - addButtonText?: string; - } = { + layout: { addButtonText?: string } = { addButtonText: 'Add' }; - depositProductIncentiveForm: UntypedFormGroup; - - title: string; + depositProductIncentiveForm!: UntypedFormGroup; + title!: string; entityTypeData: any; attributeNameData: any; @@ -55,16 +61,11 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit { attributeValueData: any; incentiveTypeData: any; - constructor() { - const data = this.data; - + ngOnInit(): void { this.createDepositProductIncentiveForm(); this.setConditionalControls(); - this.layout = { ...this.layout, ...data.layout }; - this.dialogRef.disableClose = true; - } - ngOnInit() { + this.dialogRef.disableClose = true; this.dialogRef.updateSize('400px'); this.entityTypeData = this.data.chartTemplate.entityTypeOptions; @@ -86,20 +87,24 @@ export class DepositProductIncentiveFormDialogComponent implements OnInit { entityType: this.data.entityType }); } + this.title = this.translateService.instant('labels.heading.Incentives'); } - setConditionalControls() { - this.depositProductIncentiveForm.get('attributeName').valueChanges.subscribe((attributeName: any) => { - this.depositProductIncentiveForm.patchValue({ attributeValue: '' }); - this.attributeValueData = - this.data.chartTemplate[ - `${this.attributeNameData.find((option: any) => option.id === attributeName).code.split('.')[1]}Options` - ]; - }); + setConditionalControls(): void { + this.depositProductIncentiveForm + .get('attributeName') + ?.valueChanges.pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((attributeName: any) => { + this.depositProductIncentiveForm.patchValue({ attributeValue: '' }); + + const option = this.attributeNameData?.find((o: any) => o.id === attributeName); + + this.attributeValueData = option ? this.data.chartTemplate[`${option.code.split('.')[1]}Options`] : []; + }); } - createDepositProductIncentiveForm() { + createDepositProductIncentiveForm(): void { this.depositProductIncentiveForm = this.formBuilder.group({ entityType: [''], attributeName: [ diff --git a/src/app/shared/common-logic/condition-label.service.ts b/src/app/shared/common-logic/condition-label.service.ts new file mode 100644 index 000000000..3da1b98f5 --- /dev/null +++ b/src/app/shared/common-logic/condition-label.service.ts @@ -0,0 +1,37 @@ +/** + * Copyright since 2025 Mifos Initiative + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +import { Injectable, inject } from '@angular/core'; +import { TranslateService } from '@ngx-translate/core'; + +@Injectable({ + providedIn: 'root' +}) +export class ConditionLabelService { + private translateService = inject(TranslateService); + + getConditionLabel(value: string): string { + switch (value?.toLowerCase()) { + case 'lessthan': + return this.translateService.instant('labels.conditions.LessThan'); + + case 'equal': + return this.translateService.instant('labels.conditions.Equal'); + + case 'greterthan': + return this.translateService.instant('labels.conditions.GreaterThan'); + + case 'notequal': + case 'not_equal': + return this.translateService.instant('labels.conditions.NotEqual'); + + default: + return value; + } + } +} diff --git a/src/assets/translations/cs-CS.json b/src/assets/translations/cs-CS.json index 840dab4ea..464d08231 100644 --- a/src/assets/translations/cs-CS.json +++ b/src/assets/translations/cs-CS.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Heslo musí obsahovat alespoň 6 znaků, ne více než 50 znaků, musí obsahovat alespoň jedno velké písmeno, jedno malé písmeno, jednu číslici a žádnou mezeru", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Heslo musí být dlouhé 12 až 50 znaků, obsahovat alespoň jedno velké písmeno, jedno malé písmeno, jednu číslici a jeden speciální znak, bez mezer nebo po sobě jdoucích opakujících se znaků" }, + "conditions": { + "LessThan": "Menší než", + "Equal": "Rovná se", + "GreaterThan": "Větší než", + "NotEqual": "Nerovná se" + }, "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:", "Account Name": "Jméno účtu", diff --git a/src/assets/translations/de-DE.json b/src/assets/translations/de-DE.json index 8343dbaf6..7d9706286 100644 --- a/src/assets/translations/de-DE.json +++ b/src/assets/translations/de-DE.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Das Passwort muss mindestens 6 Zeichen lang sein, nicht mehr als 50 Zeichen, muss mindestens einen Großbuchstaben, einen Kleinbuchstaben, eine Ziffer und kein Leerzeichen enthalten", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Das Passwort muss 12 bis 50 Zeichen lang sein und mindestens einen Großbuchstaben, einen Kleinbuchstaben, eine Ziffer und ein Sonderzeichen enthalten, ohne Leerzeichen oder aufeinanderfolgende wiederholte Zeichen" }, + "conditions": { + "LessThan": "Kleiner als", + "Equal": "Gleich", + "GreaterThan": "Größer als", + "NotEqual": "Ungleich" + }, "heading": { "Account Linked Financial": "Liste der Konten, die mit verschiedenen Finanzaktivitäten verknüpft sind. Um mehr zu erfahren, klicken Sie:", "Account Name": "Kontoname", diff --git a/src/assets/translations/en-US.json b/src/assets/translations/en-US.json index d91e9016a..d9c5c7b3c 100644 --- a/src/assets/translations/en-US.json +++ b/src/assets/translations/en-US.json @@ -885,6 +885,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters" }, + "conditions": { + "LessThan": "Less than", + "Equal": "Equal", + "GreaterThan": "Greater than", + "NotEqual": "Not equal" + }, "heading": { "Account Linked Financial": "List of accounts linked to different financial activities. To know more click:", "Account Name": "Account Name", diff --git a/src/assets/translations/es-CL.json b/src/assets/translations/es-CL.json index ed21bdda0..b2239d901 100644 --- a/src/assets/translations/es-CL.json +++ b/src/assets/translations/es-CL.json @@ -880,6 +880,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "La contraseña debe tener al menos 6 caracteres, no más de 50 caracteres, debe incluir al menos una letra mayúscula, una letra minúscula, un dígito numérico y ningún espacio", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "La contraseña debe tener entre 12 y 50 caracteres, conteniendo al menos una letra mayúscula, una letra minúscula, un dígito numérico y un carácter especial, sin espacios ni caracteres repetidos consecutivos" }, + "conditions": { + "LessThan": "Menor que", + "Equal": "Igual", + "GreaterThan": "Mayor que", + "NotEqual": "No igual" + }, "heading": { "Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:", "Account Name": "Nombre de la cuenta", diff --git a/src/assets/translations/es-MX.json b/src/assets/translations/es-MX.json index 0cf53e334..7779bf1d9 100644 --- a/src/assets/translations/es-MX.json +++ b/src/assets/translations/es-MX.json @@ -880,6 +880,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "La contraseña debe tener al menos 6 caracteres, no más de 50 caracteres, debe incluir al menos una letra mayúscula, una letra minúscula, un dígito numérico y ningún espacio", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "La contraseña debe tener entre 12 y 50 caracteres, conteniendo al menos una letra mayúscula, una letra minúscula, un dígito numérico y un carácter especial, sin espacios ni caracteres repetidos consecutivos" }, + "conditions": { + "LessThan": "Menor que", + "Equal": "Igual", + "GreaterThan": "Mayor que", + "NotEqual": "No igual" + }, "heading": { "Account Linked Financial": "Listado de cuentas vinculadas a diferentes actividades financieras. Para saber más haga clic en:", "Account Name": "Nombre de la cuenta", diff --git a/src/assets/translations/fr-FR.json b/src/assets/translations/fr-FR.json index e67794f6a..8584192ac 100644 --- a/src/assets/translations/fr-FR.json +++ b/src/assets/translations/fr-FR.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Le mot de passe doit contenir au moins 6 caractères, pas plus de 50 caractères, doit inclure au moins une lettre majuscule, une lettre minuscule, un chiffre et aucun espace", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Le mot de passe doit contenir entre 12 et 50 caractères, incluant au moins une lettre majuscule, une lettre minuscule, un chiffre et un caractère spécial, sans espaces ni caractères répétés consécutifs" }, + "conditions": { + "LessThan": "Inférieur à", + "Equal": "Égal", + "GreaterThan": "Supérieur à", + "NotEqual": "Différent de" + }, "heading": { "Account Linked Financial": "Liste des comptes liés aux différentes activités financières. Pour en savoir plus cliquez :", "Account Name": "Nom du compte", diff --git a/src/assets/translations/it-IT.json b/src/assets/translations/it-IT.json index 31f6441f5..d041cad64 100644 --- a/src/assets/translations/it-IT.json +++ b/src/assets/translations/it-IT.json @@ -880,6 +880,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "La password deve contenere almeno 6 caratteri, non più di 50 caratteri, deve includere almeno una lettera maiuscola, una lettera minuscola, una cifra numerica e nessuno spazio", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "La password deve contenere tra 12 e 50 caratteri, contenente almeno una lettera maiuscola, una lettera minuscola, una cifra numerica e un carattere speciale, senza spazi o caratteri ripetuti consecutivi" }, + "conditions": { + "LessThan": "Minore di", + "Equal": "Uguale", + "GreaterThan": "Maggiore di", + "NotEqual": "Diverso da" + }, "heading": { "Account Linked Financial": "Elenco dei conti collegati a diverse attività finanziarie. Per saperne di più clicca:", "Account Name": "Nome utente", diff --git a/src/assets/translations/ko-KO.json b/src/assets/translations/ko-KO.json index e26c6cdd5..9d8569c46 100644 --- a/src/assets/translations/ko-KO.json +++ b/src/assets/translations/ko-KO.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "비밀번호는 최소 6자 이상 50자 이하여야 하며, 최소 하나의 대문자, 하나의 소문자, 하나의 숫자 및 공백이 없어야 합니다", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "비밀번호는 12자 이상 50자 이하여야 하며, 최소 하나의 대문자, 하나의 소문자, 하나의 숫자 및 하나의 특수 문자를 포함해야 하며, 공백이나 연속된 반복 문자는 없어야 합니다" }, + "conditions": { + "LessThan": "보다 작음", + "Equal": "같음", + "GreaterThan": "보다 큼", + "NotEqual": "같지 않음" + }, "heading": { "Account Linked Financial": "다양한 금융 활동과 연결된 계정 목록입니다. 자세한 내용을 보려면 다음을 클릭하세요.", "Account Name": "계정 이름", diff --git a/src/assets/translations/lt-LT.json b/src/assets/translations/lt-LT.json index 58b9115be..c8e521d1c 100644 --- a/src/assets/translations/lt-LT.json +++ b/src/assets/translations/lt-LT.json @@ -879,6 +879,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Slaptažodis turi būti ne mažiau kaip 6 simboliai, ne daugiau kaip 50 simbolių, turi būti bent viena didžioji raidė, viena mažoji raidė, vienas skaitmuo ir neturėti tarpų", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Slaptažodis turi būti nuo 12 iki 50 simbolių, turėti bent vieną didžiąją raidę, vieną mažąją raidę, vieną skaitmenį ir vieną specialųjį simbolį, be tarpų arba iš eilės einančių pasikartojančių simbolių" }, + "conditions": { + "LessThan": "Mažiau nei", + "Equal": "Lygu", + "GreaterThan": "Daugiau nei", + "NotEqual": "Nelygu" + }, "heading": { "Account Linked Financial": "Sąskaitų, susietų su įvairia finansine veikla, sąrašas. Norėdami sužinoti daugiau, spustelėkite:", "Account Name": "Paskyros vardas", diff --git a/src/assets/translations/lv-LV.json b/src/assets/translations/lv-LV.json index 2b809fb5b..484b64d22 100644 --- a/src/assets/translations/lv-LV.json +++ b/src/assets/translations/lv-LV.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Parolei jābūt vismaz 6 rakstzīmēm, ne vairāk kā 50 rakstzīmēm, jāiekļauj vismaz viens lielais burts, viens mazais burts, viens cipars un nedrīkst būt atstarpes", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Parolei jābūt no 12 līdz 50 rakstzīmēm, jāiekļauj vismaz viens lielais burts, viens mazais burts, viens cipars un viens speciāls rakstzīme, bez atstarpēm vai secīgiem atkārtotiem rakstzīmēm" }, + "conditions": { + "LessThan": "Mazāks nekā", + "Equal": "Vienāds", + "GreaterThan": "Lielāks nekā", + "NotEqual": "Nevienāds" + }, "heading": { "Account Linked Financial": "Ar dažādām finanšu darbībām saistīto kontu saraksts. Lai uzzinātu vairāk, noklikšķiniet:", "Account Name": "Konta vārds", diff --git a/src/assets/translations/ne-NE.json b/src/assets/translations/ne-NE.json index 59268ebf6..f72abbfad 100644 --- a/src/assets/translations/ne-NE.json +++ b/src/assets/translations/ne-NE.json @@ -879,6 +879,13 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "पासवर्ड कम्तिमा ६ क्यारेक्टर, ५० क्यारेक्टरभन्दा बढी नहुने, कम्तिमा एक अपरकेस अक्षर, एक लोअरकेस अक्षर, एक संख्यात्मक अंक र कुनै खाली ठाउँ नहुने हुनुपर्छ", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "पासवर्ड १२ देखि ५० क्यारेक्टर लामो हुनुपर्छ, जसमा कम्तिमा एक अपरकेस अक्षर, एक लोअरकेस अक्षर, एक संख्यात्मक अंक, र एक विशेष क्यारेक्टर हुनुपर्छ, कुनै खाली ठाउँ वा लगातार दोहोरिएका क्यारेक्टरहरू नहुने" }, + "conditions": { + "LessThan": "भन्दा कम", + "Equal": "बराबर", + "GreaterThan": "भन्दा ठुलो", + "NotEqual": "बराबर छैन" + }, + "heading": { "Account Linked Financial": "विभिन्न वित्तीय गतिविधिहरु संग जोडिएको खाताहरु को सूची। थप जान्नको लागि क्लिक गर्नुहोस्:", "Account Name": "खाताको नाम", diff --git a/src/assets/translations/pt-PT.json b/src/assets/translations/pt-PT.json index e1428510d..8f33dd01a 100644 --- a/src/assets/translations/pt-PT.json +++ b/src/assets/translations/pt-PT.json @@ -881,6 +881,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "A senha deve ter pelo menos 6 caracteres, não mais que 50 caracteres, deve incluir pelo menos uma letra maiúscula, uma letra minúscula, um dígito numérico e nenhum espaço", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "A senha deve ter entre 12 e 50 caracteres, contendo pelo menos uma letra maiúscula, uma letra minúscula, um dígito numérico e um caractere especial, sem espaços ou caracteres repetidos consecutivos" }, + "conditions": { + "LessThan": "Menor que", + "Equal": "Igual", + "GreaterThan": "Maior que", + "NotEqual": "Diferente de" + }, "heading": { "Account Linked Financial": "Lista de contas vinculadas a diferentes atividades financeiras. Para saber mais clique:", "Account Name": "Nome da conta", diff --git a/src/assets/translations/sw-SW.json b/src/assets/translations/sw-SW.json index 171392870..239fd1f57 100644 --- a/src/assets/translations/sw-SW.json +++ b/src/assets/translations/sw-SW.json @@ -725,8 +725,6 @@ "LOAN_PROVISIONING": "Utoaji wa Mkopo", "Loan Interest Recalculation": "Uhesabuji wa Riba ya Mkopo", "Reamortization": "Remortization", - "equals": "sawa", - "greater than": "kubwa kuliko", "Equal installments": "Awamu sawa", "Equal principal payments": "Malipo ya msingi sawa", "Till Pre-Close Date": "Hadi Tarehe ya Kufungwa", @@ -881,6 +879,12 @@ "Password must be at least 6 characters, no more than 50 characters long, must include at least one upper case letter, one lower case letter, one numeric digit and no space": "Nenosiri lazima liwe na angalau herufi 6, si zaidi ya herufi 50, lazima liwe na angalau herufi moja kubwa, herufi moja ndogo, nambari moja na hakuna nafasi", "Password must be 12 to 50 characters long, containing at least one uppercase letter, one lowercase letter, one numeric digit, and one special character, with no spaces or consecutive repeating characters": "Nenosiri lazima liwe na herufi 12 hadi 50, likiwa na angalau herufi moja kubwa, herufi moja ndogo, nambari moja na herufi maalum moja, bila nafasi au herufi zinazorudiwa mfululizo" }, + "conditions": { + "LessThan": "Chini ya", + "Equal": "Sawa", + "GreaterThan": "Zaidi ya", + "NotEqual": "Sio sawa" + }, "heading": { "Account Linked Financial": "Orodha ya akaunti zilizounganishwa na shughuli tofauti za kifedha. Kujua zaidi bofya:", "Account Name": "Jina la Akaunti",