WEB-657: Working Capital loan near breach config#3529
Conversation
|
Note
|
| Cohort / File(s) | Summary |
|---|---|
Loans Account Terms Step Component src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.html, src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts |
Added allowAttributeOverridesBreach state flag to gate breach and near-breach clear buttons. Updated template conditions to require both form control existence and allowAttributeOverridesBreach flag. Changed "Near Breach" visibility to depend on selectedBreach instead of loansAccountTermsForm.value.breachId. |
Breach Display Component src/app/shared/loan/breach-display/breach-display.component.html |
Updated flex sizing from flex-30 to flex-60 for breach and nearBreach value columns in non-singleRow layout across name, frequency, calculation/threshold fields. |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
- WEB-657: Working Capital product near breach configuration #3487: Modifies the same breach-display component to add/adjust near-breach rendering and inputs.
- WEB-670: Working Capital loan account creation fix override values #3516: Addresses breach/nearBreach override behavior by removing breachId/nearBreachId from submit payload when allowAttributeOverrides.breach is false.
- WEB-813: Working Capital loan account creation #3257: Modifies the same loans-account-terms-step component files for breach-related form control state and template rendering.
Suggested reviewers
- adamsaghy
- oleksii-novikov-onix
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately reflects the main change: adding Working Capital loan near breach configuration functionality to address a display issue. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| 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. |
✏️ 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.
Comment @coderabbitai help to get the list of available commands and usage tips.
There was a problem hiding this comment.
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/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts`:
- Line 182: The boolean allowAttributeOverridesBreach is only set false and
never reset, so when ngOnChanges receives a new Working Capital template that
permits overrides the Breach/Near Breach controls remain disabled; update
ngOnChanges (and the similar block around the logic at the region corresponding
to lines ~359-379) to check the incoming template's allow-overrides flag and set
allowAttributeOverridesBreach back to true when overrides are allowed, and also
re-enable the related form controls and show their clear buttons (the same
controls you disable elsewhere) so the UI reflects the new template permissions;
locate and modify the ngOnChanges method and the code paths that disable
controls to add this reset/enabling logic referencing
allowAttributeOverridesBreach and the specific form control names used for
Breach/Near Breach.
🪄 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: 735746a6-654e-416b-a759-4a10c605218c
📒 Files selected for processing (3)
src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.htmlsrc/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.tssrc/app/shared/loan/breach-display/breach-display.component.html
| delinquencyStartTypeOptions: StringEnumOptionData[] = []; | ||
| breachOptions: Breach[] = []; | ||
| nearBreachOptions: NearBreach[] = []; | ||
| allowAttributeOverridesBreach: boolean = true; |
There was a problem hiding this comment.
Reset breach override state when the next template allows overrides.
allowAttributeOverridesBreach is only ever set to false, and the controls are only disabled. If ngOnChanges() receives another Working Capital template where breach overrides are allowed, the Breach / Near Breach controls can remain disabled and their clear buttons stay hidden.
🐛 Proposed fix
- if (!this.allowAttributeOverrides.breach || this.allowAttributeOverrides.breach === false) {
- this.allowAttributeOverridesBreach = false;
- this.loansAccountTermsForm.controls.breachId.disable();
- this.loansAccountTermsForm.controls.nearBreachId.disable();
- }
+ this.allowAttributeOverridesBreach = this.allowAttributeOverrides.breach === true;
+ if (this.allowAttributeOverridesBreach) {
+ this.loansAccountTermsForm.controls.breachId.enable({ emitEvent: false });
+ this.loansAccountTermsForm.controls.nearBreachId.enable({ emitEvent: false });
+ } else {
+ this.loansAccountTermsForm.controls.breachId.disable({ emitEvent: false });
+ this.loansAccountTermsForm.controls.nearBreachId.disable({ emitEvent: false });
+ }Also applies to: 359-379
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@src/app/loans/loans-account-stepper/loans-account-terms-step/loans-account-terms-step.component.ts`
at line 182, The boolean allowAttributeOverridesBreach is only set false and
never reset, so when ngOnChanges receives a new Working Capital template that
permits overrides the Breach/Near Breach controls remain disabled; update
ngOnChanges (and the similar block around the logic at the region corresponding
to lines ~359-379) to check the incoming template's allow-overrides flag and set
allowAttributeOverridesBreach back to true when overrides are allowed, and also
re-enable the related form controls and show their clear buttons (the same
controls you disable elsewhere) so the UI reflects the new template permissions;
locate and modify the ngOnChanges method and the code paths that disable
controls to add this reset/enabling logic referencing
allowAttributeOverridesBreach and the specific form control names used for
Breach/Near Breach.
Description
There was an issue when the WC Loan creation and modification and the WC Product does not allow to override the Breach settings. the Near Breach in the WC Loan view was not being displayed
WEB-657
Related issues and discussion
Screenshots
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
If you have multiple commits please combine them into one commit by squashing them.
Read and understood the contribution guidelines at
web-app/.github/CONTRIBUTING.md.Summary by CodeRabbit