feat: Enhance appointment management by decoupling online booking toggle for admin context
- Introduced management mode for appointment slots, allowing doctors, admins, and clinic managers to view and book slots regardless of the online booking status. - Updated SlotCalculatorService to accept a management context parameter, bypassing online booking restrictions. - Modified appointment-related endpoints to handle management context and ensure proper authorization checks. - Added tests to verify that management users can access slots even when online booking is disabled, while public users are still restricted. - Improved documentation for API endpoints to reflect new management parameters and behaviors.
This commit is contained in:
@@ -479,7 +479,7 @@ export default function AppointmentsPage() {
|
||||
// مطب شخصی خوانده میشود. محل از booking-locations همان پزشک انتخاب میشود.
|
||||
const adminLocationsQuery = useQuery<ApiResponse<any>>({
|
||||
queryKey: ['booking-locations', selectedDoctorUuid],
|
||||
queryFn: () => api.get(`/api/v1/appointment-booking-locations/${selectedDoctorUuid}`),
|
||||
queryFn: () => api.get(`/api/v1/appointment-booking-locations/${selectedDoctorUuid}?management=1`),
|
||||
enabled: isAdmin && !!selectedDoctorUuid,
|
||||
});
|
||||
const adminLocations: any[] = (adminLocationsQuery.data?.data as any)?.booking_locations ?? EMPTY_ARR;
|
||||
@@ -496,7 +496,7 @@ export default function AppointmentsPage() {
|
||||
const slotsQuery = useQuery<ApiResponse<any>>({
|
||||
queryKey: slotsQueryKey,
|
||||
queryFn: () => api.get(
|
||||
`/api/v1/appointment-slots?doctor_uuid=${selectedDoctorUuid}&date=${selectedDate}` +
|
||||
`/api/v1/appointment-slots?doctor_uuid=${selectedDoctorUuid}&date=${selectedDate}&management=1` +
|
||||
(effectiveClinicUuid ? `&clinic_uuid=${encodeURIComponent(effectiveClinicUuid)}` : '')
|
||||
),
|
||||
enabled: viewMode === 'timeline' && !!selectedDoctorUuid,
|
||||
|
||||
Reference in New Issue
Block a user