<!-- <header class="cd-main-header js-cd-main-header">
    <div class="cd-logo-wrapper text-white">
      <a href="#" class="text-white">Company Name</a>
    </div>
    
    <div class="cd-search js-cd-search">
    </div>
  
    <button class="reset cd-nav-trigger js-cd-nav-trigger" aria-label="Toggle menu"><span></span></button>
  
    <ul class="cd-nav__list js-cd-nav__list">
      <li class="cd-nav__item cd-nav__item--has-children cd-nav__item--account js-cd-item--has-children">
        <a href="#0">
          <ion-icon class="mr-3" style="font-size: 27px;" name="contact"></ion-icon>
          <span>Account</span>
        </a>
    
        <ul class="cd-nav__sub-list">
          <li class="cd-nav__sub-item"><a href="#">My Account</a></li>
          <li class="cd-nav__sub-item"><a onclick="logout(event)" href="#0"> Logout</a></li>
        </ul>
      </li>
    </ul>
  </header>

  <script>
	function logout(event){
		event.preventDefault();

		$.confirm({
			title: 'Logout',
			content: 'Do you really want to logout?',
			buttons: {   
				ok: {
					text: "Logout",
					btnClass: 'bg-primary text-white',
					keys: ['enter'],
					action: function(){
						document.getElementById('logout-form').submit();
					}
				},
				cancel: function(){
						console.log('the user clicked cancel');
				}
			}
		});

	}
</script> -->

<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
  <div class="container">
  <a class="navbar-brand" href="/">Report Generator System</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav ml-auto">  
    @if (Auth::check())   
    @if (Auth::user()->type == 'admin')
      <li class="nav-item active">
        <a class="nav-link mr-3" href="{{route('user.index')}}">User <span class="sr-only">(current)</span></a>
      </li> 
      @endif
      <li class="nav-item active">
        <a class="nav-link mr-3" href="{{route('report.index')}}">Report <span class="sr-only">(current)</span></a>
      </li> 
     
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle mr-3" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
          Profile
        </a>
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="{{route('myaccount')}}">My Account</a>
          <a onclick="logout(event)" class="dropdown-item" href="#">Log Out</a>
          <form id="logout-form" action="{{ route('logout') }}" method="POST" class="d-none">
              @csrf
          </form>
          
      </li>
      @endif
      
    </ul>
  </div>
  </div>
</nav>

<script>
	function logout(event){
		event.preventDefault();
		document.getElementById('logout-form').submit();
	}
</script>
