Disable Save when payment plan code is taken#108
Open
Shahzaibahmad97 wants to merge 1 commit intodevelopfrom
Open
Disable Save when payment plan code is taken#108Shahzaibahmad97 wants to merge 1 commit intodevelopfrom
Shahzaibahmad97 wants to merge 1 commit intodevelopfrom
Conversation
Add the missing paymentPlan.codeTaken English translation so the duplicate-code error renders the user-facing message instead of the raw key. Include isCodeValid in canSave() so the Save button is disabled while the async code-uniqueness validation reports a conflict, matching the ContributionPlanForm pattern.
|
68 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
The payment-plan creation form previously allowed users to attempt a Save even when the asynchronous code-uniqueness validation reported that the entered code was already taken. When the conflict was reported, the field-level error rendered the raw translation key
paymentPlan.codeTakeninstead of a human-readable message because no English string was registered for that key.This PR fixes both issues:
paymentPlan.codeTakenEnglish translation so the field-level error displays "Payment plan code already exists" instead of the raw key.isCodeValidin the form'scanSave()predicate so the Save button is disabled while the duplicate-code error is active, mirroring the existingContributionPlanFormpattern.Type of Change
Related Issue(s) / Task(s)
E2E Payment Tests
Changes
Translation
paymentPlan.codeTaken→ "Payment plan code already exists" insrc/translations/en.jsonForm Validation
this.props.isCodeValidcheck tocanSave()inPaymentPlanForm.jsisCodeValidwas already wired throughmapStateToPropsfromstate.contributionPlan?.validationFields?.paymentPlanCode?.isValid— no new redux plumbing neededBehaviour Before / After
paymentPlan.codeTakenshown under the fieldDemo
To be added after manual verification.
Checklist
paymentPlan.*namespace conventioncanSave()change matches the existingContributionPlanForm/ContributionPlanBundleFormpattern (consistency across forms)validationFields.paymentPlanCode.isValidnpm run build)openimis-dist_dkr