Skip to content

Conversation

@JaySoni1
Copy link
Contributor

@JaySoni1 JaySoni1 commented Jan 11, 2026

Changes Made :-

-Added min="0" attribute to the input fields for "Due days for repayment event" and "OverDue days for repayment event" to prevent users from entering negative values.
-Added Angular form validation (Validators.min(0)) for these fields to ensure negative values are not accepted at the form level.

WEB-569

Before :-
image

After :-
image

Summary by CodeRabbit

  • Bug Fixes
    • Prevented negative values for "Due days for repayment" and "OverDue days for repayment" in loan product settings by enforcing non-negative input and validation, ensuring consistent and valid repayment timing entries.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 11, 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 non-negative constraints to repayment-event day fields: HTML inputs now include min="0" and the component form adds Validators.min(0) for those controls; a stray blank line was removed from the TypeScript file.

Changes

Cohort / File(s) Summary
Loan Product Settings Step
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html, src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
Added min="0" to numeric inputs for due/overdue days and added Validators.min(0) to the corresponding form controls. Removed one empty line in the TypeScript file (formatting).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 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 directly and accurately describes the main change: preventing negative values for repayment event days in the loan product creation form.
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 docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b1df9d8 and 3aa7742.

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

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

Caution

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

⚠️ Outside diff range comments (2)
src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html (2)

761-767: Correct the tooltip and consider adding validation error message.

The tooltip text "Maximum outstanding loan account balance" appears to be copy-pasted from the outstanding balance field and doesn't match the purpose of "Due days for repayment event."

Additionally, while the min="0" HTML attribute is added, there's no <mat-error> block to inform users when they violate this constraint, which could lead to confusion.

Suggested improvements

Update the tooltip to describe repayment event days:

          <input
            type="number"
            min="0"
            matInput
-            matTooltip="{{ 'tooltips.Maximum outstanding loan account balance' | translate }}"
+            matTooltip="{{ 'tooltips.Number of days before repayment due date for event notification' | translate }}"
            formControlName="dueDaysForRepaymentEvent"
          />

Consider adding a validation error message:

            formControlName="dueDaysForRepaymentEvent"
          />
+          @if (loanProductSettingsForm.controls.dueDaysForRepaymentEvent.hasError('min')) {
+            <mat-error>
+              {{ 'labels.inputs.Due days for repayment event' | translate }}
+              {{ 'labels.commons.must be' | translate }}
+              <strong>{{ 'labels.commons.non-negative' | translate }}</strong>
+            </mat-error>
+          }
        </mat-form-field>

771-777: Correct the tooltip and consider adding validation error message.

Similar to the "Due days" field above, the tooltip text is incorrect and there's no validation error message.

Suggested improvements

Update the tooltip:

          <input
            type="number"
            min="0"
            matInput
-            matTooltip="{{ 'tooltips.Maximum outstanding loan account balance' | translate }}"
+            matTooltip="{{ 'tooltips.Number of days after repayment due date for overdue event notification' | translate }}"
            formControlName="overDueDaysForRepaymentEvent"
          />

Consider adding a validation error message:

            formControlName="overDueDaysForRepaymentEvent"
          />
+          @if (loanProductSettingsForm.controls.overDueDaysForRepaymentEvent.hasError('min')) {
+            <mat-error>
+              {{ 'labels.inputs.OverDue days for repayment event' | translate }}
+              {{ 'labels.commons.must be' | translate }}
+              <strong>{{ 'labels.commons.non-negative' | translate }}</strong>
+            </mat-error>
+          }
        </mat-form-field>
🤖 Fix all issues with AI agents
In
@src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html:
- Line 763: Update the form control definitions for dueDaysForRepaymentEvent and
overDueDaysForRepaymentEvent to include Validators.min(0) so validation is
enforced in TypeScript (not just via HTML). Locate the FormGroup or FormBuilder
usage that defines these controls (look for the keys "dueDaysForRepaymentEvent"
and "overDueDaysForRepaymentEvent" in the loan-product-settings-step component)
and add Validators.min(0) alongside any existing validators (e.g.,
Validators.required or Validators.pattern) for each control.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bb26080 and b1df9d8.

📒 Files selected for processing (2)
  • src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
  • src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
💤 Files with no reviewable changes (1)
  • src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.ts
🧰 Additional context used
📓 Path-based instructions (1)
src/app/**

⚙️ CodeRabbit configuration file

src/app/**: For Angular code: verify component separation, trackBy on *ngFor,
strict type safety, and clean observable patterns.

Files:

  • src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html
🧠 Learnings (2)
📓 Common learnings
Learnt from: alberto-art3ch
Repo: openMF/web-app PR: 2876
File: src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts:91-94
Timestamp: 2025-12-09T14:24:31.429Z
Learning: In the LoanReagingComponent (src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts), the transactionAmount field uses both Validators.min and Validators.max set to the same value (loanTransactionData.amount). This is intentional - it requires users to enter the exact amount as a confirmation/validation step before submitting the re-age operation.
📚 Learning: 2025-12-09T14:24:31.429Z
Learnt from: alberto-art3ch
Repo: openMF/web-app PR: 2876
File: src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts:91-94
Timestamp: 2025-12-09T14:24:31.429Z
Learning: In the LoanReagingComponent (src/app/loans/loans-view/loan-account-actions/loan-reaging/loan-reaging.component.ts), the transactionAmount field uses both Validators.min and Validators.max set to the same value (loanTransactionData.amount). This is intentional - it requires users to enter the exact amount as a confirmation/validation step before submitting the re-age operation.

Applied to files:

  • src/app/products/loan-products/loan-product-stepper/loan-product-settings-step/loan-product-settings-step.component.html

@JaySoni1 JaySoni1 force-pushed the WEB-569-negative-values-allowed-for-repayment-event-days-in-loan-product-creation-form branch from b1df9d8 to 3aa7742 Compare January 11, 2026 19:14
@IOhacker IOhacker merged commit 5593359 into openMF:dev Jan 11, 2026
4 checks passed
@JaySoni1
Copy link
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