@php
    if (empty($authUser) and auth()->check()) {
        $authUser = auth()->user();
    }
    
    $navBtnUrl = null;
    $navBtnText = null;
    
    if (request()->is('forums*')) {
        $navBtnUrl = '/forums/create-topic';
        $navBtnText = trans('update.create_new_topic');
    } else {
        $navbarButton = getNavbarButton(!empty($authUser) ? $authUser->role_id : null);
    
        if (!empty($navbarButton)) {
            $navBtnUrl = $navbarButton->url;
            $navBtnText = $navbarButton->title;
        }
    }
@endphp

@php
    $userLanguages = !empty($generalSettings['site_language']) ? [$generalSettings['site_language'] => getLanguages($generalSettings['site_language'])] : [];

    if (!empty($generalSettings['user_languages']) and is_array($generalSettings['user_languages'])) {
        $userLanguages = getLanguages($generalSettings['user_languages']);
    }

    $localLanguage = [];

    foreach($userLanguages as $key => $userLanguage) {
        $localLanguage[localeToCountryCode($key)] = $userLanguage;
    }

@endphp

<div id="navbarVacuum"></div>

<nav id="navbar" class="navbar navbar-expand-lg navbar-light">
    <div class="{{ (!empty($isPanel) and $isPanel) ? 'container-fluid' : 'container' }}">
      
           
                <div class="d-flex align-items-center justify-content-between w-100">

            <a class="navbar-brand navbar-order d-flex align-items-center justify-content-center mr-0 {{ (empty($navBtnUrl) and empty($navBtnText)) ? 'ml-auto' : '' }}" href="/">
                @if (!empty($generalSettings['logo']))
                    <img src="{{ $generalSettings['logo'] }}" class="img-fluid" alt="site logo">
                @endif
            </a>

            <button class="navbar-toggler navbar-order" type="button" id="navbarToggle">
                <span class="navbar-toggler-icon"></span>
            </button>

            <div class="{{-- mx-lg-30 --}} d-none d-lg-flex flex-grow-1 navbar-toggle-content " id="navbarContent">
                <div class="navbar-toggle-header text-right d-lg-none">
                    <button class="btn-transparent" id="navbarClose">
                        <i data-feather="x" width="32" height="32"></i>
                    </button>
                </div>

                <ul class="navbar-nav mr-auto d-flex align-items-center">
                     <li class="nav-item">
                    <form action="/search" method="get" class="form-inline my-2 my-lg-0 navbar-search position-relative">
                    <input class="form-control mr-5 rounded w-100" type="text" name="search" placeholder="{{ trans('navbar.search_anything') }}" aria-label="Search">

                    <button type="submit" class="btn-transparent d-flex align-items-center justify-content-center search-icon">
                        <i data-feather="search" width="20" height="20" class="mr-10"></i>
                    </button>
                </form>
                </li>
                  
                    {{--<li class="nav-item">
                        <a class="nav-link" href="/"> {{ trans('home.home_title') }}</a>
                    </li>--}}
                    @if (!empty($categories) and count($categories))
                        {{--<li class="mr-lg-25">--}}
                        {{--<li class="nav-item">
                            <div class="menu-category">
                                <ul>
                                    <li class="cursor-pointer user-select-none d-flex xs-categories-toggle">
                                        <i data-feather="grid" width="20" height="20" class="mr-10 d-none d-lg-block"></i>
                                        {{ trans('categories.categories') }}

                                        <ul class="cat-dropdown-menu">
                                            @foreach ($categories as $category)
                                                <li>
                                                    <a href="{{ (!empty($category->subCategories) and count($category->subCategories)) ? '#!' : $category->getUrl() }}">
                                                        <div class="d-flex align-items-center">
                                                            <img src="{{ $category->icon }}" class="cat-dropdown-menu-icon mr-10" alt="{{ $category->title }} icon">
                                                            {{ $category->title }}
                                                        </div>

                                                        @if (!empty($category->subCategories) and count($category->subCategories))
                                                            <i data-feather="chevron-right" width="20" height="20" class="d-none d-lg-inline-block ml-10"></i>
                                                            <i data-feather="chevron-down" width="20" height="20" class="d-inline-block d-lg-none"></i>
                                                        @endif
                                                    </a>

                                                    @if (!empty($category->subCategories) and count($category->subCategories))
                                                        <ul class="sub-menu">
                                                            @foreach ($category->subCategories as $subCategory)
                                                                <li>
                                                                    <a href="{{ $subCategory->getUrl() }}">
                                                                        @if (!empty($subCategory->icon))
                                                                            <img src="{{ $subCategory->icon }}" class="cat-dropdown-menu-icon mr-10" alt="{{ $subCategory->title }} icon">
                                                                        @endif

                                                                        {{ $subCategory->title }}
                                                                    </a>
                                                                </li>
                                                            @endforeach
                                                        </ul>
                                                    @endif
                                                </li>
                                            @endforeach
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </li>--}}
                    @endif
                    
                    {{--<li class="nav-item">
                        <a class="nav-link" href="/graduates"> الخريجين</a>
                    </li>--}}

                    @if (!empty($navbarPages) and count($navbarPages))
                        {{--<li class="mr-lg-25">--}}
                        <li class="nav-item">
                            <div class="menu-category">
                                <ul>
                                    <li class="cursor-pointer user-select-none d-flex xs-categories-toggle">
                                        {{-- <i data-feather="grid" width="20" height="20" class="mr-10 d-none d-lg-block"></i> --}}
                                        {{ trans('navbar.menu') }}

                                        <ul class="cat-dropdown-menu">
                                            @foreach ($navbarPages as $navbarPage)
                                                <li>
                                                    <a href="{{ $navbarPage['link'] }}">
                                                        <div class="d-flex align-items-center">
                                                            {{--<img src="{{ $navbarPage['icon'] }}" class="cat-dropdown-menu-icon mr-10" alt="{{ $navbarPage['icon'] }} icon">--}}
                                                            {{ $navbarPage['title'] }}
                                                        </div>


                                                    </a>


                                                </li>
                                            @endforeach
                                            
                                             <li>
                                                    <a href="/testimonials">
                                                        <div class="d-flex align-items-center">
                                                          
                                                            أراء خريجين دبلوم مونتيسورى الدولي
                                                        </div>


                                                    </a>


                                                </li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </li>
                    @endif
                    
                    
                   
              
                    {{-- @foreach ($navbarPages as $navbarPage)
                            <li class="nav-item">
                                <a class="nav-link" href="{{ $navbarPage['link'] }}">{{ $navbarPage['title'] }}</a>
                            </li>
                        @endforeach
                    @endif --}}
                    <li class="nav-item ">
                        <form action="{{ route('themes.update') }}" method="get" class="m-10 d-inline">
                @csrf

               {{-- <button style="background: none;border: none" type="submit">
                    <svg style="width: 15px; @if(session('dark')) fill:#fff!important; @endif" fill="#888" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 512 512" stroke="#eee"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <g> <g> <path d="m256,105.5c-83.9,0-152.2,68.3-152.2,152.2 0,83.9 68.3,152.2 152.2,152.2 83.9,0 152.2-68.3 152.2-152.2 0-84-68.3-152.2-152.2-152.2zm0,263.5c-61.4,0-111.4-50-111.4-111.4 0-61.4 50-111.4 111.4-111.4 61.4,0 111.4,50 111.4,111.4 0,61.4-50,111.4-111.4,111.4z"></path> <path d="m256,74.8c11.3,0 20.4-9.1 20.4-20.4v-23c0-11.3-9.1-20.4-20.4-20.4-11.3,0-20.4,9.1-20.4,20.4v23c2.84217e-14,11.3 9.1,20.4 20.4,20.4z"></path> <path d="m256,437.2c-11.3,0-20.4,9.1-20.4,20.4v22.9c0,11.3 9.1,20.4 20.4,20.4 11.3,0 20.4-9.1 20.4-20.4v-22.9c0-11.2-9.1-20.4-20.4-20.4z"></path> <path d="m480.6,235.6h-23c-11.3,0-20.4,9.1-20.4,20.4 0,11.3 9.1,20.4 20.4,20.4h23c11.3,0 20.4-9.1 20.4-20.4 0-11.3-9.1-20.4-20.4-20.4z"></path> <path d="m54.4,235.6h-23c-11.3,0-20.4,9.1-20.4,20.4 0,11.3 9.1,20.4 20.4,20.4h22.9c11.3,0 20.4-9.1 20.4-20.4 0.1-11.3-9.1-20.4-20.3-20.4z"></path> <path d="M400.4,82.8L384.1,99c-8,8-8,20.9,0,28.9s20.9,8,28.9,0l16.2-16.2c8-8,8-20.9,0-28.9S408.3,74.8,400.4,82.8z"></path> <path d="m99,384.1l-16.2,16.2c-8,8-8,20.9 0,28.9 8,8 20.9,8 28.9,0l16.2-16.2c8-8 8-20.9 0-28.9s-20.9-7.9-28.9,0z"></path> <path d="m413,384.1c-8-8-20.9-8-28.9,0-8,8-8,20.9 0,28.9l16.2,16.2c8,8 20.9,8 28.9,0 8-8 8-20.9 0-28.9l-16.2-16.2z"></path> <path d="m99,127.9c8,8 20.9,8 28.9,0 8-8 8-20.9 0-28.9l-16.2-16.2c-8-8-20.9-8-28.9,0-8,8-8,20.9 0,28.9l16.2,16.2z"></path> </g> </g> </g></svg>
                    <svg style="width: 25px; @if(session('dark')) fill:#fff!important; @endif" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M32 256c0-123.8 100.3-224 223.8-224c11.36 0 29.7 1.668 40.9 3.746c9.616 1.777 11.75 14.63 3.279 19.44C245 86.5 211.2 144.6 211.2 207.8c0 109.7 99.71 193 208.3 172.3c9.561-1.805 16.28 9.324 10.11 16.95C387.9 448.6 324.8 480 255.8 480C132.1 480 32 379.6 32 256z"/></svg>
                   
                    </button> --}}
            </form>
                  
                         @if(!empty($localLanguage) and count($localLanguage) > 1)
                  
                    
                    <form action="/locale" method="post" class="mr-15 mx-md-20 d-inline">
                        {{ csrf_field() }}

                        <input type="hidden" name="locale">

                        <div class="language-select d-inline-block">
                            <div id="localItems"
                                 data-selected-country="{{ localeToCountryCode(mb_strtoupper(app()->getLocale())) }}"
                                 data-countries='{{ json_encode($localLanguage) }}'
                            ></div>
                        </div>
                    </form>
                @else
                    <div class="mr-15 mx-md-20"></div>
                @endif
                  
                  
                  
                   {{--@if(empty($authUser))
               
                    @include(getTemplate() . '.includes.shopping-cart-dropdwon')

                   
                
                @else
                  @include(getTemplate().'.includes.shopping-cart-dropdwon')
                   
                @include(getTemplate().'.includes.notification-dropdown')
                @endif--}}
                    </li>
                    
                   
              
                </ul>
              
            
        </div>
         <div class="nav-icons-or-start-live navbar-order justify-content-end">
         
                    
                    
                    
            
                
               
                
             @if(!empty($authUser))


                <div class="dropdown" style="margin-top:0.5em">
                    <a href="#!" class="navbar-user d-flex align-items-center ml-50 dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <img src="{{ $authUser->getAvatar() }}" class="rounded-circle" style="max-width:25px" alt="{{ $authUser->full_name }}">
                        <span class="font-12 user-name ml-10 text-dark-blue font-14">{{ substr($authUser->full_name,0,6) }}</span>
                    </a>

                    <div class="dropdown-menu user-profile-dropdown" aria-labelledby="dropdownMenuButton" style="width: 200px;">
                        <div class="d-md-none border-bottom mb-20 pb-10 text-right">
                            <i class="close-dropdown" data-feather="x" width="32" height="32" class="mr-10"></i>
                        </div>

                        <span class="dropdown-item" href="{{ $authUser->isAdmin() ? '/admin' : '/panel' }}">
                            <span class="font-14 text-dark-blue">{{ trans('public.my_points') }}</span>
                            <span  style="float: left;">{{ addCurrencyToPrice($authUser->getAccountingBalance()) }}</span>
                        </span>
                        <hr style="margin-bottom: 3px;">

                        <span style="font-size: 10px;">{{ trans('public.pages') }}</span>

                        <a class="dropdown-item ml-10 mt-1" href="{{ $authUser->isAdmin() ? '/admin' : '/panel' }}">
                            <img src="/assets/default/img/icons/sidebar/dashboard.svg" width="15" alt="nav-icon">
                            <i class="fa fa-"></i>
                            <span class="font-14 text-dark-blue">{{ trans('public.my_panel') }}</span>
                        </a>
                        @if($authUser->isTeacher() or $authUser->isOrganization())
                            <a class="dropdown-item ml-10 mt-1" href="{{ $authUser->getProfileUrl() }}">
                                <img src="/assets/default/img/icons/profile.svg" width="15" alt="nav-icon">
                                <span class="font-14 text-dark-blue">{{ trans('public.my_profile') }}</span>
                            </a>
                        @else
                            <a class="dropdown-item ml-10 mt-1" href="/panel/certificates/achievements">
                                <img src="/assets/default/img/icons/profile.svg" width="15" alt="nav-icon">
                                <span class="font-14 text-dark-blue">{{ trans('public.my_profile') }}</span>
                            </a>
                        @endif
                        <a class="dropdown-item ml-10 mt-1" href="/panel/webinars/purchases">
                            <img src="/assets/default/img/icons/video.svg" width="15" alt="nav-icon">
                            <span class="font-14 text-dark-blue">{{ trans('panel.webinars') }}</span>
                        </a>
                         @if(!$authUser->isAdmin())
                         <a class="dropdown-item ml-10 mt-1" href="/panel/imtmontessori-certificates">
                             <svg xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 24 24">
    <defs>
        <clipPath id="clip-path">
            <path id="Rectangle_204" fill="#1f3b64" stroke="#707070" d="M0 0H24V24H0z" data-name="Rectangle 204" transform="translate(25 410)"></path>
        </clipPath>
    </defs>
    <g id="Mask_Group_19" clip-path="url(#clip-path)" data-name="Mask Group 19" transform="translate(-25 -410)">
        <g id="reward" transform="translate(25 410)">
            <g id="Group_183" data-name="Group 183">
                <g id="Group_182" data-name="Group 182">
                    <path id="Path_163" d="M16.423 5.789a7.668 7.668 0 0 0-1.478-.824l-.59 1.406a6.165 6.165 0 0 1 1.181.659z" class="cls-3" data-name="Path 163"></path>
                    <path id="Path_164" d="M18.665 8.291a7.619 7.619 0 0 0-.982-1.373l-1.136 1.018a6.177 6.177 0 0 1 .786 1.1z" class="cls-3" data-name="Path 164"></path>
                    <path id="Path_165" d="M17.855 10.28a6.092 6.092 0 1 1-4.794-4.29l.263-1.5A7.81 7.81 0 0 0 12 4.374a7.618 7.618 0 1 0 7.321 5.479z" class="cls-3" data-name="Path 165"></path>
                    <path id="Path_166" d="M24 12l-1.954-2.692L22.393 6l-3.038-1.355L18 1.607l-3.308.347L12 0 9.308 1.954 6 1.607 4.645 4.645 1.607 6l.347 3.308L0 12l1.954 2.692L1.607 18l3.038 1.354L6 22.393l3.308-.347L12 24l2.692-1.954 3.308.347 1.354-3.038L22.393 18l-.347-3.308zm-5.8 6.2l-1.145 2.56-2.785-.3L12 22.116l-2.27-1.651-2.788.292L5.8 18.2l-2.563-1.148.3-2.782L1.884 12l1.651-2.27-.3-2.788L5.8 5.8l1.145-2.563 2.788.292L12 1.884l2.27 1.651 2.788-.292L18.2 5.8l2.562 1.144-.3 2.782L22.116 12l-1.651 2.27.292 2.788z" class="cls-3" data-name="Path 166"></path>
                    <path id="Path_167" d="M8.726 11.461l-1.078 1.078 2.827 2.827 5.115-5.115-1.079-1.078-4.036 4.037z" class="cls-3" data-name="Path 167"></path>
                </g>
            </g>
        </g>
    </g>
