@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')
    <section class="td-terms-conditions section_space has-sticky">
        <div class="breadcrumb-text">
            <h2>{{ $data['title'] }}</h2>
        </div>
        @if (strlen($data['content']) > 0)
            <div class="container">
                <div class="td-page-contents">
                    {!! $data['content'] !!}
                </div>
            </div>
        @endif
    </section>
    <!-- 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
