<?PHP
namespace Views;

class NavBarHtml
{
	public function __construct() {}
	public function showMenu($departement, $user)
	{
		include_once("Classe/FunctionClasse.php");
		include("Parametre/" . getPath(1) . "/" . getPath(1) . ".php");

?>
		<nav class="navbar navbar-expand-md fixed-top navbar-dark bg-dark" style="background-color:LightGray;">
			<div class="container-fluid">
				<a class="navbar-brand" href="index.php">
					<img src="assets/images/logodrht_30.png" width="30" height="30" class="d-inline-block align-top" alt="">
					<span class="d-none d-lg-inline"><?= $NomSiteCap; ?></span>
				</a>
				<a class="navbar-brand abs" href="#">
					<h3 class="nav-link ">
						<?= $departement->nomDep; ?>
					</h3>
				</a>
				<div class="collapse navbar-collapse " id="navbarSupportedContent">
					<ul class="navbar-nav me-auto mb-2 mb-lg-0">
						<!--Menu Rapport AIC-->
						<?PHP if ($departement->rapportAicDep == 1) { ?>

						<?PHP }
						//Menu Gestion
						if ($user->isGestion($user)) {
						?>
							<li class="nav-item dropdown">
								<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
									Gestion
								</a>
								<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
									<li><a class="dropdown-item" href="index.php?page=frns">Fournisseur</a> </li>
									<li><a class="dropdown-item" href="index.php?page=po">Visiteurs</a></li>
									<li><a class="dropdown-item" href="index.php?page=ch">Visites</a></li>
								</ul>
							</li>

						<?PHP } ?>
						<li class="nav-item">
							<a class="nav-link" href="index.php?page=frns">Fournisseur</a>
						</li>
						<li class="nav-item">
							<a class="nav-link" href="index.php?page=vtrs">Visiteurs</a>
						</li>
						<li class="nav-item">
							<a class="nav-link" href="index.php?page=vsts">Visites</a>
						</li>
						<li class="nav-item">
							<a class="nav-link" href="index.php?page=ab">À propos</a>
						</li>
					</ul>

					<ul class="navbar-nav  ">

						<?php
						//valide si l'utilisateur est administrateur
						if ($user->isAdmin($user)) { ?>
							<li class="nav-item dropdown">
								<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
									Outils d'administration
								</a>
								<ul class="dropdown-menu" aria-labelledby="navbarDropdown">
									<li><a class="dropdown-item" href="index.php?page=user">Utilisateurs</a>
									<li><a class="dropdown-item" href="index.php?page=page">Pages</a>
									<li><a class="dropdown-item" href="index.php?page=role">Rôles</a>
									<li><a class="dropdown-item" href="index.php?page=page&typePage=pv">Pages vues</a>
									<li><a class="dropdown-item" href="index.php?page=wdw">Who did what?</a>

									<li Class="nav-item dropdown">
										<a class="nav-link dropdown-toggle" id="navbarDropdownAssignationLink" href="#" data-toggle="dropdown" style="color:black">&nbsp&nbsp&nbsp&nbspLiens utiles</a>
										<ul class="submenu dropdown-menu" aria-labelledby="navbarDropdownAssignationLink">
											<li><a class="dropdown-item" href="http://<?= $serveur; ?>/phpmyadmin/" target='_blank'>phpMyAdmin (<?= $serveur; ?>)</a></li>
										</ul>
									</li>

								</ul>
							</li>
						<?php
						}
						?>
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
								<?= $user->firstname . " " . $user->lastname; ?><span class="caret"></span>
							</a>

							<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
								<li><a class="dropdown-item" href="index.php?page=d">Déconnexion</a></li>
							</ul>
						</li>
					</ul>
				</div>

			</div>
		</nav>
<?PHP
	}
};
?>
