feature: users with treatment edit permission should now have working hours defined. the appointment grid is now being drawn based on the doctor's working hours.

This commit is contained in:
2026-06-10 19:44:09 +03:30
parent 468572a50f
commit 48ecfd05e1
22 changed files with 1571 additions and 116 deletions

View File

@@ -20,7 +20,7 @@ interface AppointmentBookingModalProps {
patient: Patient | undefined;
providerUserId: string | null;
providerName: string;
initialHour: number;
initialStartMinute: number;
onClose: () => void;
onSubmit: (payload: {
patientId: string;
@@ -42,7 +42,7 @@ export function AppointmentBookingModal({
patient,
providerUserId,
providerName,
initialHour,
initialStartMinute,
onClose,
onSubmit,
editingAppointment = null,
@@ -81,17 +81,18 @@ export function AppointmentBookingModal({
scheduleDate.getFullYear(),
scheduleDate.getMonth(),
scheduleDate.getDate(),
initialHour,
0,
Math.floor(initialStartMinute / 60),
initialStartMinute % 60,
0,
0,
);
const endMinute = Math.min(initialStartMinute + 60, 24 * 60 - 1);
const end = new Date(
scheduleDate.getFullYear(),
scheduleDate.getMonth(),
scheduleDate.getDate(),
initialHour < 23 ? initialHour + 1 : 23,
initialHour < 23 ? 0 : 59,
Math.floor(endMinute / 60),
endMinute % 60,
0,
0,
);
@@ -100,7 +101,7 @@ export function AppointmentBookingModal({
setPurpose('consultation');
}
setError('');
}, [open, scheduleDate, initialHour, editingAppointment]);
}, [open, scheduleDate, initialStartMinute, editingAppointment]);
if (!open || !providerUserId) {
return null;