Skip to content

WEB-1382: Fix loan holder label on standalone loan pages - #4203

Open
harshiniiiiiii wants to merge 1 commit into
openMF:devfrom
harshiniiiiiii:WEB-1382-loan-holder-label-fallback
Open

harshiniiiiiii wants to merge 1 commit into
openMF:devfrom
harshiniiiiiii:WEB-1382-loan-holder-label-fallback

Conversation

@harshiniiiiiii

@harshiniiiiiii harshiniiiiiii commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes WEB-1382: loan account pages opened through a standalone route (for example /loans/73/general) rendered undefined Name: (localized as indéfini Nom:, etc.) because the account holder type was derived only from router.url.

Root cause

LoansViewComponent set entityType in ngOnInit() by looking for clients, groups, or centers in the current URL. A standalone /loans/:loanId route matches none of them, so entityType stayed undefined; the template then built the labels.text.undefined key, which resolves to a localized "undefined" entry in every locale.

Fix

  • Derive the holder from the resolved loan details (clientId/clientName, groupId/group) instead of the URL.
  • Preserve the existing client-first precedence used by the loans list and GLIM child loans; group loans use the group association.
  • Add a neutral labels.text.Account holder label for loans without an identifiable holder, translated in all 14 supported locales.
  • Render the holder name/account number from the same association as the label, and omit empty parentheses.
  • labels.text.undefined entries are intentionally left untouched; the component no longer constructs that key.

Tests

  • Client, group, GLIM (both associations), standalone/missing-holder, and reused-route component tests.
  • Real-template rendering tests in English and Spanish asserting Client Name:, Group Name:, Account holder:, and no undefined-derived label.
  • Translation completeness test for all 14 locale files.

Validation

  • Focused Jest specs: 33 passed.
  • Loans + translation Jest specs: 381 passed, 1 pre-existing failure (prepay-loan.component.spec.ts, reproduces on origin/dev).
  • Full Jest suite: 3291 passed, 5 pre-existing failures in prepay-loan.component.spec.ts and currency-name.pipe.spec.ts (both reproduce on origin/dev).
  • npm run lint: passed.
  • npm run build:prod: passed.
  • Baseline reproduction on origin/dev rendered undefined Name: for the same fixture; the new rendered-template test asserts the corrected labels.
  • Live browser check on the dev server against demo.mifos.community confirms the labels shown in the screenshots above.

Notes

  • No backend/API, routing, permission, or business-rule changes.
  • Center routes do not load LoansModule, and Fineract loans are associated with a client or group, so there is no valid center holder path to preserve.
  • Screenshots are stored under .github/screenshots/WEB-1382/, following the existing WEB-1221 convention.

Summary by CodeRabbit

  • New Features
    • Loan details now show an “Account holder” label and display the available holder name and account number independently. The label is localized across 14 languages.
  • Bug Fixes
    • Account-holder details now reflect the associated client when available, or the group when no client is associated. When neither is available, loan details show a neutral label with no name or account number.

@harshiniiiiiii
harshiniiiiiii requested a review from a team October 27, 2026 07:53
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: "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

The loans view derives account-holder type and details from loan associations. The template displays available names and account numbers with client, group, or neutral labels. Fourteen locale files add the neutral label, with tests for holder selection, rendering, and translations.

Changes

Loan account-holder display

Layer / File(s) Summary
Derive and display holder details
src/app/loans/loans-view/loans-view.component.ts, src/app/loans/loans-view/loans-view.component.html, src/app/loans/loans-view/loans-view.component.spec.ts
The component derives holder type, name, and account number from loan details, preferring a client association over a group association. The template displays available values and uses a neutral label when no holder is identified. Tests cover identity selection, route-data updates, and rendered labels.
Add and verify account-holder translations
src/assets/translations/*.json, src/app/loans/loans-view/web-1382-loan-holder-translations.spec.ts
Fourteen locale files add an account-holder label. Tests check that labels are present and verify English, Spanish, and French values.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix

Suggested reviewers: iohacker

Merge Risk: Minimal · previous review 28359

The localized account-holder labels show no identified merge-blocking issue in this review scope. Merge after normal checks.

Pre-merge checks: Passed 4
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the loan holder label fix, which is the main change in the pull request.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Fix failing CI checks
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@harshiniiiiiii
harshiniiiiiii force-pushed the WEB-1382-loan-holder-label-fallback branch 3 times, most recently from ea76419 to 5913cfb Compare October 28, 2026 18:07
IOhacker
IOhacker previously approved these changes Oct 29, 2026
@harshiniiiiiii
harshiniiiiiii force-pushed the WEB-1382-loan-holder-label-fallback branch 2 times, most recently from ce52154 to 317afdf Compare October 30, 2026 03:52

@IOhacker IOhacker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the screenshots should not be part of the PR

@harshiniiiiiii
harshiniiiiiii force-pushed the WEB-1382-loan-holder-label-fallback branch from 3430d4d to 194b103 Compare November 3, 2026 05:42
@harshiniiiiiii

harshiniiiiiii commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@IOhacker ptal

All feedback addressed on the latest push:

  • Screenshots removed from the branch — .github/screenshots/WEB-1382/ is no longer in the diff.
  • Squashed to exactly 1 commit and rebased onto the latest dev, so the "Too many commits" and "branch out-of-date" checks now pass.
  • Focused Jest specs after the rebase: 33/33 passed.

This branch has not been deployed

No deployments
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