Draft: Refactor Assign Doctor into reusable component and auto-open modal after patient registration
Summary
Refactored the existing Assign Doctor screen into a reusable React component and integrated it with the patient registration flow to automatically open an Assign Doctor modal after successful registration, while preserving existing behavior, UI, and dark theme styling with minimal code changes.
Steps to reproduce
Register a new patient from the patient registration screen.
Observe the post-registration behavior.
Attempt to assign a doctor to the newly created patient.
Verify modal close behavior and navigation stability.
Open the standalone Assign Doctor page and test assignment flow.
Example Project
Not applicable (changes implemented within the existing project codebase).
What is the current bug behavior?
After patient registration, users must manually navigate to assign a doctor.
Assign Doctor UI is tightly coupled to the standalone screen and not reusable in a modal flow.
What is the expected correct behavior?
Assign Doctor modal opens automatically after successful patient registration.
Doctor assignment works exactly as before and closes the modal on success.
Manual modal close is safe with no navigation issues.
Standalone Assign Doctor screen continues to function unchanged.
No regressions in workflow, UI, styling, routing, or API behavior.
Relevant logs and/or screenshots
N/A – UI refactor with preserved functionality and no runtime errors observed.
Possible fixes
Extract Assign Doctor UI into a reusable component: components/assignDoctor/AssignDoctorForm.jsx
Reuse existing modal implementation (same pattern as Add Medicine → Assign/Verify Medicine).
Trigger modal open on patient registration success handler with minimal code changes (≤ 10–30 lines).