feat: Auto-redirect to Assign Doctor after Patient Registration
Description
Currently, after a volunteer successfully registers a new patient, the application redirects back to the landing page. To assign a doctor, the volunteer must manually navigate to the Assign Doctor page and search for the newly created patient again. This extra step disrupts the workflow, especially during high-volume registration periods.
This feature improves the registration flow by automatically redirecting the volunteer to the Assign Doctor page immediately after a new patient is created.
User Story
As a volunteer, I want to be automatically redirected to the Assign Doctor screen after registering a new patient so that I can immediately assign the patient to a doctor without additional navigation.
Acceptance Criteria
- Trigger: The redirect occurs only after a successful Create & Register Patient action. It should not trigger when updating existing patient records unless explicitly required.
- Feedback: A success notification (e.g., “Patient created successfully. Redirecting…”) is displayed before the redirect.
- Action: The application navigates to /volunteer/assign-doctor/{book_no}.
- State: The Assign Doctor page loads with the newly created patient’s Book Number pre-filled or automatically selected.
Technical Notes
- Updated PatientRegistrationPage.tsx.
- Modified the createPatientMutation onSuccess handler.
- Added navigation to /volunteer/assign-doctor/${data.book_no}.
- Introduced a short delay (~1000 ms) to allow the success toast to be visible before redirecting.