Skip to content

WEB-76: Smaller text issues when editing Fixed Deposit Products#3014

Merged
IOhacker merged 1 commit intoopenMF:devfrom
parth-sharma-10:fix-incentive-condition-label
Jan 23, 2026
Merged

WEB-76: Smaller text issues when editing Fixed Deposit Products#3014
IOhacker merged 1 commit intoopenMF:devfrom
parth-sharma-10:fix-incentive-condition-label

Conversation

@parth-sharma-10
Copy link
Contributor

@parth-sharma-10 parth-sharma-10 commented Jan 19, 2026

WEB-76
What was changed
Updated the incentive condition dropdown to display user-friendly
labels instead of raw backend enum values.

Why this change was needed
The backend returns values such as greterthan, which were previously
rendered directly in the UI. This caused confusing labels to appear
during Fixed Deposit configuration.

What was done
Mapped backend condition values to readable UI labels
Ensured no backend or API behavior was modified
Related issues
Fixes: WEB-359
Screenshot 2026-01-19 at 8 07 19 PM

Summary by CodeRabbit

  • New Features

    • Localized condition labeling added so comparison operators show user-friendly translations.
  • Improvements

    • Deposit product incentive dialog/form lifecycle and cleanup made more robust for smoother form interactions.
  • Chores (Localization)

    • Added "conditions" translations across many locales.
    • Consolidated Swahili translations into the new conditions group and removed legacy standalone keys.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Warning

Rate limit exceeded

@parth-sharma-10 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 30 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

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

Select option labels for condition types now resolve via a new ConditionLabelService; the deposit product incentive component was refactored to initialize in ngOnInit and use DestroyRef-based cleanup; many locale JSON files gained a conditions translations object. (49 words)

Changes

