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

<aside class="main-sidebar sidebar-dark-primary elevation-4">

    <a href="<?= base_url('katalog') ?>" class="brand-link">

        <img src="<?= base_url('assets/img/logo.jpg') ?>"
            class="brand-image img-circle elevation-3"
            style="opacity:.8">

        <span class="brand-text font-weight-light">
            PERPUSTAKAAN
        </span>

    </a>

    <div class="sidebar">

        <div class="user-panel mt-3 pb-3 mb-3 d-flex">

            <div class="image">
                <img src="<?= base_url('assets/img/logo.jpg') ?>"
                     class="img-circle elevation-2"
                     alt="User Image"
                     style="width: 34px; height: 34px; object-fit: cover;">
            </div>

            <div class="info">
                <a href="#" class="d-block">
                    <?= esc(session()->get('nama')) ?>
                </a>
                <small class="text-muted" style="color: rgba(255,255,255,.7) !important;">
                    <i class="fas fa-user-graduate mr-1"></i>
                    <?= $roleLabel ?>
                </small>
            </div>

        </div>

        <nav class="mt-2">

            <ul class="nav nav-pills nav-sidebar flex-column"
                data-widget="treeview"
                role="menu">

                <li class="nav-item">
                    <a href="<?= base_url('katalog') ?>" class="nav-link">
                        <i class="nav-icon fas fa-book"></i>
                        <p>Daftar Buku</p>
                    </a>
                </li>

<li class="nav-item">
                    <a href="<?= base_url('katalog/ruang_baca') ?>" class="nav-link">
                        <i class="nav-icon fas fa-book-reader"></i>
                        <p>Ruang Baca PDF</p>
                    </a>
                </li>

                <li class="nav-item">
                    <a href="<?= base_url('katalog/daftar') ?>" class="nav-link">
                        <i class="nav-icon fas fa-user-plus"></i>
                        <p>Pendaftaran Anggota</p>
                    </a>
                </li>

                <li class="nav-item">
                    <a href="<?= base_url('logout') ?>" class="nav-link">
                        <i class="nav-icon fas fa-sign-out-alt"></i>
                        <p>Logout</p>
                    </a>
                </li>

            </ul>

        </nav>

    </div>

</aside>

