<?php

    if(ENVIRONNEMENT == "DEV"){
        $titleEnvironnement = "<a href=\"/\"><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">DEV</span></a>";
        $classHead = "bg-secondary";
    } elseif(ENVIRONNEMENT == "PREPROD"){
        $titleEnvironnement = "<a href=\"/\"><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">PREPROD</span></a>";
        $classHead = "bg-secondary";
    } elseif(ENVIRONNEMENT == "PROD"){
        $titleEnvironnement = "";
        $classHead = "bg-dark";
    }

    if(core::isMaintenance()){
        $titleMaintenance = "<a href=\"/parametres.html\"><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">SITE EN MODE MAINTENANCE</span></a>";
    } else {
        $titleMaintenance = "";
    }

    if(core::isDebug()){
        $titleDebug = "<a href=\"/parametres.html\"><span class=\"badge\" style=\"background-color:red; margin-left:5px;\">MODE DEBUG</span></a>";
    } else {
        $titleDebug = "";
    }
    
?>
<header class="navbar sticky-top <?php echo $classHead ?> navbar-expand-sm navbar-dark flex-md-nowrap p-0 shadow">
    <div class="container-fluid">
        <a href="/" style="box-shadow: none;" class="navbar-brand <?php echo $classHead ?>">CSE Invent : Base des salariés</a><?php echo $titleEnvironnement . $titleMaintenance . $titleDebug; ?>
        <div id="navbarCollapse" class="collapse navbar-collapse p-0">
            <ul class="nav navbar-nav ms-auto">
                <li class="nav-item dropdown">
                    <a href="#" class="nav-link dropdown-toggle" data-bs-toggle="dropdown"><?php echo session::getName() ?></a>
                    <div class="dropdown-menu dropdown-menu-end">
                        <a href="/user.html" class="dropdown-item">Mon profil</a>
                        <div class="dropdown-divider"></div>
                        <a href="/submit.php?from=logout" class="dropdown-item">Se déconnecter</a>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</header>    
