@extends('frontend::layouts.app')
@section('title')
    {{ $data['title'] }}
@endsection
@section('meta_keywords')
    {{ $data['meta_keywords'] }}
@endsection
@section('meta_description')
    {{ $data['meta_description'] }}
@endsection
@section('content')
    <!-- page content -->
    <section class="td-terms-conditions section_space has-sticky">
        <div class="breadcrumb-text">
            <h2>{{ $data['title'] }}</h2>
        </div>
    </section>
    <!-- page content end -->
    @if (multiLocationEnabled())
        <?php
        $locations = \App\Models\Location::where('status', 1)->get();
        ?>

        <!-- location section start -->
        <section class="td-location-3">
            <div class="td-location-wrapper p-relative">
                <div class="container">
                    <!-- location title  -->
                    <div class="td-location-title">
                        <div class="td-location-title-sec">
                        </div>
                        <div class="td-location-title-button">
                            <button class="location-slider-btn-prev location-btn">
                                <svg xmlns="http://www.w3.org/2000/svg" width="8" height="14" viewBox="0 0 8 14"
                                    fill="none">
                                    <path
                                        d="M6.99995 1C6.99995 1 1.00001 5.41893 0.999999 7.00005C0.999986 8.58116 7 13 7 13"
                                        stroke="" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
                                </svg>
                            </button>
                            <button class="location-slider-btn-next location-btn">
                                <svg xmlns="http://www.w3.org/2000/svg" width="8" height="14" viewBox="0 0 8 14"
                                    fill="none">
                                    <path
                                        d="M6.99995 1C6.99995 1 1.00001 5.41893 0.999999 7.00005C0.999986 8.58116 7 13 7 13"
                                        stroke="" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
                                </svg>
                            </button>
                        </div>
                    </div>
                    <!-- location slider -->
                    <div class="td-location-slider">
                        <div class="swiper td-location-slider-active">
                            <div class="swiper-wrapper">
                                @foreach ($locations as $location)
                                    <div class="swiper-slide">
                                        <div class="td-location-card-2">
                                            <div class="img-box">
                                                <div class="img">
                                                    <img src="{{ asset($location->thumb_image) }}" alt="">
                                                </div>
                                                <span></span>
                                            </div>
                                            <div class="content-box">
                                                <a href="{{ route('location.details', $location->id) }}">
                                                    <h3>{{ $location->name }}</h3>
                                                </a>
                                                <a href="{{ route('location.details', $location->id) }}">
                                                    <p>{{ $location->location }}</p>
                                                </a>
                                            </div>
                                        </div>
                                    </div>
                                @endforeach
                            </div>
                        </div>
                    </div>
                </div>
                <!-- location elements -->
                <div class="td-location-elements">
                    <div class="td-location-elements-square">
                        <img src="{{ asset('frontend/default/img/elements/location-square-element.svg') }}" alt="">
                    </div>
                    <div class="td-location-elements-star">
                        <img src="{{ asset('frontend/default/img/elements/location-star-element.svg') }}" alt="">
                    </div>
                </div>
            </div>
            @if (strlen($data['content']) > 0)
                <div class="container">
                    <div class="row justify-content-center">
                        <div class="col-xxl-8">
                            <div class="text-white text-center mt-5">
                                {!! $data['content'] !!}
                            </div>
                        </div>
                    </div>
                </div>
            @endif
        </section>
        <!-- location section end -->
    @endif

    <!-- section  -->
    @if (isset($data->section_id) && $data->section_id)
        @php
            $section_ids = is_array(json_decode($data['section_id'])) ? json_decode($data['section_id']) : [];
            $commaIds = implode(',', $section_ids);
            $sections = \App\Models\LandingPage::whereIn('id', $section_ids)
                ->when($commaIds != null && !blank($commaIds), function ($query) use ($commaIds) {
                    $query->orderByRaw("FIELD(id, $commaIds)");
                })
                ->get();
        @endphp

        @foreach ($sections as $section)
            @include('frontend::home.include.__' . $section->code, [
                'data' => json_decode($section->data, true),
            ])
        @endforeach
    @endif
    <!-- section end-->
@endsection
