Generalize per-vehicle-option booking rules to Front Seat too

Front Seat previously had a hardcoded max-per-booking check with no enable
toggle; now every Vehicle Option (front_seat/back_seat/whole_vehicle) gets
the same config-driven pair — an on/off toggle and a max passenger_count —
surfaced via new BOOKING_*_ENABLED/BOOKING_*_MAX_PER_BOOKING env vars,
editable from ManageAppSettings, and exposed on route pricing as
max_per_booking.
This commit is contained in:
Nyan Lin Paing
2026-08-30 15:45:27 +07:00
parent 914b7f97f3
commit bebcab88fa
11 changed files with 175 additions and 97 deletions
@@ -60,9 +60,12 @@ class ManageAppSettings extends Page
'support_phone' => config('app.support_phone'),
'timezone' => config('app.timezone'),
'currency' => config('app.currency'),
'back_seat_enabled' => (bool) config('booking.back_seat_enabled'),
'whole_vehicle_enabled' => (bool) config('booking.whole_vehicle_enabled'),
'front_seat_enabled' => (bool) config('booking.front_seat_enabled'),
'front_seat_max_per_booking' => config('booking.front_seat_max_per_booking'),
'back_seat_enabled' => (bool) config('booking.back_seat_enabled'),
'back_seat_max_per_booking' => config('booking.back_seat_max_per_booking'),
'whole_vehicle_enabled' => (bool) config('booking.whole_vehicle_enabled'),
'whole_vehicle_max_per_booking' => config('booking.whole_vehicle_max_per_booking'),
'booking_admin_emails' => config('booking.admin_emails'),
'sms_enabled' => (bool) config('services.sms.enabled'),
'sms_server' => config('services.sms.sms_poh.server'),
@@ -106,23 +109,39 @@ class ManageAppSettings extends Page
->columns(2),
Tab::make('Booking')
->schema([
Toggle::make('back_seat_enabled')
->label('Back Seat Enabled')
->helperText('Whether customers can select Back Seat at all right now.'),
Toggle::make('whole_vehicle_enabled')
->label('Whole Vehicle Enabled')
->helperText('Whether customers can select Whole Vehicle at all right now.'),
Toggle::make('front_seat_enabled')
->label('Front Seat Enabled')
->helperText('Whether customers can select Front Seat at all right now.'),
TextInput::make('front_seat_max_per_booking')
->label('Front Seat Max Per Booking')
->numeric()
->minValue(1)
->required()
->helperText('Max Front Seats a single booking may request.'),
Toggle::make('back_seat_enabled')
->label('Back Seat Enabled')
->helperText('Whether customers can select Back Seat at all right now.'),
TextInput::make('back_seat_max_per_booking')
->label('Back Seat Max Per Booking')
->numeric()
->minValue(1)
->required()
->helperText('Max Back Seats a single booking may request.'),
Toggle::make('whole_vehicle_enabled')
->label('Whole Vehicle Enabled')
->helperText('Whether customers can select Whole Vehicle at all right now.'),
TextInput::make('whole_vehicle_max_per_booking')
->label('Whole Vehicle Max Per Booking')
->numeric()
->minValue(1)
->required()
->helperText('Max Whole Vehicle passenger count a single booking may request.'),
TagsInput::make('booking_admin_emails')
->label('Admin Emails')
->required()
->helperText('Notified on booking events. Press enter after each address.'),
]),
])
->columns(2),
Tab::make('SMS')
->schema([
Toggle::make('sms_enabled')
@@ -170,9 +189,12 @@ class ManageAppSettings extends Page
'SUPPORT_PHONE' => $state['support_phone'],
'APP_TIMEZONE' => $state['timezone'],
'APP_CURRENCY' => $state['currency'],
'BOOKING_BACK_SEAT_ENABLED' => (bool) $state['back_seat_enabled'],
'BOOKING_WHOLE_VEHICLE_ENABLED' => (bool) $state['whole_vehicle_enabled'],
'BOOKING_FRONT_SEAT_ENABLED' => (bool) $state['front_seat_enabled'],
'BOOKING_FRONT_SEAT_MAX_PER_BOOKING' => (int) $state['front_seat_max_per_booking'],
'BOOKING_BACK_SEAT_ENABLED' => (bool) $state['back_seat_enabled'],
'BOOKING_BACK_SEAT_MAX_PER_BOOKING' => (int) $state['back_seat_max_per_booking'],
'BOOKING_WHOLE_VEHICLE_ENABLED' => (bool) $state['whole_vehicle_enabled'],
'BOOKING_WHOLE_VEHICLE_MAX_PER_BOOKING' => (int) $state['whole_vehicle_max_per_booking'],
'BOOKING_ADMIN_EMAILS' => implode(',', $state['booking_admin_emails'] ?? []),
'SMS_ENABLED' => (bool) $state['sms_enabled'],
'SMS_SERVER' => $state['sms_server'],