<?php
$role = session()->get('role');
$roleLabel = ($role == 'guru') ? 'Guru' : 'Siswa';
?>

<nav class="main-header navbar navbar-expand navbar-white navbar-light">

    <ul class="navbar-nav">

        <li class="nav-item">
            <a class="nav-link" data-widget="pushmenu" href="#">
                <i class="fas fa-bars"></i>
            </a>
        </li>

        <li class="nav-item d-none d-sm-inline-block">
            <span class="nav-link font-weight-bold">
                SISTEM INFORMASI PERPUSTAKAAN MAS ASY SYARIF
            </span>
        </li>

    </ul>

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

        <li class="nav-item dropdown">

            <a class="nav-link" data-toggle="dropdown" href="#">

                <i class="far fa-user-circle"></i>

                <?= esc(session()->get('nama')) ?>

                <span class="badge badge-primary ml-1">
                    <?= $roleLabel ?>
                </span>

            </a>

            <div class="dropdown-menu dropdown-menu-right">

                <a href="<?= base_url('logout') ?>" class="dropdown-item">

                    <i class="fas fa-sign-out-alt mr-2"></i>

                    Logout

                </a>

            </div>

        </li>

    </ul>

</nav>

