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
+5 -2
View File
@@ -27,9 +27,12 @@ class WeeklySchedule
public const MODE_SLOT = 'slot'; // نوبت‌دهی اسلاتی (رفتار پیش‌فرض)
public const MODE_SERVICE = 'service'; // نوبت‌دهی بر اساس مدت سرویس
/** واحدهای مجاز بازهٔ رزرو آنلاین؛ همان کلیدواژه‌های strtotime. */
public const BOOKING_WINDOW_UNITS = ['day', 'week', 'month'];
public const DEFAULT_META = [
'online_booking_enabled' => true,
'booking_window_value' => 1,
'booking_window_value' => 3,
'booking_window_unit' => 'month',
'booking_mode' => self::MODE_SLOT,
'buffer_minutes' => 0,
@@ -128,7 +131,7 @@ class WeeklySchedule
$this->setting[self::META_KEY] = [
'online_booking_enabled' => (bool)($meta['online_booking_enabled'] ?? $current['online_booking_enabled']),
'booking_window_value' => max(1, (int)($meta['booking_window_value'] ?? $current['booking_window_value'])),
'booking_window_unit' => in_array($meta['booking_window_unit'] ?? null, ['week', 'month'], true)
'booking_window_unit' => in_array($meta['booking_window_unit'] ?? null, self::BOOKING_WINDOW_UNITS, true)
? $meta['booking_window_unit']
: $current['booking_window_unit'],
'booking_mode' => in_array($meta['booking_mode'] ?? null, [self::MODE_SLOT, self::MODE_SERVICE], true)