@php
    $pages = App\Models\Page::get();
    $banner = getContent('banner.content', true);
    $socials = getContent('social_icon.element');
    $contact = getContent('contact_us.content', true);
    $policyPages = getContent('policy_pages.element', false, null, true);
    $categories = App\Models\Category::where('status', 1)
        ->inRandomOrder()
        ->take(4)
        ->get();
    $footerLinks = getContent('footer_company_links.element');
@endphp

<!-- ==================== Footer Start Here ==================== -->
@if (Route::currentRouteName() === 'user.login' ||
        Route::currentRouteName() === 'user.register' ||
        Route::currentRouteName() === 'user.password.request' ||
        Route::currentRouteName() === 'user.password.code.verify' ||
        Route::currentRouteName() === 'user.password.reset' ||
        Route::currentRouteName() === 'user.authorization')
@else
    <footer class="footer-area">
        <div class="pb-60 pt-120">
            <div class="container">
                <div class="row justify-content-center gy-5">
                    <div class="col-xl-3 col-sm-6">
                        <div class="footer-item">
                            <div>
                                <h5>@lang('About Us')</h5>
                            </div>
                            <p class="footer-item__desc">{{ __($contact->data_values->footer_short_description) }}</p>
                            <ul class="social-list">
                                @foreach ($socials as $item)
                                    <li class="social-list__item"><a href="{{ $item->data_values->url }}"
                                            class="social-list__link {{ $loop->iteration === 2 ? 'active' : '' }}">@php echo $item->data_values->social_icon; @endphp</a>
                                    </li>
                                @endforeach
                            </ul>
                        </div>
                    </div>
                    <div class="col-xl-2 col-sm-6">
                        <div class="footer-item">
                            <h5 class="footer-item__title">@lang('Information')</h5>
                            <ul class="footer-menu">
                                @foreach ($policyPages as $item)
                                    <li class="footer-menu__item">
                                        <a href="{{ route('policy.pages', [slug($item->data_values->title), $item->id]) }}"
                                            class="footer-menu__link">{{ __($item->data_values->title) }}
                                        </a>
                                    </li>
                                @endforeach
                                <li class="footer-menu__item">
                                    <a href="{{ route('cookie.policy') }}" target="_blank"
                                        class="footer-menu__link">@lang('Cookie Policy')
                                    </a>
                                </li>
                                @foreach ($pages as $page)
                                    @if ($page->slug == 'contact')
                                        <li class="footer-menu__item"><a href="{{ route('pages', $page->slug) }}"
                                                class="footer-menu__link">{{ __($page->name) }}</a></li>
                                    @endif
                                @endforeach
                            </ul>
                        </div>
                    </div>
                    <div class="col-xl-2 col-sm-6">
                        <div class="footer-item">
                            <h5 class="footer-item__title">@lang('Company')</h5>
                            <ul class="footer-menu">
                                @foreach ($footerLinks as $item)
                                    <li class="footer-menu__item"><a href="{{ $item->data_values->url }}"
                                            class="footer-menu__link">{{ __($item->data_values->title) }}</a></li>
                                @endforeach
                                @foreach ($pages as $page)
                                    @if ($page->slug != '/' && $page->slug != 'contact' && $page->slug != 'explore')
                                        <li class="footer-menu__item"><a href="{{ route('pages', $page->slug) }}"
                                                class="footer-menu__link">{{ __($page->name) }}</a></li>
                                    @endif
                                @endforeach
                            </ul>
                        </div>
                    </div>
                    <div class="col-xl-2 col-sm-6">
                        <div class="footer-item">
                            <h5 class="footer-item__title">@lang('Categories')</h5>
                            <ul class="footer-menu">
                                @foreach ($categories as $item)
                                    <li class="footer-menu__item"><a href="{{ route('files.category', $item->id) }}"
                                            class="footer-menu__link">{{ $item->name }}
                                        </a></li>
                                @endforeach
                            </ul>
                        </div>
                    </div>
                    <div class="col-xl-3 col-sm-6">
                        <div class="footer-item">
                            <h5 class="footer-item__title">@lang('Newsletter')</h5>
                            <form action="{{ route('newsletter.create') }}" method="POST">
                                @csrf
                                <div class="form-group">
                                    <input name="newsletter" type="text" class="form--control"
                                        placeholder="Enter email" required>
                                    <button type="submit"><i class="fas fa-paper-plane"></i></button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- Footer Top End-->

        <!-- bottom Footer -->
        <div class="bottom-footer py-3">
            <div class="container">
                <div class="row gy-3">
                    <div class="col-md-12 text-center">
                        <div class="bottom-footer-text">@php echo $contact->data_values->website_footer; @endphp</div>
                    </div>
                </div>
            </div>
        </div>
    </footer>
@endif
