WEB-463 Minimum Opening Balance Field Allows Zero and Negative Values in Saving Product Creation Form
Changes Made :-
Added validation to the "Minimum Opening Balance" field in the Create Saving Product form to ensure only values greater than or equal to 1 are allowed. Decimals above 1 (e.g., 1.1, 1.5) are supported.
Before :-
After :-
Summary by CodeRabbit
-
Bug Fixes
- Enhanced validation for the minimum opening balance field with clearer error messages for required and minimum value validation errors.
✏️ Tip: You can customize this high-level summary in your review settings.
[!NOTE]
.coderabbit.yamlhas unrecognized propertiesCodeRabbit 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 client-side minimum-value validation and UI feedback for the minRequiredOpeningBalance field: HTML input attributes (min, step) and mat-error were added, and the form control now includes a Validators.min(0) rule.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Saving product settings UI src/app/products/saving-products/saving-product-stepper/saving-product-settings-step/saving-product-settings-step.component.html |
Added min="0" and step="0.01" to the minRequiredOpeningBalance input and added a mat-error to show when the control has a min validation error. |
Form control validation src/app/products/saving-products/saving-product-stepper/saving-product-settings-step/saving-product-settings-step.component.ts |
Updated createSavingProductSettingsForm to add Validators.min(0) to the minRequiredOpeningBalance form control (minRequiredOpeningBalance: ['', [Validators.min(0)]]). |
Estimated code review effort
🎯 2 (Simple) | ⏱️ ~10 minutes
Areas to inspect:
- Ensure the HTML input binding and Angular form control names match exactly.
- Verify translation key used in the new
mat-errorexists and renders correctly. - Confirm no unintended side effects in form initialization or validation flow.
Suggested reviewers
- IOhacker
- alberto-art3ch
Pre-merge checks and finishing touches
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The title accurately reflects the main change: adding validation to prevent zero and negative values in the Minimum Opening Balance field, which is the primary objective of this pull request. |
| Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
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.
@IOhacker Ok I will update the PR soon . Thank You for the review
@IOhacker I have updated the PR please review
@IOhacker @alberto-art3ch Thank You for review