Cohort / File(s) Summary
Component — template & logic
src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html, src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts
Template option labels call conditionLabelService.getConditionLabel(conditionType.value); component refactored to use ngOnInit, DestroyRef/takeUntilDestroyed, new methods createDepositProductIncentiveForm() & setConditionalControls(), dialogRef made private, and FormBuilder & ConditionLabelService injected.
New service — label mapping
src/app/shared/common-logic/condition-label.service.ts
Added ConditionLabelService with getConditionLabel(value: string): string that normalizes input and uses TranslateService.instant to resolve labels.conditions.*. (Check for stray brace/syntax in diff.)
Translations — added (many locales)
src/assets/translations/.../*.json
src/assets/translations/en-US.json, de-DE.json, fr-FR.json, it-IT.json, es-CL.json, es-MX.json, pt-PT.json, ne-NE.json, ko-KO.json, lt-LT.json, lv-LV.json, cs-CS.json, ...
Added a conditions object with keys LessThan, Equal, GreaterThan, NotEqual and locale strings across multiple translation files.
Translations — reworked (Swahili)
src/assets/translations/sw-SW.json
Removed legacy keys (equals, greater than) and replaced/added a consolidated conditions object with the four comparison keys.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Template as "Template\n(dropdown)"
    participant Component as "DepositProductIncentive\nComponent"
    participant Service as "ConditionLabelService"
    participant Translate as "TranslateService"
    participant Translations as "Locale JSON"

    User->>Template: render dropdown
    Template->>Component: request label for conditionType.value
    Component->>Service: getConditionLabel(conditionType.value)
    Service->>Translate: instant('labels.conditions.<Key>')
    Translate->>Translations: lookup key
    Translations-->>Translate: localized string
    Translate-->>Service: localized label
    Service-->>Component: label string
    Component-->>Template: return label for rendering
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

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 identifies the ticket (WEB-76) and describes the main fix: improving text labels when editing Fixed Deposit Products, which aligns with the core change of replacing raw enum values with user-friendly condition labels.
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.


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

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/assets/translations/de-DE.json (1)

872-884: Fix missing commas to keep JSON valid.

The new "conditions" block appears to be added without commas separating sibling keys (after passwordPreferences and after conditions), which would make the JSON invalid and break translation loading.

🛠️ Minimal fix
-    }
+    },
     "conditions": {
       "LessThan": "Kleiner als",
       "Equal": "Gleich",
       "GreaterThan": "Größer als",
       "NotEqual": "Ungleich"
-    }
+    },
     "heading": {
🤖 Fix all issues with AI agents
In `@src/assets/translations/cs-CS.json`:
- Around line 878-883: Update the equality condition labels in the translations
object so they match the existing wording used elsewhere: change the value for
the "Equal" key to "Rovná se" and the value for the "NotEqual" key to "Nerovná
se"; locate the "conditions" object containing the "LessThan", "Equal",
"GreaterThan", and "NotEqual" keys and replace the current "Rovno" / "Nerovno"
strings with the consistent "Rovná se" / "Nerovná se" strings.

In `@src/assets/translations/en-US.json`:
- Around line 824-829: There are duplicate "conditions" keys under the "labels"
object in the translations JSON which causes the first block to be overwritten;
remove the redundant "conditions" object (or merge any unique entries into a
single "conditions" object) so only one "conditions" key exists under "labels"
(ensure keys like "LessThan", "Equal", "GreaterThan", "NotEqual" remain
present).
🧹 Nitpick comments (2)
src/assets/translations/ne-NE.json (1)

876-881: Consider aligning “GreaterThan” terminology with existing Nepali phrasing.

The locale already uses “greater than” as “भन्दा ठुलो” elsewhere. Using “भन्दा बढी” here introduces inconsistent wording across screens. Aligning improves UI consistency.

♻️ Suggested tweak
-      "GreaterThan": "भन्दा बढी",
+      "GreaterThan": "भन्दा ठुलो",
src/assets/translations/es-MX.json (1)

877-882: Consider consistency with existing comparison operator translations.

The new condition translations differ from similar existing translations in the catalogs section:

  • Line 721: "equals": "Igual a" vs Line 879: "Equal": "Igual"
  • Line 722: "greater than": "Mayor a" vs Line 880: "GreaterThan": "Mayor que"

Additionally, "No igual" (Line 881) is grammatically incomplete. Consider these alternatives for consistency and correctness:

♻️ Suggested improvements for consistency

Option 1: Align with existing catalog translations

     "conditions": {
-      "LessThan": "Menor que",
-      "Equal": "Igual",
-      "GreaterThan": "Mayor que",
-      "NotEqual": "No igual"
+      "LessThan": "Menor a",
+      "Equal": "Igual a",
+      "GreaterThan": "Mayor a",
+      "NotEqual": "Distinto de"
     },

Option 2: Use more formal grammatically complete translations

     "conditions": {
-      "LessThan": "Menor que",
-      "Equal": "Igual",
-      "GreaterThan": "Mayor que",
-      "NotEqual": "No igual"
+      "LessThan": "Menor que",
+      "Equal": "Igual a",
+      "GreaterThan": "Mayor que",
+      "NotEqual": "No es igual"
     },

Note: If you keep the current translations, consider updating lines 721-722 in the catalogs section to match for UI consistency across the application.

@shubhamkumar9199
Copy link
Contributor

@parth-sharma-10 Please squash your commits into a single commit before raising the PR. Also, review the suggestions from CodeRabbit

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from 762d069 to 8ad4f15 Compare January 19, 2026 18:12
@parth-sharma-10
Copy link
Contributor Author

@parth-sharma-10 Please squash your commits into a single commit before raising the PR. Also, review the suggestions from CodeRabbit
Thanks for the review! I’ve squashed the PR into a single commit and addressed all the CodeRabbit suggestions. Please let me know if anything else needs attention.

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/assets/translations/fr-FR.json`:
- Around line 879-882: Update the translation for the "Equal" key to match the
comparison phrasing used by "LessThan" and "GreaterThan": change the value of
the "Equal" entry from "Égal" to "Égal à" so the wording is consistent across
the comparison-related keys (e.g., "LessThan", "Equal", "GreaterThan",
"NotEqual").

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from 23b7040 to 49370af Compare January 19, 2026 18:31
Copy link
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.

Could you please add the jirra ticket on the PR title

@parth-sharma-10 parth-sharma-10 changed the title WEB 76: Smaller text issues when editing Fixed Deposit Products WEB-76: Smaller text issues when editing Fixed Deposit Products Jan 19, 2026
@shubhamkumar9199
Copy link
Contributor

shubhamkumar9199 commented Jan 19, 2026

@parth-sharma-10 It looks like the link isn’t working. Could you please check or share the correct one?
Please read the CONTRIBUTION.md before creating a PR. It’s written for new contributors and explains how to raise a PR with clear guidelines. If anything is unclear, feel free to ask in our Slack channel #web-app.

@parth-sharma-10
Copy link
Contributor Author

@IOhacker Added the Jira ticket (WEB-76) to the PR title. Thanks!

Copy link
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

Please see my comment

@shubhamkumar9199
Copy link
Contributor

shubhamkumar9199 commented Jan 19, 2026

WEB-359

If you’re adding a link, please add it in this format
WEB-76

Copy link

@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

🤖 Fix all issues with AI agents
In
`@src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts`:
- Around line 94-102: In setConditionalControls, guard the result of
attributeNameData.find(...) before accessing .code to avoid a TypeError and
handle the case where find returns undefined (e.g., skip patching
attributeValueData or set a fallback); also capture and dispose the subscription
created on this.depositProductIncentiveForm.get('attributeName')?.valueChanges
(for example store it on a Subscription field and unsubscribe in ngOnDestroy or
use a takeUntil/destroy$ pattern) so the dialog closing doesn't leak the
observable. Ensure changes reference setConditionalControls,
depositProductIncentiveForm, attributeNameData, and attributeValueData.

In `@src/app/shared/common-logic/condition-label.service.ts`:
- Around line 18-33: The switch in getConditionLabel(value: string) currently
maps the backend typo 'greterthan' but will fall back to raw text if the backend
is corrected; add a case for 'greaterthan' (in the same switch that uses
value?.toLowerCase()) that returns
this.translateService.instant('labels.conditions.GreaterThan') so both the
misspelled 'greterthan' and the corrected 'greaterthan' map to the localized
label via translateService.instant.

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch 2 times, most recently from 8497e6c to 1d9c49c Compare January 21, 2026 17:02
@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from 0c19eeb to c6f010c Compare January 21, 2026 18:41
Copy link

@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

🤖 Fix all issues with AI agents
In
`@src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts`:
- Around line 8-10: There is a duplicate import of inject from `@angular/core`;
consolidate the imports so inject appears only once: combine DestroyRef, inject,
Component, and OnInit into a single import from '@angular/core' (keep
takeUntilDestroyed imported from '@angular/core/rxjs-interop' as-is) and remove
the redundant import statement to resolve the compilation error in the
DepositProductIncentiveFormDialog component.
- Line 48: The field conditionLabelService is currently declared private, which
prevents Angular templates from accessing it; change its declaration to
protected so the template can call
conditionLabelService.getConditionLabel(conditionType.value) (update the
declaration of the private conditionLabelService = inject(ConditionLabelService)
to protected) to restore AOT/strict-mode compatibility.
♻️ Duplicate comments (2)
src/app/shared/common-logic/condition-label.service.ts (1)

18-31: Map corrected greaterthan variants too.

If the backend typo is fixed later, labels will fall back to raw text unless these variants are handled.

✅ Suggested fix
     switch (value?.toLowerCase()) {
       case 'lessthan':
         return this.translateService.instant('labels.conditions.LessThan');

       case 'equal':
         return this.translateService.instant('labels.conditions.Equal');

       case 'greterthan':
+      case 'greaterthan':
+      case 'greater_than':
         return this.translateService.instant('labels.conditions.GreaterThan');
src/assets/translations/fr-FR.json (1)

878-881: Use “Égal à” for consistency with comparison labels.

This matches earlier feedback; keeping phrasing aligned with “Inférieur à” / “Supérieur à” improves UX consistency.

💡 Suggested tweak
-      "Equal": "Égal",
+      "Equal": "Égal à",

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch 3 times, most recently from b49df73 to 5aff286 Compare January 22, 2026 17:22
Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.ts (1)

64-91: Prevent initial patch from clearing attributeValue in edit mode.
setConditionalControls() runs before the initial patchValue, so the attributeName emission clears attributeValue during edit, leaving the form blank. Move the subscription setup after the initial patch and suppress events (or guard initialization), then hydrate attributeValueData once.

🛠️ Proposed fix
   ngOnInit(): void {
     this.createDepositProductIncentiveForm();
-    this.setConditionalControls();

     this.dialogRef.disableClose = true;
     this.dialogRef.updateSize('400px');
@@
     if (this.data.values) {
       this.depositProductIncentiveForm.patchValue({
         entityType: this.data.values.entityType,
         attributeName: this.data.values.attributeName,
         conditionType: this.data.values.conditionType,
         attributeValue: this.data.values.attributeValue,
         incentiveType: this.data.values.incentiveType,
         amount: this.data.values.amount
-      });
+      }, { emitEvent: false });
     } else {
       this.depositProductIncentiveForm.patchValue({
         entityType: this.data.entityType
-      });
+      }, { emitEvent: false });
     }
+
+    this.setConditionalControls();
+    const attributeName = this.depositProductIncentiveForm.get('attributeName')?.value;
+    if (attributeName) {
+      const option = this.attributeNameData?.find((o: any) => o.id === attributeName);
+      this.attributeValueData = option
+        ? this.data.chartTemplate[`${option.code.split('.')[1]}Options`]
+        : [];
+    }

     this.title = this.translateService.instant('labels.heading.Incentives');
   }
🤖 Fix all issues with AI agents
In `@src/assets/translations/lt-LT.json`:
- Around line 878-883: The new "conditions" translation block was inserted
without proper surrounding commas, making the JSON invalid; update the JSON so
the object containing the "conditions" key is properly comma-separated from the
previous and next sibling entries—ensure the property before "conditions" ends
with a comma and that the "conditions" block itself is followed by a comma if
there are subsequent keys, referencing the "conditions" key in lt-LT.json to
locate the insertion and fix the surrounding punctuation.

In `@src/assets/translations/ne-NE.json`:
- Around line 876-881: Update the translation for the conditions.GreaterThan key
to use the existing Nepali phrasing "भन्दा ठुलो" so it matches the terminology
used elsewhere (e.g., the existing translation for "greater than"); ensure
consistency across the conditions object (keys: conditions.GreaterThan,
conditions.LessThan, conditions.Equal, conditions.NotEqual) by replacing "भन्दा
बढी" with "भन्दा ठुलो" for GreaterThan.
♻️ Duplicate comments (2)
src/assets/translations/fr-FR.json (1)

878-881: Use “Égal à” for consistent comparison phrasing.

Aligns with “Inférieur à” / “Supérieur à”.

💡 Suggested tweak
-      "Equal": "Égal",
+      "Equal": "Égal à",
src/app/shared/common-logic/condition-label.service.ts (1)

18-31: Map the corrected greaterthan value too.

If the backend typo is fixed, the service will fall back to raw text. Add the corrected spelling (and optionally greater_than) to keep labels localized.

✅ Suggested fix
       case 'greterthan':
+      case 'greaterthan':
+      case 'greater_than':
         return this.translateService.instant('labels.conditions.GreaterThan');
🧹 Nitpick comments (1)
src/app/products/deposit-product-incentive-form-dialog/deposit-product-incentive-form-dialog.component.html (1)

30-30: Consider using track conditionType.id for better change detection performance.

Tracking by the entire object rather than a unique identifier can cause unnecessary DOM re-renders if the object reference changes. While this is unlikely to be noticeable for small dropdown lists, using track conditionType.id is the idiomatic approach.

This also applies to the other @for loops in this template (lines 15, 47, 67).

♻️ Suggested change
-      `@for` (conditionType of conditionTypeData; track conditionType) {
+      `@for` (conditionType of conditionTypeData; track conditionType.id) {

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from 5aff286 to 24ec3f4 Compare January 22, 2026 17:48
Copy link

@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

🤖 Fix all issues with AI agents
In `@src/app/shared/common-logic/condition-label.service.ts`:
- Around line 18-35: The getConditionLabel method can return undefined when
value is null/undefined; add a guard at the start of getConditionLabel(value:
string) to coerce falsy input to a safe string (e.g., empty string) or return a
fallback label before running switch, then use value.toLowerCase() safely;
ensure the default branch also returns a string (not undefined) so the function
always returns a string (refer to getConditionLabel and
translateService.instant).
♻️ Duplicate comments (2)
src/app/shared/common-logic/condition-label.service.ts (1)

26-31: Map the corrected “greater-than” token too.

If the backend typo is fixed, the UI will fall back to raw text. Add a case for the corrected token(s) to keep labels localized (Line 26–31).

🛠️ Suggested fix
       case 'greterthan':
+      case 'greaterthan':
+      case 'greater_than':
         return this.translateService.instant('labels.conditions.GreaterThan');
src/assets/translations/lt-LT.json (1)

877-884: Fix JSON commas around the new conditions block.

Without commas before/after this block, the JSON becomes invalid and translations won’t load.

🛠️ Proposed fix
-    }
-    "conditions": {
+    },
+    "conditions": {
       "LessThan": "Mažiau nei",
       "Equal": "Lygu",
       "GreaterThan": "Daugiau nei",
       "NotEqual": "Nelygu"
-    },
+    },

Copy link

@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

🤖 Fix all issues with AI agents
In `@src/app/shared/common-logic/condition-label.service.ts`:
- Around line 39-41: The file has an extra closing brace after the
ConditionLabelService class which causes a parse error; remove the redundant `}`
that follows the class closing brace (in
src/app/shared/common-logic/condition-label.service.ts, inside the
ConditionLabelService block) so the class and file end with a single closing
brace only, then run the TypeScript compiler/formatter to confirm no unmatched
braces remain.
♻️ Duplicate comments (1)
src/app/shared/common-logic/condition-label.service.ts (1)

29-30: Consider adding the correctly-spelled 'greaterthan' case.

If the backend typo (greterthan) is corrected in the future, this switch will fall through to the default and display the raw value. Adding a fallthrough for the correct spelling would future-proof this mapping.

       case 'greterthan':
+      case 'greaterthan':
         return this.translateService.instant('labels.conditions.GreaterThan');

@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from a5d2178 to 617fc21 Compare January 22, 2026 18:07
@parth-sharma-10 parth-sharma-10 force-pushed the fix-incentive-condition-label branch from 113fc2b to 2c85b1f Compare January 22, 2026 18:20
Copy link
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
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 IOhacker merged commit ee6e4c2 into openMF:dev Jan 23, 2026
5 checks passed
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.

4 participants