@php
    $contact = getContent('contact_us.content', true);
    $pages = App\Models\Page::get();
    $query = App\Models\Category::where('status', 1)->latest();
@endphp
@extends($activeTemplate . 'layouts.frontend')
@section('content')
    @if ($general->theme == 2)
        <div class="header" id="header">
            <div class="container ">
                <nav class="navbar navbar-expand-lg">
                    <div class="header-menu-wrapper align-items-center d-flex">
                        <div class="logo-wrapper">
                            <a href="{{ route('home') }}" class="normal-logo" id="normal-logo">
                                <img src="{{ getImage('assets/images/general/logo1.png') }}" alt="...">
                            </a>
                        </div>
                    </div>
                    <form id="myForm" class="form-area d-flex" action="{{ route('search.by.type') }}" method="GET">
                        <div class="d-flex align-items-center">
                            <i class="fas fa-image ps-2"></i>
                            <p class="mx-2">@lang('Image')</p>
                        </div>
                        <div class="search">
                            <input id="searchInput" type="text" name="search" class="form--control"
                                value="{{ old('search') }}" placeholder="Search for photo">
                            <i class="fas fa-search"></i>
                        </div>
                    </form>
                    <button class="navbar-toggler header-button" type="button" data-bs-toggle="collapse"
                        data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent"
                        aria-expanded="false" aria-label="Toggle navigation">
                        <span id="hiddenNav"><i class="las la-bars"></i></span>
                    </button>

                    <div class="collapse navbar-collapse" id="navbarSupportedContent">
                        <ul class="navbar-nav nav-menu me-auto ps-lg-4 ps-0">
                            @foreach ($pages as $page)
                                @if ($page->slug == 'explore')
                                    <li class="nav-item">
                                        <a class="nav-link {{ Request::url() == url('/') . '/' . $page->slug ? 'active' : '' }}"
                                            href="{{ route('pages', $page->slug) }}">{{ __($page->name) }}</a>
                                    </li>
                                @endif
                            @endforeach
                            @guest
                                @php
                                    $categories = $query->take(3)->get();
                                @endphp
                                @foreach ($categories as $item)
                                    <li class="nav-item">
                                        <a class="nav-link  {{ Request::url() == route('files.category', $item->id) }} ? 'active' : '' }}"
                                            href="{{ route('files.category', $item->id) }}">{{ __($item->name) }}</a>
                                    </li>
                                @endforeach
                            @endguest
                            @auth
                                @php
                                    $categories = $query->take(2)->get();
                                @endphp
                                @foreach ($categories as $item)
                                    <li class="nav-item">
                                        <a class="nav-link  {{ Request::url() == route('files.category', $item->id) }} ? 'active' : '' }}"
                                            href="{{ route('files.category', $item->id) }}">{{ __($item->name) }}</a>
                                    </li>
                                @endforeach
                            @endauth
                            @auth
                                <li class="nav-item">
                                    <a class="nav-link" href="{{ route('user.home') }}">@lang('Dashboard')</a>
                                </li>
                            @endauth
                        </ul>
                        <div class="d-flex lan">
                            <i class="fas fa-globe"></i>
                            <select class="form-select langSel">
                                @foreach ($language as $item)
                                    <option value="{{ $item->code }}" @if (session('lang') == $item->code) selected @endif>
                                        {{ __($item->name) }}</option>
                                @endforeach
                            </select>
                        </div>
                        <div class="login ps-lg-3 ps-0">
                            @guest
                                <a class="my-auto" href="{{ route('user.login') }}"><i
                                        class="fa-solid fa-user-large"></i>@lang('Sign In')</a>
                            @endguest

                            @auth
                                <a href="{{ route('user.logout') }}" class="">@lang('Sign Out')</a>
                            @endauth
                        </div>
                    </div>
                </nav>
            </div>
        </div>
    @endif
    <!-- ==================== Contact Form & Map Start Here ==================== -->
    <section class="contact-bottom py-100">
        <div class="container">
            <div class="row gy-5 flex-wrap-reverse">
                <div class="col-lg-6 pe-lg-5">
                    <div class="contact-map">
                        <iframe
                            src="https://maps.google.com/maps?q={{ @$contact->data_values->latitude }},{{ @$contact->data_values->longitude }}&hl=es;z=14&amp;output=embed"
                            allowfullscreen="" loading="lazy"></iframe>
                    </div>
                </div>
                <div class="col-lg-6">
                    <div class="contactus-form">
                        <h3 class="contact__title">{{ @$contact->data_values->title }}</h3>
                        <form method="post" action="" class="verify-gcaptcha">
                            @csrf
                            <div class="form-group mb-3">
                                <label class="form--label">@lang('Name')</label>
                                <input name="name" type="text" class="form--control"
                                    value="@if (auth()->user()) {{ auth()->user()->fullname }} @else{{ old('name') }} @endif"
                                    @if (auth()->user()) readonly @endif required>
                            </div>
                            <div class="form-group mb-3">
                                <label class="form--label">@lang('Email')</label>
                                <input name="email" type="email" class="form--control"
                                    value="@if (auth()->user()) {{ auth()->user()->email }}@else{{ old('email') }} @endif"
                                    @if (auth()->user()) readonly @endif required>
                            </div>
                            <div class="form-group mb-3">
                                <label class="form--label">@lang('Subject')</label>
                                <input name="subject" type="text" class="form--control" value="{{ old('subject') }}"
                                    required>
                            </div>
                            <div class="form-group mb-3">
                                <label class="form-label">@lang('Message')</label>
                                <textarea name="message" wrap="off" class="form--control" required>{{ old('message') }}</textarea>
                            </div>
                            <x-captcha></x-captcha>
                            <div class="form-group">
                                <button type="submit" class="btn button w-100">@lang('Send')</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </section>
    <!-- ==================== Contact Form & Map End Here ==================== -->
@endsection
