Skip to content

fix(registrar): enforce mandatory fields on registration + readable search errors & inline paginator - #82

Open
gkbishnoi07 wants to merge 4 commits into
angular-zard-migrationfrom
fix/registration-required-validation
Open

fix(registrar): enforce mandatory fields on registration + readable search errors & inline paginator#82
gkbishnoi07 wants to merge 4 commits into
angular-zard-migrationfrom
fix/registration-required-validation

Conversation

@gkbishnoi07

Copy link
Copy Markdown

What

Two related registrar QA fixes from the Zard/Tailwind migration pass:

1. Registration can't be submitted empty (QA: Registration form submitted without any entry, Ben ID generated)

The migration to reactive forms + Zard kept the red-asterisk label ([zRequired]="item.isRequired") but stopped attaching a validator to the control — so mainForm stayed valid while empty: Next advanced and Submit (gated on !mainForm.valid) stayed enabled, generating a blank beneficiary.

  • personal / location / other-information: attach Validators.required in the addControl loop for every field flagged isRequired in the master config, alongside the existing pattern/min/max validators. Pre-seeded controls (age/ageAtMarriage) get the validator merged on, since FormGroup.addControl no-ops when the control already exists.
  • registration: block nextStep() while the active step group is invalid (markAllAsTouched to surface the required messages) + a defensive invalid-guard in submitBeneficiaryDetails().

2. Search error/empty states (QA: advanced search shows "[object Object]"; rows/pagination misaligned)

  • search: show error.error.errorMessage (and correct beneficiarynotfound key casing) instead of rendering the raw object / a blank dialog.
  • paginator: keep the paginator inline/right-aligned instead of stretched full-width below the rows-per-page selector.

Testing

  • Registrar → Registration: empty Next/Submit is blocked with a mandatory-fields alert and red required messages; a complete form registers normally; non-required fields (Last Name, Contact No, Spouse, Occupation) may stay empty.
  • Registrar → Advanced Search: no-match / error shows a readable message; paginator stays inline.

Notes

  • Reaches MMU-UI via a submodule-pointer bump (separate follow-up).

[25] The smart paginator composed z-pagination inside a justify-end row, but
z-pagination's default host classes (mx-auto w-full justify-center) stretched it
full-width and wrapped it below the rows-per-page selector. Override with
mx-0 w-auto justify-end so it stays inline and aligned; standalone z-pagination
is unaffected.

[9] Registrar search error handlers passed the raw HttpErrorResponse object to
confirmationService.alert(), which rendered as "[object Object]". Extract
error.error.errorMessage || error.message before alerting (all search paths).
The no-results info alerts read currentLanguageSet.alerts.info.beneficiarynotfound
(and .phoneDetails) with no fallback; in the registrar context that key can be
unresolved, showing an empty "Info" dialog. Add optional-chaining + a literal
fallback so a real message always shows.
The non-ES advanced-search no-results alert read alerts.info.beneficiaryNotFound
(camelCase) but the language key is beneficiarynotfound (lowercase) -> undefined ->
blank "Info" dialog. Use the correct key with optional chaining + literal fallback.
… submitted

The migration to reactive forms + Zard kept the red-asterisk label
([zRequired]="item.isRequired") but stopped attaching a validator to the
control, so mainForm stayed valid while empty: Next advanced and Submit
(gated on !mainForm.valid) stayed enabled, generating a blank beneficiary ID.

- personal/location/other-information: attach Validators.required in the
  addControl loop for every field flagged isRequired in the master config,
  alongside the existing pattern/min/max validators. Merge onto pre-seeded
  controls (age/ageAtMarriage) since FormGroup.addControl no-ops when the
  control already exists.
- registration: block nextStep() while the active step group is invalid
  (markAllAsTouched to surface the required messages) and add a defensive
  invalid-guard in submitBeneficiaryDetails().
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7d0e512c-16c8-461e-8dd6-3c8b909e8b62

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant