<!-- header part start -->
<header class="header">
    <div class="header-wrapper">
        <div class="header-full d-flex align-items-center justify-content-between">
            <a href="{{ route('home') }}" class="logo">
                <img src="{{ asset(setting('site_logo', 'global')) }}" alt="logo">
            </a>
            <div class="nav">
                <?php
                $navigations = \App\Models\Navigation::where('status', 1)
                    ->where(function ($query) {
                        $query->where('type', 'header')->orWhere('type', 'both');
                    })
                    ->orderBy('header_position')
                    ->get();
                ?>

                <ul class="nav-ul d-flex align-items-center">
                    @foreach ($navigations as $navigation)
                        @if ($navigation->page->status || $navigation->page_id == null)
                            <li class="nav-ul-li">
                                <a href="{{ url($navigation->url) }}"
                                    class="@if (url($navigation->url) == Request::url()) active @endif">{{ $navigation->tname }}</a>
                            </li>
                        @endif
                    @endforeach
                </ul>
            </div>
            <div class="d-flex align-items-center">
                <div class="cta-button">
                    @auth('web')
                        <a href="{{ route('user.booking.checkout') }}" class="td-btn">
                            <span class="td-btn-wrap">
                                <span class="td-btn-y-1">{{ __('Book a Tour') }}</span>
                                <span class="td-btn-y-2">{{ __('Book a Tour') }}</span>
                            </span>
                            <i></i>
                        </a>
                        <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                            @csrf
                        </form>
                        <a href="{{ route('logout') }}" class="td-btn td-btn-sec"
                            onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                            <span class="td-btn-wrap">
                                <span class="td-btn-y-1">{{ __('Logout') }}</span>
                                <span class="td-btn-y-2">{{ __('Logout') }}</span>
                            </span>
                            <i></i>
                        </a>
                    @else
                        <a href="{{ route('user.dashboard') }}" class="td-btn-round d-none">
                            <img src="{{ asset('frontend/default/img/icon/user-icon.svg') }}" alt="">
                        </a>
                        @endif
                    </div>
                    <div class="bar-button ml-20">
                        <button class="td-offcanvas-toggle">
                            <img src="{{ asset('frontend/default/img/icon/bar.svg') }}" alt="">
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </header>
    <!-- header part end -->

    <!-- offcanvas or mobilemenu part start -->
    <div class="td-offcanvas">
        <div class="td-offcanvas-wrapper">
            <div class="td-offcanvas-header">
                <div class="td-offcanvas-logo">
                    <img src="{{ asset('frontend/default/img/img/logo-2.png') }}" alt="">
                </div>
                <div class="td-offcanvas-close">
                    <button class="td-offcanvas-close-toggle">
                        <img src="{{ asset('frontend/default/img/icon/close.svg') }}" alt="">
                    </button>
                </div>
            </div>
            <div class="td-offcanvas-navbars">
                <?php
                $navigations = \App\Models\Navigation::where('status', 1)
                    ->where(function ($query) {
                        $query->where('type', 'header')->orWhere('type', 'both');
                    })
                    ->orderBy('header_position')
                    ->get();
                ?>

                <ul class="nav-ul d-flex align-items-center">
                    @foreach ($navigations as $navigation)
                        @if ($navigation->page->status || $navigation->page_id == null)
                            <li class="nav-ul-li">
                                <a href="{{ url($navigation->url) }}"
                                    class="@if (url($navigation->url) == Request::url()) active @endif">{{ $navigation->tname }}</a>
                            </li>
                        @endif
                    @endforeach
                </ul>
            </div>
            <div class="td-offcanvas-buttons">
                <a href="{{ route('user.booking.checkout') }}" class="td-btn">
                    <span class="td-btn-wrap">
                        <span class="td-btn-y-1">{{ __('Book a Tour') }}</span>
                        <span class="td-btn-y-2">{{ __('Book a Tour') }}</span>
                    </span>
                    <i></i>
                </a>
                @auth('web')
                    <a href="{{ route('user.dashboard') }}" class="td-btn td-btn-sec">
                        <span class="td-btn-wrap">
                            <span class="td-btn-y-1">{{ __('Dashboard') }}</span>
                            <span class="td-btn-y-2">{{ __('Dashboard') }}</span>
                        </span>
                        <i></i>
                    </a>
                    <form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
                        @csrf
                    </form>
                    <a href="{{ route('logout') }}" class="td-btn td-btn-sec"
                        onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
                        <span class="td-btn-wrap">
                            <span class="td-btn-y-1">{{ __('Logout') }}</span>
                            <span class="td-btn-y-2">{{ __('Logout') }}</span>
                        </span>
                        <i></i>
                    </a>
                @else
                    <a href="{{ route('login') }}" class="td-btn td-btn-sec">
                        <span class="td-btn-wrap">
                            <span class="td-btn-y-1">{{ __('Login') }}</span>
                            <span class="td-btn-y-2">{{ __('Login') }}</span>
                        </span>
                        <i></i>
                    </a>
                    <a href="{{ route('user.dashboard') }}" class="td-btn-round d-none">
                        <img src="{{ asset('frontend/default/img/icon/user-icon.svg') }}" alt="">
                    </a>
                    @endif
                </div>
            </div>
        </div>
        <div class="td-offcanvas-overlay"></div>
        <!-- offcanvas or mobilemenu part end -->
