From 58adc0a7d8a9e076b68062ad7b398be08de7bc4d Mon Sep 17 00:00:00 2001 From: Soni Jay Date: Wed, 4 Feb 2026 01:22:09 +0530 Subject: [PATCH] WEB-632-loan-product-default-empty-multiples-fields (#3084) --- .../loan-product-summary.component.html | 22 +++-- .../loan-product-currency-step.component.html | 68 +++++++------- .../loan-product-currency-step.component.ts | 90 +++++++++++++++---- src/assets/translations/cs-CS.json | 1 + src/assets/translations/de-DE.json | 1 + src/assets/translations/en-US.json | 1 + src/assets/translations/es-CL.json | 1 + src/assets/translations/es-MX.json | 1 + src/assets/translations/fr-FR.json | 1 + src/assets/translations/it-IT.json | 1 + src/assets/translations/ko-KO.json | 1 + src/assets/translations/lt-LT.json | 1 + src/assets/translations/lv-LV.json | 1 + src/assets/translations/ne-NE.json | 1 + src/assets/translations/pt-PT.json | 1 + src/assets/translations/sw-SW.json | 1 + 16 files changed, 138 insertions(+), 55 deletions(-) diff --git a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html index 717a72cf1..0a7c106d5 100644 --- a/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html +++ b/src/app/products/loan-products/common/loan-product-summary/loan-product-summary.component.html @@ -61,16 +61,20 @@
{{ 'labels.inputs.Decimal Places' | translate }}: - {{ loanProduct.currency.decimalPlaces }} -
-
- {{ 'labels.inputs.Currency in multiples of' | translate }}: - {{ loanProduct.currency.inMultiplesOf }} -
-
- {{ 'labels.inputs.Installment in multiples of' | translate }}: - {{ loanProduct.installmentAmountInMultiplesOf }} + {{ loanProduct.digitsAfterDecimal ?? loanProduct.currency.decimalPlaces }}
+ @if (loanProduct.inMultiplesOf || loanProduct.currency?.inMultiplesOf) { +
+ {{ 'labels.inputs.Currency in multiples of' | translate }}: + {{ loanProduct.inMultiplesOf ?? loanProduct.currency.inMultiplesOf }} +
+ } + @if (loanProduct.installmentAmountInMultiplesOf) { +
+ {{ 'labels.inputs.Installment in multiples of' | translate }}: + {{ loanProduct.installmentAmountInMultiplesOf }} +
+ }

{{ 'labels.heading.Terms' | translate }}

diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html b/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html index 8bb90bd04..2e75dfabc 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html @@ -47,38 +47,44 @@ - - {{ 'labels.inputs.Currency in multiples of' | translate }} - - - {{ 'labels.inputs.Currency in multiples of' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - {{ 'labels.inputs.Currency in multiples of' | translate }} - {{ 'labels.commons.Minimum Value must be' | translate }} 1 - - + + {{ 'labels.inputs.Set the multiples of the loan and its installment' | translate }} + - - {{ 'labels.inputs.Installment in multiples of' | translate }} - - - {{ 'labels.inputs.Installment in multiples of' | translate }} {{ 'labels.commons.is' | translate }} - {{ 'labels.commons.required' | translate }} - - - {{ 'labels.inputs.Installment in multiples of' | translate }} - {{ 'labels.commons.Minimum Value must be' | translate }} 1 - - + @if (loanProductCurrencyForm.value.setMultiples) { + + {{ 'labels.inputs.Currency in multiples of' | translate }} + + + {{ 'labels.inputs.Currency in multiples of' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + {{ 'labels.inputs.Currency in multiples of' | translate }} + {{ 'labels.commons.Minimum Value must be' | translate }} 1 + + + + + {{ 'labels.inputs.Installment in multiples of' | translate }} + + + {{ 'labels.inputs.Installment in multiples of' | translate }} {{ 'labels.commons.is' | translate }} + {{ 'labels.commons.required' | translate }} + + + {{ 'labels.inputs.Installment in multiples of' | translate }} + {{ 'labels.commons.Minimum Value must be' | translate }} 1 + + + }
diff --git a/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts b/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts index 7334e487c..b89fdc193 100644 --- a/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts +++ b/src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts @@ -9,6 +9,7 @@ import { Component, OnInit, Input, inject } from '@angular/core'; import { UntypedFormGroup, UntypedFormBuilder, Validators, ReactiveFormsModule } from '@angular/forms'; import { MatTooltip } from '@angular/material/tooltip'; +import { MatCheckbox } from '@angular/material/checkbox'; import { MatStepperPrevious, MatStepperNext } from '@angular/material/stepper'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; @@ -20,6 +21,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; imports: [ ...STANDALONE_SHARED_IMPORTS, MatTooltip, + MatCheckbox, MatStepperPrevious, FaIconComponent, MatStepperNext @@ -48,6 +50,11 @@ export class LoanProductCurrencyStepComponent implements OnInit { this.loanProductsTemplate.currency.decimalPlaces === null ? '' : this.loanProductsTemplate.currency.decimalPlaces, + setMultiples: !!( + (this.loanProductsTemplate.currency.inMultiplesOf && this.loanProductsTemplate.currency.inMultiplesOf !== 0) || + (this.loanProductsTemplate.installmentAmountInMultiplesOf && + this.loanProductsTemplate.installmentAmountInMultiplesOf !== 0) + ), inMultiplesOf: this.loanProductsTemplate.currency.inMultiplesOf === 0 || this.loanProductsTemplate.currency.inMultiplesOf === undefined || @@ -61,6 +68,50 @@ export class LoanProductCurrencyStepComponent implements OnInit { ? '' : this.loanProductsTemplate.installmentAmountInMultiplesOf }); + + this.setupConditionalValidation(); + } + + setupConditionalValidation() { + this.loanProductCurrencyForm.get('setMultiples')?.valueChanges.subscribe((setMultiples: boolean) => { + const inMultiplesOfControl = this.loanProductCurrencyForm.get('inMultiplesOf'); + const installmentControl = this.loanProductCurrencyForm.get('installmentAmountInMultiplesOf'); + + if (setMultiples) { + inMultiplesOfControl?.setValidators([ + Validators.required, + Validators.min(1) + ]); + installmentControl?.setValidators([ + Validators.required, + Validators.min(1) + ]); + } else { + inMultiplesOfControl?.clearValidators(); + installmentControl?.clearValidators(); + inMultiplesOfControl?.setValue(''); + installmentControl?.setValue(''); + } + + inMultiplesOfControl?.updateValueAndValidity(); + installmentControl?.updateValueAndValidity(); + }); + + const initialSetMultiples = this.loanProductCurrencyForm.get('setMultiples')?.value; + if (initialSetMultiples) { + const inMultiplesOfControl = this.loanProductCurrencyForm.get('inMultiplesOf'); + const installmentControl = this.loanProductCurrencyForm.get('installmentAmountInMultiplesOf'); + inMultiplesOfControl?.setValidators([ + Validators.required, + Validators.min(1) + ]); + installmentControl?.setValidators([ + Validators.required, + Validators.min(1) + ]); + inMultiplesOfControl?.updateValueAndValidity(); + installmentControl?.updateValueAndValidity(); + } } createLoanProductCurrencyForm() { @@ -76,24 +127,33 @@ export class LoanProductCurrencyStepComponent implements OnInit { Validators.min(0) ] ], - inMultiplesOf: [ - '', - [ - Validators.required, - Validators.min(1) - ] - ], - installmentAmountInMultiplesOf: [ - '', - [ - Validators.required, - Validators.min(1) - ] - ] + setMultiples: [false], + inMultiplesOf: [''], + installmentAmountInMultiplesOf: [''] }); } get loanProductCurrency() { - return this.loanProductCurrencyForm.value; + const formValue = this.loanProductCurrencyForm.value; + const result: any = { + currencyCode: formValue.currencyCode, + digitsAfterDecimal: formValue.digitsAfterDecimal + }; + + if (formValue.setMultiples) { + if (formValue.inMultiplesOf !== '' && formValue.inMultiplesOf !== null && formValue.inMultiplesOf !== undefined) { + result.inMultiplesOf = formValue.inMultiplesOf; + } + + if ( + formValue.installmentAmountInMultiplesOf !== '' && + formValue.installmentAmountInMultiplesOf !== null && + formValue.installmentAmountInMultiplesOf !== undefined + ) { + result.installmentAmountInMultiplesOf = formValue.installmentAmountInMultiplesOf; + } + } + + return result; } } diff --git a/src/assets/translations/cs-CS.json b/src/assets/translations/cs-CS.json index 147fc49b4..54936ef61 100644 --- a/src/assets/translations/cs-CS.json +++ b/src/assets/translations/cs-CS.json @@ -1578,6 +1578,7 @@ "Currency Multiple": "Násobek měn", "Currency Name": "Název měny", "Currency in multiples of": "Měna v násobcích", + "Set the multiples of the loan and its installment": "Nastavit násobky půjčky a její splátky", "Current Balance": "Aktuální zůstatek", "Current Balances": "Aktuální zůstatky", "Current Business Date": "Aktuální obchodní datum", diff --git a/src/assets/translations/de-DE.json b/src/assets/translations/de-DE.json index faad02c33..a3505b7e7 100644 --- a/src/assets/translations/de-DE.json +++ b/src/assets/translations/de-DE.json @@ -1580,6 +1580,7 @@ "Currency Multiple": "Währungsmultiplikator", "Currency Name": "Währungsname", "Currency in multiples of": "Währung in Vielfachen von", + "Set the multiples of the loan and its installment": "Die Vielfachen des Darlehens und seiner Rate festlegen", "Current Balance": "Aktueller Kontostand", "Current Balances": "Aktuelle Guthaben", "Current Business Date": "Aktuelles Geschäftsdatum", diff --git a/src/assets/translations/en-US.json b/src/assets/translations/en-US.json index 62f6a5624..b993d69d0 100644 --- a/src/assets/translations/en-US.json +++ b/src/assets/translations/en-US.json @@ -1584,6 +1584,7 @@ "Currency Multiple": "Currency Multiple", "Currency Name": "Currency Name", "Currency in multiples of": "Currency in multiples of", + "Set the multiples of the loan and its installment": "Set the multiples of the loan and its installment", "Current Balance": "Current Balance", "Current Balances": "Current Balances", "Current Business Date": "Current Business Date", diff --git a/src/assets/translations/es-CL.json b/src/assets/translations/es-CL.json index 62bf983e5..6eb3bd932 100644 --- a/src/assets/translations/es-CL.json +++ b/src/assets/translations/es-CL.json @@ -1580,6 +1580,7 @@ "Currency Multiple": "Moneda múltiple", "Currency Name": "Nombre de la moneda", "Currency in multiples of": "Moneda en múltiplos de", + "Set the multiples of the loan and its installment": "Establecer los múltiplos del préstamo y su cuota", "Current Balance": "Saldo actual", "Current Balances": "Saldos actuales", "Current Business Date": "Fecha del sistema actual", diff --git a/src/assets/translations/es-MX.json b/src/assets/translations/es-MX.json index d382b579b..f13cace8f 100644 --- a/src/assets/translations/es-MX.json +++ b/src/assets/translations/es-MX.json @@ -1579,6 +1579,7 @@ "Currency Multiple": "Moneda múltiple", "Currency Name": "Nombre de la moneda", "Currency in multiples of": "Moneda en múltiplos de", + "Set the multiples of the loan and its installment": "Establecer los múltiplos del crédito y su cuota", "Current Balance": "Saldo actual", "Current Balances": "Saldos actuales", "Current Business Date": "Fecha del sistema actual", diff --git a/src/assets/translations/fr-FR.json b/src/assets/translations/fr-FR.json index 619b61e78..e71e790cb 100644 --- a/src/assets/translations/fr-FR.json +++ b/src/assets/translations/fr-FR.json @@ -1580,6 +1580,7 @@ "Currency Multiple": "Devise multiple", "Currency Name": "Nom de la devise", "Currency in multiples of": "Monnaie en multiples de", + "Set the multiples of the loan and its installment": "Définir les multiples du prêt et de son versement", "Current Balance": "Solde actuel", "Current Balances": "Soldes courants", "Current Business Date": "Date d'ouverture actuelle", diff --git a/src/assets/translations/it-IT.json b/src/assets/translations/it-IT.json index 12b7e38f9..e688402d8 100644 --- a/src/assets/translations/it-IT.json +++ b/src/assets/translations/it-IT.json @@ -1579,6 +1579,7 @@ "Currency Multiple": "Valuta multipla", "Currency Name": "Nome della valuta", "Currency in multiples of": "Valuta in multipli di", + "Set the multiples of the loan and its installment": "Imposta i multipli del prestito e della sua rata", "Current Balance": "Bilancio corrente", "Current Balances": "Saldi correnti", "Current Business Date": "Data lavorativa corrente", diff --git a/src/assets/translations/ko-KO.json b/src/assets/translations/ko-KO.json index 2c5c0f8af..633fe14d0 100644 --- a/src/assets/translations/ko-KO.json +++ b/src/assets/translations/ko-KO.json @@ -1581,6 +1581,7 @@ "Currency Multiple": "통화 배수", "Currency Name": "통화 이름", "Currency in multiples of": "통화의 배수", + "Set the multiples of the loan and its installment": "대출 및 할부금의 배수 설정", "Current Balance": "현재의 균형", "Current Balances": "현재 잔액", "Current Business Date": "현재 영업일", diff --git a/src/assets/translations/lt-LT.json b/src/assets/translations/lt-LT.json index 2e7007e06..32d7cda86 100644 --- a/src/assets/translations/lt-LT.json +++ b/src/assets/translations/lt-LT.json @@ -1578,6 +1578,7 @@ "Currency Multiple": "Keli valiuta", "Currency Name": "Valiutos pavadinimas", "Currency in multiples of": "Valiuta kartotiniais", + "Set the multiples of the loan and its installment": "Nustatyti paskolos ir jos įmokos kartotinius", "Current Balance": "Dabartinis balansas", "Current Balances": "Dabartiniai likučiai", "Current Business Date": "Dabartinė verslo data", diff --git a/src/assets/translations/lv-LV.json b/src/assets/translations/lv-LV.json index a9011eb1e..074e2cf35 100644 --- a/src/assets/translations/lv-LV.json +++ b/src/assets/translations/lv-LV.json @@ -1580,6 +1580,7 @@ "Currency Multiple": "Valūta vairākas", "Currency Name": "Valūtas nosaukums", "Currency in multiples of": "Valūta daudzkārtnēs", + "Set the multiples of the loan and its installment": "Iestatīt aizdevuma un tā maksājuma daudzkārtņus", "Current Balance": "Pašreizējā bilance", "Current Balances": "Pašreizējie atlikumi", "Current Business Date": "Pašreizējais darba datums", diff --git a/src/assets/translations/ne-NE.json b/src/assets/translations/ne-NE.json index 961ff2667..5f8fe93f7 100644 --- a/src/assets/translations/ne-NE.json +++ b/src/assets/translations/ne-NE.json @@ -1578,6 +1578,7 @@ "Currency Multiple": "मुद्रा बहु", "Currency Name": "मुद्रा नाम", "Currency in multiples of": "को गुणनमा मुद्रा", + "Set the multiples of the loan and its installment": "ऋण र यसको किस्ताको गुणन सेट गर्नुहोस्", "Current Balance": "हालको मौज्दात", "Current Balances": "हालको ब्यालेन्स", "Current Business Date": "हालको व्यापार मिति", diff --git a/src/assets/translations/pt-PT.json b/src/assets/translations/pt-PT.json index d6dc9b11d..a646678c2 100644 --- a/src/assets/translations/pt-PT.json +++ b/src/assets/translations/pt-PT.json @@ -1579,6 +1579,7 @@ "Currency Multiple": "Múltipla Moeda", "Currency Name": "Nome da moeda", "Currency in multiples of": "Moeda em múltiplos de", + "Set the multiples of the loan and its installment": "Definir os múltiplos do empréstimo e sua prestação", "Current Balance": "Saldo Atual", "Current Balances": "Saldos Atuais", "Current Business Date": "Data comercial atual", diff --git a/src/assets/translations/sw-SW.json b/src/assets/translations/sw-SW.json index 87aa69291..37baf6faa 100644 --- a/src/assets/translations/sw-SW.json +++ b/src/assets/translations/sw-SW.json @@ -1576,6 +1576,7 @@ "Currency Multiple": "Sarafu Nyingi", "Currency Name": "Jina la Sarafu", "Currency in multiples of": "Sarafu katika mafungu ya", + "Set the multiples of the loan and its installment": "Weka mafungu ya mkopo na awamu yake", "Current Balance": "Salio la Sasa", "Current Balances": "Mizani ya Sasa", "Current Business Date": "Tarehe ya Biashara ya Sasa",