feat(appointment): enhance booking window functionality with day/week/month options and update defaults

This commit is contained in:
hamed
2026-07-27 19:16:10 +03:30
parent 15abcb5c8a
commit 2963e2ac74
6 changed files with 131 additions and 18 deletions
@@ -56,13 +56,19 @@ type NewScheduleMap = Record<string, NewDayConfig>;
interface BookingMeta {
online_booking_enabled: boolean;
booking_window_value: number;
booking_window_unit: 'week' | 'month';
booking_window_unit: BookingWindowUnit;
booking_mode: 'slot' | 'service';
buffer_minutes: number;
}
type BookingWindowUnit = 'day' | 'week' | 'month';
const BOOKING_WINDOW_UNITS: { value: BookingWindowUnit; label: string }[] = [
{ value: 'day', label: 'روز' },
{ value: 'week', label: 'هفته' },
{ value: 'month', label: 'ماه' },
];
const DEFAULT_BOOKING_META: BookingMeta = {
online_booking_enabled: true,
booking_window_value: 1,
booking_window_value: 3,
booking_window_unit: 'month',
booking_mode: 'slot',
buffer_minutes: 0,
@@ -778,9 +784,9 @@ export function WeeklyScheduleTab({ doctorUuid, clinicUuid, addresses, readOnly
/>
<div style={{ width: 110 }}>
<GlobalSearchableSelect
options={[{ value: 'week', label: 'هفته' }, { value: 'month', label: 'ماه' }]}
options={BOOKING_WINDOW_UNITS}
value={meta.booking_window_unit}
onChange={(v) => setMeta(m => ({ ...m, booking_window_unit: (v as 'week' | 'month') }))}
onChange={(v) => setMeta(m => ({ ...m, booking_window_unit: (v as BookingWindowUnit) }))}
isDisabled={!meta.online_booking_enabled}
height={38}
/>