</svg>
                            <span class="font-14 text-dark-blue">شهادات المنتسورى</span>
                        </a>
                      @endif
                        <a class="dropdown-item ml-10 mt-1" href="/panel/setting">
                             <img src="/assets/default/img/icons/basic-info.svg" width="15" alt="nav-icon">

                            <span class="font-14 text-dark-blue">{{ trans('panel.settings') }}</span>
                        </a>
                        <hr>
                        <a class="dropdown-item ml-10 mt-1 mb-5" href="{{ route('themes.update') }}">

                            <span class="font-14 text-dark-blue">
                                @if(session('dark')) {{ trans('public.light_mode') }}
                                @else
                                    {{ trans('public.dark_mode') }}
                                @endif

                                <svg style="width: 15px;float: left;margin: 5px;padding: 0; @if(session('dark')) fill:#fff!important; @endif" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Pro 6.1.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. --><path d="M32 256c0-123.8 100.3-224 223.8-224c11.36 0 29.7 1.668 40.9 3.746c9.616 1.777 11.75 14.63 3.279 19.44C245 86.5 211.2 144.6 211.2 207.8c0 109.7 99.71 193 208.3 172.3c9.561-1.805 16.28 9.324 10.11 16.95C387.9 448.6 324.8 480 255.8 480C132.1 480 32 379.6 32 256z"/></svg>
                            </span>
                        </a>

                        <a class="dropdown-item" href="/logout" style="background: #595959;margin: 0;width: 100%;text-align: center;border-radius: 5px;">
{{--                             <span class="sidenav-setting-icon sidenav-item-icon ml-5">--}}
{{--                                @include('web.default.panel.includes.sidebar_icons.logout')--}}
{{--                            </span>--}}
                            <span class="font-14 text-light">{{ trans('panel.log_out') }}</span>
                        </a>
                    </div>
                </div>
            @else
                <div class="nav-icons-or-start-live navbar-order" style="margin-top: 0.5em;">
                @if(empty($authUser))
                <a href="/login?url={{urlencode(url()->current())}}" class="d-flex btn btn-sm btn-primary nav-start-a-live-btn">
                    {{__('auth.login')}}
                </a>
                @else
                <a href="/panel" class="d-flex btn btn-sm btn-primary nav-start-a-live-btn">
                    {{__('auth.my_panel')}}
                </a>
                @if (!empty($navBtnUrl))
                    <a href="{{ $navBtnUrl }}" class="d-flex btn btn-sm btn-primary nav-start-a-live-btn">
                        {{ $navBtnText }}
                    </a>

                    {{--<a href="{{ $navBtnUrl }}" class="d-flex d-lg-none text-primary nav-start-a-live-btn font-14">
                        {{ $navBtnText }}
                    </a>--}}
                @endif
                @endif
                @if(empty($authUser))
                 <div class="d-none nav-notify-cart-dropdown top-navbar ">
                    @include(getTemplate() . '.includes.shopping-cart-dropdwon')

                   
                </div>
                @else
                  <div class="d-none nav-notify-cart-dropdown top-navbar ">
                    @include(getTemplate() . '.includes.shopping-cart-dropdwon')

                    <div class="border-left mx-15"></div>

                    @include(getTemplate() . '.includes.notification-dropdown')
                </div>
                @endif
                

            </div>
            
            @endif
            </div>
</div>
           
        
        
    </div>
</nav>


@push('scripts_bottom')
<script src="/assets/default/js/parts/navbar.min.js"></script>
    <link href="/assets/default/vendors/flagstrap/css/flags.css" rel="stylesheet">
    <script src="/assets/default/vendors/flagstrap/js/jquery.flagstrap.min.js"></script>
    <script src="/assets/default/js/parts/top_nav_flags.min.js"></script>
    
@endpush
