Skip to content

fix(nurse-doctor): restrict visit categories to supported flows + stepper/navigation fixes - #439

Open
gkbishnoi07 wants to merge 4 commits into
angular-zard-migrationfrom
fix/visit-category-navigation
Open

fix(nurse-doctor): restrict visit categories to supported flows + stepper/navigation fixes#439
gkbishnoi07 wants to merge 4 commits into
angular-zard-migrationfrom
fix/visit-category-navigation

Conversation

@gkbishnoi07

Copy link
Copy Markdown

What

Fixes several visit-category / stepper navigation defects in the nurse-doctor workarea.

  • Whitelist supported visit categories — the master list returned categories MMU has no flow for (Childhood & Adolescent, Family Planning, Neonatal); picking one stranded the user on Visit Details with no Next/Submit. Restrict the dropdown to the 8 implemented categories. (QA: Childhood/FP/Neonatal Next does nothing; no stepper/Submit.)
  • Age/gender gate — hide NCD screening / NCD care from beneficiaries under 30 (matches the existing age >= 30 auto-select). (QA: 22-year-old could pick Neonatal/NCD screening.)
  • NCD Care history blank — guard general-opd-history.loadFormData() so a transient stale parent form can't null every section.
  • Change-category stepper collapse — remove a migration-added re-entrant detectChanges() in hideAll() that threw ExpressionChangedAfterItHasBeenCheckedError and aborted the stepper rebuild. (QA: changing visit category, stepper not displaying.)
  • Defensive else in handleVisitType — an unmapped category now surfaces a clear alert instead of a silent blank page.

Testing

Nurse, fresh visit: dropdown shows only supported categories; a <30 beneficiary can't pick NCD screening/Neonatal; NCD Care → History shows its sections; changing category rebuilds the stepper.

Not a regression — main also implements only these categories; the dropdown just never filtered.

…tory forms

[37][32][4][35] The visit-category dropdown offered categories MMU has no flow for
(Childhood & Adolescent, Family Planning, Neonatal); picking one stranded the user on
Visit Details with no Next/Submit. handleVisitType() only implements 8 categories, so
restrict the dropdown to those, and hide the adult NCD categories (NCD screening / NCD
care) from beneficiaries under 30.

[37] NCD Care History rendered blank: general-opd-history.loadFormData() runs on every
ngOnChanges and assigned each section form unconditionally, so a transient stale/wrong
parent form during a category switch nulled them all. Guard it to keep the last good
reference until the correct form arrives.

Note: [31] "stepper missing on category change" was caused by selecting one of the
now-removed unsupported categories, so it is covered by the same whitelist.
…build on category change)

hideAll() ran changeDetectorRef.detectChanges() (added in migration; absent in main).
Because hideAll runs inside the visitCategory valueChanges handler, forcing CD while
the show* flags flip true->false throws ExpressionChangedAfterItHasBeenCheckedError on a
category *change*, aborting handleVisitType() before it rebuilds the steps -> stepper
collapses to Visit Details and Next stops working. Remove the forced CD; the normal
change-detection pass rebuilds the (reactive Zard) stepper. Bug [31].
… of a blank page

handleVisitType had no else on the category if/else-if chain, so a visit category
the app has no flow for (or a value mismatch like a bare 'Screening') fell through
silently and rendered a blank page with no sections — the "Screening section is
missing" symptom QA hit. Add a defensive else that alerts the user to re-select the
category. No behavior change for the supported categories, which are all handled above.
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown

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: 007de812-4640-4db5-ab59-48ce90e1bac9

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.

@drtechie drtechie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove all the comments?

@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.

2 participants