{{-- The multi-tab search widget, shared by the hero sections. Needs: $searchTabs, $travelerOptions, $flightCities, $flightFares, $hotelCities, $visaCountries, $categories. --}} @php // Search widget tabs: admin-managed order/label/icon/visibility // (settings.search-widget-tabs), falling back to the shipped defaults // before that table has been migrated/seeded. $tabDefaults = [ 'tab-flight' => ['icon' => 'fa-solid fa-plane', 'label' => ___('frontend.flights')], 'tab-hotel' => ['icon' => 'fa-solid fa-hotel', 'label' => ___('frontend.hotels')], 'tab-tour' => ['icon' => 'fa-solid fa-umbrella-beach', 'label' => ___('frontend.tours')], 'tab-visa' => ['icon' => 'fa-solid fa-passport', 'label' => ___('frontend.visa')], ]; $tabRows = $searchTabs->isNotEmpty() ? $searchTabs : collect(array_keys($tabDefaults))->map(fn ($k) => (object) ['tab_key' => $k, 'icon' => $tabDefaults[$k]['icon'], 'label' => null]); // A tab of a module the agency switched off (Settings → Modules) is dropped. $tabModules = ['tab-flight' => 'flights', 'tab-hotel' => 'hotels', 'tab-tour' => 'tours', 'tab-visa' => 'visa']; $tabRows = $tabRows->filter(fn ($t) => moduleEnabled($tabModules[$t->tab_key] ?? 'core'))->values(); $firstTabKey = optional($tabRows->first())->tab_key; $visibleTabKeys = $tabRows->pluck('tab_key')->all(); // Flights search live when Settings → Flight API has a working provider // and there are coded cities to pick; otherwise the tab opens the // request-to-book form exactly as before. $liveFlights = false; $liveCities = collect(); if (in_array('tab-flight', $visibleTabKeys)) { $widgetOptions = app(\App\Services\Home\SearchWidgetOptions::class); $liveCities = $widgetOptions->liveFlightCities(); $liveFlights = $liveCities->isNotEmpty() && $widgetOptions->liveFlights(); } @endphp {{-- Multi-tab search widget. Tours and Hotels search real inventory; Flights search live fares when an API is configured (else open the enquiry form pre-filled, like Visa). --}} @if($tabRows->isNotEmpty())
@foreach($tabRows as $t) @endforeach
{{-- Flights --}} @if(in_array('tab-flight', $visibleTabKeys))
@if($liveFlights) {{-- A flight API is configured: open /flight-booking, which runs the live search on arrival. --}}
@else
@endif
@endif {{-- Hotels — searches the real hotel inventory --}} @if(in_array('tab-hotel', $visibleTabKeys))
@foreach($hotelCities as $city)
@endif {{-- Tours — searches the real package catalogue --}} @if(in_array('tab-tour', $visibleTabKeys))
@endif {{-- Visa --}} @if(in_array('tab-visa', $visibleTabKeys))
@endif
@endif