@php
$isEdit = isset($room);
$units = old('units', $isEdit ? $room->units->map(fn ($u) => [
'id' => $u->id,
'room_number' => $u->room_number,
'label' => $u->label,
])->all() : []);
$selectedAmenities = old('amenities', $isEdit ? ($room->amenities ?? []) : []);
@endphp
@include('hotel.rooms.partials._amenities-grid', [
'amenities' => $amenities ?? config('hotel_amenities', []),
'selectedAmenities' => $selectedAmenities,
])
@include('hotel.rooms.partials._photos-fields')
Room numbers (optional)
@foreach($units as $index => $unit)
@include('hotel.rooms.partials._unit-row', ['index' => $index, 'unit' => $unit])
@endforeach
@include('hotel.rooms.partials._unit-row', ['index' => '__INDEX__', 'unit' => []])
@if($isEdit)
@endif
@push('scripts')
@endpush