{{-- Main Content --}}
@if(!Auth::check() || !Auth::user()->landlord || !Auth::user()->is_admin)
@endif
@php
// Lấy giá thấp nhất của mỗi motel (giá phòng thấp nhất trong tất cả các phòng)
$motels->each(function ($motel) {
$prices = $motel->rooms->flatMap(function ($room) {
return $room->roomPrices->pluck('price');
});
// Lưu giá thấp nhất vào object $motel
$motel->price_min = $prices->min() ?? 0;
});
@endphp
{{-- Sidebar với quảng cáo --}}
@if(config('ads.sidebar.enabled'))
@endif
@if(isset($motels) && $motels->count() > 0)
{{-- Ẩn map đối với chủ trọ và admin --}}
@if(Auth::guest() || (!Auth::user()->landlord && !Auth::user()->is_admin))
@if(isset($motels) && $motels->count() > 0)
@else
@endif
@include('components.motel-map', ['motels' => $motels])
{{-- Livewire component để geocode bất đồng bộ --}}
@livewire('geocode-motels', ['motelIds' => $motels->pluck('id')->toArray()])
@endif
@endif