@php
$options = AppHelper::options('program_reservations');
$keysOnly = array_combine(array_keys($options), array_keys($options));
@endphp
{!! Form::label('program', 'Program *', ['class' => 'form-label']) !!}
{!! Form::select('program', $keysOnly, old('program', $program_reservation->program), [
'class' => 'form-select',
'required' => true,
'placeholder' => 'Select Program'
]) !!}
@if($errors->has('program'))
{{ $errors->first('program') }}
@endif
{!! Form::label('place_conducted','Place Conducted *', ['class'=>'form-label']) !!}
{!! Form::select('place_conducted', AppHelper::options('training_places'), old('place_conducted', $program_reservation->place_conducted), ['class'=>'form-select','required'=>true, 'placeholder' => 'Select Place']) !!}
{!! Form::label('checkin','Check-in Date *', ['class'=>'form-label']) !!}
{!! Form::date('checkin', old('checkin', $program_reservation->checkin ?? date('Y-m-d')), ['id'=>'checkin', 'min' => old('checkin', $program_reservation->checkin ?? date('Y-m-d')), 'onchange'=>'updateDays()', 'class'=>'form-control','required'=>true]) !!}
{!! Form::label('checkout','Check-out Date *', ['class'=>'form-label']) !!}
{!! Form::date('checkout', old('checkout', $program_reservation->checkout ?? ''), [
'id'=>'checkout',
'onchange'=>'updateDays()',
'class'=>'form-control',
'required'=>true
]) !!}
{!! Form::label('no_of_days','Total Days', ['class'=>'form-label']) !!}
{!! Form::number('no_of_days', old('no_of_days', $program_reservation->no_of_days ?? 1), [
'id' => 'days', 'min' => 1, 'readonly', 'class' => 'form-control',
'style'=>'background:#f5f5f5;'
]) !!}
{!! Form::label('total_guests','Total Guests *', ['class'=>'form-label']) !!}
{!! Form::number('total_guests', old('total_guests', $program_reservation->total_guests), ['id'=>'total_guests', 'min'=>1,'class'=>'form-control','required'=>true]) !!}
{!! Form::label('accommodation_need','Need of Accommodation *', ['class'=>'form-label']) !!}
{!! Form::number('accommodation_need', old('accommodation_need', $program_reservation->accommodation_need), ['min'=>1,'class'=>'form-control','required'=>true]) !!}
First Meal
{!! Form::date('first_meal_date', old('checkin', $program_reservation->checkin??date('Y-m-d')), ['id'=>'first_meal_date', 'min'=>$program_reservation->checkin??date('Y-m-d'),'class'=>'form-control','required']) !!}
{!! Form::select('first_meal_type', [''=>'Select Meal Type','breakfast'=>'Breakfast','lunch'=>'Lunch','dinner'=>'Dinner'], old('first_meal_type', $program_reservation->first_meal_type), ['class'=>'form-select','required']) !!}
Last Meal
{!! Form::date('last_meal_date', old('checkout', $program_reservation->checkout??date('Y-m-d')), ['id'=>'last_meal_date', 'min'=> $program_reservation->checkout ?? date('Y-m-d'),'class'=>'form-control','required']) !!}
{!! Form::select('last_meal_type', [''=>'Select Meal Type','breakfast'=>'Breakfast','lunch'=>'Lunch','dinner'=>'Dinner'], old('last_meal_type', $program_reservation->last_meal_type), ['class'=>'form-select','required']) !!}
@foreach($roomTypes as $key => $room)
@php
list($id, $acType) = explode('-', $key);
$qty = old("qty.$key", $storedQtys[$key] ?? 0);
$price = $room['price'] ?? 0;
$name = $room['particular'] ?? ($room['name'] ?? 'N/A');
$type = $room['type'] ?? $acType;
$isRoom = strpos($room['description'], 'Accommodations') !== false;
$bedsCount = $room['no_of_beds'] ?? 0;
@endphp
@endforeach
{!! Form::submit('Save', ['class' => 'btn btn-primary']) !!}