<?php
$nbOfNotification = 0;
foreach (Auth::user()->unreadNotifications as $notification) {
    $nbOfNotification = $nbOfNotification + 1;
} 
?>
<nav class="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top ">
    <div class="container-fluid">
      <div class="navbar-wrapper">
        <div class="navbar-minimize">
          <button id="minimizeSidebar" class="btn btn-just-icon btn-white btn-fab btn-round">
            <i class="material-icons text_align-center visible-on-sidebar-regular">more_vert</i>
            <i class="material-icons design_bullet-list-67 visible-on-sidebar-mini">view_list</i>
          </button>
        </div>
      </div>
      <button class="navbar-toggler" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
        <span class="sr-only">Toggle navigation</span>
        <span class="navbar-toggler-icon icon-bar"></span>
        <span class="navbar-toggler-icon icon-bar"></span>
        <span class="navbar-toggler-icon icon-bar"></span>
      </button>
      <div class="collapse navbar-collapse justify-content-end">
        <form class="navbar-form">
          <div class="input-group no-border">
            <input type="text" value="" class="form-control" placeholder="Search...">
            <button type="submit" class="btn btn-white btn-round btn-just-icon">
              <i class="material-icons">search</i>
              <div class="ripple-container"></div>
            </button>
          </div>
        </form>
        <ul class="navbar-nav">
          <li class="nav-item">
            <a class="nav-link" href="https://gitlab.com/TheGamecraft/c-cms/wikis/home" data-toggle="tooltip" data-placement="bottom" title="Aide">
              <i class="material-icons">help</i>
              <p class="d-lg-none d-md-block">
                Aide
              </p>
            </a>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link" href="http://example.com" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="material-icons">notifications</i>
              @if ($nbOfNotification != 0)
                <span class="notification">{{ $nbOfNotification }}</span>
              @endif
              <p class="d-lg-none d-md-block">
                Notifications
              </p>
            </a>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
                @foreach (Auth::user()->unreadNotifications as $notification)
                    <a class="dropdown-item" href="#">{{$notification->data['msg']}}</a>
                @endforeach
                @if ($nbOfNotification == 0)
                    <a class="dropdown-item">Aucune notification</a>
                @endif
            </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link" href="#pablo" id="navbarDropdownProfile" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="material-icons">person</i>
              <p class="d-lg-none d-md-block">
                Profil
              </p>
            </a>
            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownProfile">
              <a class="dropdown-item" href="/admin/profil">Profil</a>
              <a class="dropdown-item" href="/admin/profil/settings">Options</a>
              <div class="dropdown-divider"></div>
              <a class="dropdown-item" href="/logout">Déconnexion</a>
            </div>
          </li>
        </ul>
      </div>
    </div>
  </nav>