<nav class="main-header navbar navbar-expand navbar-white navbar-light dropdown-legacy border-bottom-0 text-sm">

    <ul class="navbar-nav">
        <li class="nav-item">
            <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
        </li>
        <li class="nav-item">
            <a class="nav-link" data-widget="fullscreen" href="#" role="button">
                <i class="fas fa-expand-arrows-alt"></i>
            </a>
        </li>

    </ul>

    <ul class="navbar-nav ml-auto">

        <li class="nav-item">
            <a class="nav-link" data-widget="navbar-search" href="#" role="button">
                <i class="fas fa-search"></i>
            </a>
            <div class="navbar-search-block">
                <form class="form-inline" autocomplete="off">
                    <div class="input-group input-group-sm">
                        <input class="form-control form-control-navbar" type="search" placeholder="Search" aria-label="Search" autocomplete="off" name="keyword">
                        <div class="input-group-append">
                            <button class="btn btn-navbar" type="submit" autocomplete="off">
                                <i class="fas fa-search"></i>
                            </button>
                            <button class="btn btn-navbar" type="button" data-widget="navbar-search" autocomplete="off">
                                <i class="fas fa-times"></i>
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </li>

        <!-- Language Dropdown Menu -->
        <?php

        $currentLocal = ($locale == 'en') ? 'gb' : $locale;
        // $currentLocal = ($locale == 'bi') ? 'bi' : $locale;
        ?>
        <!-- <li class="nav-item dropdown">
            <a class="nav-link" data-toggle="dropdown" href="#">
                <i class="flag-icon flag-icon-<?php //echo $currentLocal ?>"></i>
            </a>
            <div class="dropdown-menu dropdown-menu-right p-0">
                 <a href="<?php //echo base_url("fr") ?>" class="dropdown-item <?php //echo ($locale == 'fr') ? 'active' : '' ?>">
                    <i class="flag-icon flag-icon-fr mr-2"></i> <?php //echo lang("Params.fr") ?>
                </a> 
            </div>
        </li> -->

        <li class="nav-item dropdown user-menu">
            <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">
                <?php //$image = $_SESSION['passportImage']; ?>
                <?php $image = 'avatar.png' ?>
                <?php if ($image) {
                        echo img(base_url('assets/dist/img/' . $image), false, 'class="img-circle elevation-2", width="30px" height="30px"');
                    } else { ?>
                       <i class="bi bi-person-fill"></i>
                    <?php } ?>
                <span class="d-none d-md-inline">
                    <?= \auth()->user()->prenom . " " . \auth()->user()->nom ?? "Utilisateur" ?>
                </span>
            </a>
            <ul class="dropdown-menu dropdown-menu-lg dropdown-menu-right">

                <li class="user-header bg-primary">
                    <?php if ($image) {
                        echo img(base_url('uploads/passport/' . $image), false, 'class="img-circle elevation-2" width="50px" height="50px"');
                    } else { ?>
                        <h1><i class="bi bi-person-fill"></i></h1>
                    <?php } ?>
                    
                    <p>
                        <?= \auth()->user()->prenom . " " . \auth()->user()->nom ?? "Utilisateur" ?>
                    </p>
                </li>

                <li class="user-footer">
                    <?php if (auth()->loggedIn()) { ?>
                        <?= anchor($locale . "/logout", "<i class='far fa-circle nav-icon'></i> Déconnexion", ['class' => 'btn btn-default btn-flat float-right']) ?>
                        <!-- <a href="<?= site_url() . '/logout' ?>" class="btn btn-default btn-flat float-right"></a> -->
                    <?php } else { ?>
                        <?= anchor($locale . "/login", "<i class='far fa-circle nav-icon'></i> Connexion", ['class' => 'btn btn-default btn-flat float-right']) ?>
                    <?php } ?>
                </li>
            </ul>
        </li>
    </ul>
</nav>