-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTP appointment reschedule #9974
base: develop
Are you sure you want to change the base?
OTP appointment reschedule #9974
Conversation
WalkthroughThis pull request introduces changes across multiple files to support appointment rescheduling functionality and update import paths. The modifications include adding a new route for rescheduling appointments, implementing a rescheduling mechanism in the Schedule and AppointmentDialog components, updating localization strings, and standardizing import statements using the Changes
Sequence DiagramsequenceDiagram
participant User
participant AppointmentDialog
participant PatientRouter
participant Schedule
User->>AppointmentDialog: Click Reschedule
AppointmentDialog->>PatientRouter: Navigate to Reschedule Route
PatientRouter->>Schedule: Load Schedule Component
Schedule->>Schedule: Fetch Existing Appointment
Schedule->>Schedule: Prepare Rescheduling Flow
User->>Schedule: Complete Rescheduling
Schedule->>Schedule: Cancel Existing Appointment
Schedule->>Schedule: Create New Appointment
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
👋 Hi, @Jacobjeevan, This message is automatically generated by prince-chrismc/label-merge-conflicts-action so don't hesitate to report issues/improvements there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
cypress/e2e/facility_spec/facility_creation.cy.ts
(1 hunks)cypress/e2e/patient_spec/patient_creation.cy.ts
(1 hunks)public/locale/en.json
(1 hunks)src/Routers/PatientRouter.tsx
(1 hunks)src/pages/Patient/components/AppointmentDialog.tsx
(3 hunks)src/pages/PublicAppointments/Schedule.tsx
(10 hunks)src/types/facility/facility.ts
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- src/types/facility/facility.ts
- cypress/e2e/patient_spec/patient_creation.cy.ts
- cypress/e2e/facility_spec/facility_creation.cy.ts
🔇 Additional comments (9)
src/pages/PublicAppointments/Schedule.tsx (4)
1-2
: Imports added correctly for new functionalitiesThe import statements for
useMutation
,useQuery
,useQueryClient
, and date-fns functions (format
,isBefore
,isSameDay
) are necessary and correctly added to support the new appointment rescheduling functionalities.
40-40
: AddedappointmentId
prop toAppointmentsProps
interfaceThe addition of the optional
appointmentId
prop in theAppointmentsProps
interface allows the component to handle both booking and rescheduling of appointments effectively.
64-83
: Ensure proper handling of sensitive appointment dataFetching appointment data using
useQuery
is appropriate for rescheduling functionality. However, please verify that any sensitive patient information withinappointmentData
is handled securely and complies with privacy regulations.
368-379
: Verify thatselectedSlot
is defined before reschedulingWhen handling the reschedule action, ensure that
selectedSlot
is selected by the user before attempting to create a new appointment. IfselectedSlot
is undefined, it may cause errors during appointment creation.Consider adding a check before calling
handleRescheduleAppointment
:if (appointmentId && appointment) { + if (selectedSlot) { handleRescheduleAppointment(appointment); + } else { + toast.error(t("please_select_a_slot")); + } } else { // existing code }src/Routers/PatientRouter.tsx (1)
50-64
: Reschedule route added correctlyThe new route for rescheduling appointments is properly added to
AppointmentRoutes
. The route parameters are correctly defined, and theScheduleAppointment
component receives all necessary props for rescheduling functionality.src/pages/Patient/components/AppointmentDialog.tsx (3)
2-2
: Importednavigate
fromraviger
The import statement for
navigate
fromraviger
is correctly added to enable navigation within the appointment dialog.
43-47
: FunctionhandleRescheduleAppointment
implemented correctlyThe
handleRescheduleAppointment
function constructs the correct URL for navigating to the reschedule appointment page using the appointment details.
112-115
: Reschedule button added with correct functionalityThe "Reschedule" button is appropriately added to the dialog footer and correctly calls
handleRescheduleAppointment
on click, enabling users to initiate the rescheduling process.public/locale/en.json (1)
1773-1773
: LGTM! The new localization string is well-formatted.The added key-value pair follows the established naming conventions and is properly placed in alphabetical order. The text is appropriately capitalized and grammatically correct.
onError: (error) => { | ||
toast.error(error?.message || t("failed_to_create_appointment")); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
our global error handler would do it right?
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
Release Notes
New Features
Localization
Improvements
Chores