<nav class="navbar navbar-expand-md 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 (count($albums) > 0)
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="{{ url('/') }}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                        @lang('navigation.navbar.albums')
                    </a>
                    <div class="dropdown-menu">
                        @foreach ($albums as $album)
                            <a class="dropdown-item" href="{{ $album->url() }}">{{ $album->name }}</a>
                        @endforeach
                    </div>
                </li>
            @endif

            @if (!Auth::guest() && (Auth::user()->can('admin:access')))
                <li class="nav-item">
                    <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">
                        <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>