<nav class="navbar navbar-expand-lg navbar-absolute navbar-transparent">
    <div class="container-fluid">
        <div class="navbar-wrapper">
            <div class="navbar-toggle d-inline">
                <button type="button" class="navbar-toggler">
                    <span class="navbar-toggler-bar bar1"></span>
                    <span class="navbar-toggler-bar bar2"></span>
                    <span class="navbar-toggler-bar bar3"></span>
                </button>
            </div>
            <a class="navbar-brand">{{ $page ?? __('Dashboard') }}</a>
        </div>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navigation" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">
            <span class="navbar-toggler-bar navbar-kebab"></span>
            <span class="navbar-toggler-bar navbar-kebab"></span>
            <span class="navbar-toggler-bar navbar-kebab"></span>
        </button>
        <div class="collapse navbar-collapse" id="navigation">
            <ul class="navbar-nav ml-auto">
                <!-- if we have player and owner accounts later, check if owner here before creating this navbar item -->
                @role('admin')
                <li class="dropdown nav-item">
                    <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                        <div class="clubs"></div>
                        <i class="tim-icons icon-support-17"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-right dropdown-navbar">
                    @foreach ($owner_clubs as $club)
                        <li class="nav-link">
                            <a href='{{ action("ClubController@index", ["clubid" => $club->club_id]) }}' class="nav-item dropdown-item">{{ $club->club_name }}</a>
                        </li>
                    @endforeach
                    </ul>
                </li>
                @endrole
                <li class="search-bar input-group">
                    <button class="btn btn-link" id="search-button" data-toggle="modal" data-target="#searchModal"><i class="tim-icons icon-zoom-split"></i>
                        <span class="d-lg-none d-md-block">{{ __('Search') }}</span>
                    </button>
                </li>
                <!-- @role('admin')
                <li class="dropdown nav-item">
                    <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                    
                    </a>
                </li>
                @endrole -->
                @role('admin')
                <li class="dropdown nav-item">
                    <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                    @if($notifications->isEmpty())
                        <div class="notification-empty d-none d-lg-block d-xl-block"></div>
                        <i class="tim-icons icon-bell-55"></i>
                        <p class="d-lg-none"> {{ __('Notifications') }} </p>
                    </a> 
                    <ul class="dropdown-menu dropdown-menu-right dropdown-navbar" id = "notifications">
                        <li class="nav-link">
                            <a href="#" class="nav-item dropdown-item">No notifications to show</a>
                        </li>
                    @elseif(count($notifications))
                        <div class="notification-pending d-none d-lg-block d-xl-block"></div>
                        <i class="tim-icons icon-bell-55"></i>
                        <p class="d-lg-none"> {{ __('Notifications') }} </p>
                    </a>
                    <ul class="dropdown-menu dropdown-menu-right dropdown-navbar" id = "notifications">
                        @foreach ($notifications as $player)
                            <li class="nav-link">
                                <a href='{{ action("PlayerController@index", ["playerid" => $player->player_id]) }}' class="nav-item dropdown-item"><strong>{{ $player->full_name }}</strong> {{ $player->notification }}</a>
                            </li>
                        @endforeach 
                    @endif
                    </ul>
                </li>
                @endrole
                <li class="dropdown nav-item">
                    <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown">
                        <div class="photo">
                            <img src="/uploads/avatars/{{ Auth::user()->avatar}}" alt="{{ __('Profile Photo') }}">
                        </div>
                        <b class="caret d-none d-lg-block d-xl-block"></b>
                        <p class="d-lg-none">{{ __('Log out') }}</p>
                    </a>
                    <ul class="dropdown-menu dropdown-navbar">
                        <li class="nav-link">
                            <a href="{{ route('profile.edit') }}" class="nav-item dropdown-item">{{ __('Profile') }}</a>
                        </li>
                        <li class="nav-link">
                            <a href="#" class="nav-item dropdown-item">{{ __('Settings') }}</a>
                        </li> 
                        <li class="dropdown-divider"></li>
                        <li class="nav-link">
                            <a href="{{ route('logout') }}" class="nav-item dropdown-item" onclick="event.preventDefault();  document.getElementById('logout-form').submit();">{{ __('Log out') }}</a>
                        </li>
                    </ul>
                </li>
                <li class="separator d-lg-none"></li>
            </ul>
        </div>
    </div>
</nav>
<div class="modal modal-search fade" id="searchModal" tabindex="-1" role="dialog" aria-labelledby="searchModal" aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <form action="/search" method = "get">
                    <input type="search" name = "search" class="form-control" id="inlineFormInputGroup" placeholder="{{ __('SEARCH') }}">
                </form>
                <button type="button" class="close" data-dismiss="modal" aria-label="{{ __('Close') }}">
                        <i class="tim-icons icon-simple-remove"></i>
                </button>
            </div>
        </div>
    </div>
</div>

