Skip to content

WEB-916 Align Loan Product Currency Form with Product Form#3493

Merged
IOhacker merged 1 commit intoopenMF:devfrom
JaySoni1:WEB-916-align-loan-product-currency-form-with-product-form
Apr 26, 2026
Merged

WEB-916 Align Loan Product Currency Form with Product Form#3493
IOhacker merged 1 commit intoopenMF:devfrom
JaySoni1:WEB-916-align-loan-product-currency-form-with-product-form

Conversation

@JaySoni1
Copy link
Copy Markdown
Contributor

@JaySoni1 JaySoni1 commented Apr 10, 2026

Changes Made :-

-Aligned Loan Product Currency form with product by adding a conditional checkbox to control "Currency in multiples of" field visibility.
-Changed Decimal Places to default to empty .

WEB-916

Before :-
image

After :-
image

Summary by CodeRabbit

  • New Features

    • Added a toggle to enable/disable currency multiples and made both currency and installment multiples available in the form.
    • Installment multiples input is now always shown within the same section.
    • Tooltip added to the installment multiples input.
  • Bug Fixes

    • Conditional required and minimum-value validation applied or cleared based on the toggle.
    • Validation error messages now render for both currency and installment multiples.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 10, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

Added a setMultiples checkbox and corresponding form control logic; moved currency and installment "in multiples of" fields behind that checkbox, normalized control names, applied dynamic required+min validators when enabled, lifecycle-managed the subscription with DestroyRef, and adjusted loanProductCurrency mapping to include or nullify multiples fields.

Changes

Cohort / File(s) Summary
Template
src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html
Replaced always-visible currency multiples input with a mat-checkbox bound to setMultiples; conditionally render inMultiplesOf/installmentInMultiplesOf; removed loanProductService.isLoanProduct guard; added tooltip and required/min error messages.
Component logic
src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts
Added setMultiples form control and setupConditionalValidation() to toggle required + min(1) validators and clear values when unchecked; replaced installmentAmountInMultiplesOf with installmentInMultiplesOf; digits-after-decimal only set when editing template; subscription uses takeUntilDestroyed(this.destroyRef); loanProductCurrency now explicitly includes/nullifies multiples fields.
Imports / DI
src/app/.../loan-product-currency-step.component.ts
Component now imports/injects DestroyRef (and template references updated to use MatCheckbox), to manage lifecycle of the setMultiples subscription.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • IOhacker
  • alberto-art3ch
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: aligning the Loan Product Currency form with the Product form by adding a conditional checkbox control for the currency multiples field.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html`:
- Around line 54-80: The change removed the companion installment-multiple
control when setMultiples is true; restore a second form field and form control
for the installment multiple (add a formControlName like
"installmentInMultiplesOf" alongside the existing "inMultiplesOf" in the
loanProductCurrencyForm when loanProductCurrencyForm.value.setMultiples is
true), include the same number input, min=1 and required validators and
corresponding mat-error blocks (check for hasError('min') and
hasError('required')), ensure the form group initialization adds this control,
and update the TS payload builder (the function that assembles the loan product
payload) to include the installment multiple property when setMultiples is
enabled so both the loan and its installment values are preserved.

In
`@src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts`:
- Around line 112-121: The loanProductCurrency getter currently omits
inMultiplesOf when the multiples checkbox is unchecked, which fails to clear the
server value on edit; update the getter (loanProductCurrency) to always include
the inMultiplesOf property: if the form control that toggles multiples (e.g.,
loanProductCurrencyForm.controls['setMultiples'] or formValue.setMultiples) is
false, set result.inMultiplesOf = null, otherwise set it to
formValue.inMultiplesOf (keeping the existing guard for empty/undefined values)
so the payload explicitly signals clearing the field.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 426faddc-7814-4489-9a0b-718c3a50670c

📥 Commits

Reviewing files that changed from the base of the PR and between 62acfd6 and 9dae486.

📒 Files selected for processing (2)
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts

@JaySoni1 JaySoni1 force-pushed the WEB-916-align-loan-product-currency-form-with-product-form branch from 9dae486 to ad59ebb Compare April 10, 2026 01:24
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts`:
- Around line 58-63: The checkbox initialization only reads
loanProductsTemplate.inMultiplesOf, so setMultiples should be derived from
either persisted field to avoid wiping installmentInMultiplesOf; change the
patchValue call in loanProductCurrencyForm.patchValue to set setMultiples:
!!(this.loanProductsTemplate.inMultiplesOf ||
this.loanProductsTemplate.installmentInMultiplesOf) so the form reflects an
existing installmentInMultiplesOf and preserves it during serialization by
LoanProductCurrency logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0e1a6019-374f-41eb-b15f-d72844660607

📥 Commits

Reviewing files that changed from the base of the PR and between 9dae486 and ad59ebb.

📒 Files selected for processing (2)
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html

@JaySoni1 JaySoni1 force-pushed the WEB-916-align-loan-product-currency-form-with-product-form branch from ad59ebb to 1c1768c Compare April 10, 2026 01:37
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts (1)

129-132: Consider defining an interface for the return type.

Using any for result bypasses type checking. Consider defining a LoanProductCurrencyPayload interface to ensure field names and types remain consistent with the API contract.

interface LoanProductCurrencyPayload {
  currencyCode: string;
  digitsAfterDecimal: string | number;
  inMultiplesOf: number | null;
  installmentInMultiplesOf: number | null;
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts`
around lines 129 - 132, Replace the ad-hoc any-typed result with a typed
payload: declare a LoanProductCurrencyPayload interface (as suggested) and use
it for the result variable in loan-product-currency-step.component.ts so the
object returned from the currency step has typed properties currencyCode:
string, digitsAfterDecimal: string | number, inMultiplesOf: number | null and
installmentInMultiplesOf: number | null; update the const result declaration to
be typed as LoanProductCurrencyPayload and populate the additional fields
(inMultiplesOf, installmentInMultiplesOf) with the appropriate values or null to
match the API contract.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts`:
- Around line 129-132: Replace the ad-hoc any-typed result with a typed payload:
declare a LoanProductCurrencyPayload interface (as suggested) and use it for the
result variable in loan-product-currency-step.component.ts so the object
returned from the currency step has typed properties currencyCode: string,
digitsAfterDecimal: string | number, inMultiplesOf: number | null and
installmentInMultiplesOf: number | null; update the const result declaration to
be typed as LoanProductCurrencyPayload and populate the additional fields
(inMultiplesOf, installmentInMultiplesOf) with the appropriate values or null to
match the API contract.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 732c0910-9a3b-4917-a5da-54ed69a250a0

📥 Commits

Reviewing files that changed from the base of the PR and between ad59ebb and 1c1768c.

📒 Files selected for processing (2)
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.ts
✅ Files skipped from review due to trivial changes (1)
  • src/app/products/loan-products/loan-product-stepper/loan-product-currency-step/loan-product-currency-step.component.html

Copy link
Copy Markdown
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@IOhacker
Copy link
Copy Markdown
Contributor

@JaySoni1 thank you for your efforts!

@IOhacker IOhacker merged commit bd48f54 into openMF:dev Apr 26, 2026
6 checks passed
@JaySoni1
Copy link
Copy Markdown
Contributor Author

@IOhacker Thank You for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants