<nav class="navbar navbar-expand-lg navbar-dark">
    <a class="navbar-brand" href="{{ route('home')  }}"><i class="fa fa-fw fa-photo"></i> {{ UserConfig::get('app_name') }}</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-content" aria-controls="navbar-content" aria-expanded="false" aria-label="Toggle navigation">
        <i class="fa fa-fw fa-bars"></i>
    </button>

    <div class="collapse navbar-collapse" id="navbar-content">
        <ul class="navbar-nav mr-auto">
            @if (!Auth::guest() && UserConfig::get('social_user_feeds'))
                <li class="nav-item">
                    <a class="nav-link" href="{{ route('userActivityFeed') }}">
                        <i class="fa fa-rss"></i> @lang('navigation.navbar.activity_feed')
                    </a>
                </li>
            @endif
            @can('photo.quick_upload')
                <li class="nav-item">
                    <a class="nav-link" href="#" data-toggle="modal" data-target="#quick-upload-modal">
                        <i class="fa fa-plus"></i> @lang('navigation.navbar.quick_post')
                    </a>
                </li>
            @endcan

            @if (count($g_albums) > 0)
                <li class="nav-item dropdown ml-2">
                    <a class="nav-link dropdown-toggle" href="{{ url('/') }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <i class="fa fa-book"></i> @lang('navigation.navbar.albums')
                    </a>
                    <div class="dropdown-menu">
                        @foreach ($g_albums_menu as $album)
                            <a class="dropdown-item" href="{{ $album->url() }}">{{ $album->name }}</a>
                        @endforeach

                        @if ($g_more_albums > 0)
                            <a class="dropdown-item" href="{{ route('home') }}">{{ trans_choice('gallery.show_more_albums', $g_more_albums) }}</a>
                        @endif
                    </div>
                </li>
            @endif

            @if (count($g_labels) > 0)
                <li class="nav-item dropdown ml-2">
                    <a class="nav-link dropdown-toggle" href="{{ url('/') }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        <i class="fa fa-tags"></i> @lang('navigation.navbar.labels')
                    </a>
                    <div class="dropdown-menu">
                        @foreach ($g_labels as $label)
                            <a class="dropdown-item" href="{{ $label->url() }}">{{ $label->name }} ({{ number_format($label->photos_count, 0) }})</a>
                        @endforeach

                        @if ($g_more_labels > 0)
                            <a class="dropdown-item" href="{{ route('labels') }}">{{ trans_choice('gallery.show_more_labels', $g_more_labels) }}</a>
                        @endif
                    </div>
                </li>
            @endif

            @if (count($g_albums) > 0 && \App\User::currentOrAnonymous()->can('statistics.public-access'))
                <li class="nav-item ml-2">
                    <a class="nav-link" href="{{ route('statistics.index') }}"><i class="fa fa-bar-chart"></i> @lang('navigation.navbar.statistics')</a>
                </li>
            @endif

            @if (!Auth::guest() && (Auth::user()->can('admin:access')))
                <li class="nav-item ml-2">
                    <a class="nav-link" href="{{ route('admin') }}"><i class="fa fa-fw fa-cog"></i> @lang('navigation.navbar.admin')</a>
                </li>
            @endif
        </ul>

        @if (Auth::guest())
            <form class="form-inline my-2 my-lg-0">
                @if (UserConfig::get('allow_self_registration') == 1)
                    <a class="btn btn-info" href="{{ url('/register') }}" style="margin-right: 10px;">@lang('navigation.navbar.register')</a>
                @endif
                <a class="btn {{ UserConfig::get('allow_self_registration') == 1 ? 'btn-outline-info' : 'btn-info' }}" href="{{ url('/login') }}">@lang('navigation.navbar.login')</a>
            </form>
        @else
            <ul class="navbar-nav right">
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="{{ url('/') }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        {{ Auth::user()->name }}
                        {{--<img class="avatar" src="{{ Theme::gravatarUrl(Auth::user()->email, 42) }}" alt="{{ Auth::user()->name }}" title="{{ Auth::user()->name }}" />--}}
                    </a>
                    <div class="dropdown-menu dropdown-menu-right">
                        @if (UserConfig::get('social_user_profiles') && Auth::user()->enable_profile_page)
                            <a class="dropdown-item" href="{{ Auth::user()->profileUrl() }}">@lang('navigation.navbar.public_profile_page')</a>
                        @endif
                        <a class="dropdown-item" href="{{ route('userSettings') }}">@lang('navigation.navbar.user_settings')</a>
                        <div class="dropdown-divider"></div>
                        <a class="dropdown-item" href="{{ route('auth.changePassword') }}">@lang('navigation.navbar.change_password')</a>
                        <a class="dropdown-item" href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">@lang('navigation.navbar.logout')</a>
                        <form id="logout-form" action="{{ url('/logout') }}" method="POST" style="display: none;">
                            {{ csrf_field() }}
                        </form>
                    </div>
                </li>
            </ul>
        @endif
    </div>
</nav>
