<!-- Sidebar -->
<ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">

  <!-- Brand -->
  <a class="sidebar-brand d-flex align-items-center justify-content-center" href="<?= base_url('dashboard'); ?>">
    <div class="sidebar-brand-icon">
      <img src="<?= base_url('assets/sb-admin2/img/hsilogo.png'); ?>" alt="HSI Logo" style="height:40px;">
    </div>
    <div class="sidebar-brand-text mx-3">HSI Academy</div>
  </a>

  <hr class="sidebar-divider my-0">

  <!-- Dashboard (semua role) -->
  <li class="nav-item <?= ($this->uri->segment(1) == 'dashboard' && $this->uri->segment(2) == '') ? 'active' : '' ?>">
    <a class="nav-link" href="<?= base_url('dashboard'); ?>">
      <i class="fas fa-fw fa-tachometer-alt"></i>
      <span>Dashboard</span>
    </a>
  </li>

  <hr class="sidebar-divider">

  <?php $role_id = $this->session->userdata('role_id'); ?>

  <!-- ================= ADMIN 1 (FULL AKSES) ================= -->
  <?php if ($role_id == 1): ?>

    <!-- MASTER DATA -->
    <div class="sidebar-heading">Master Data</div>

    <li class="nav-item <?= ($this->uri->segment(2) == 'calon_siswa') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dashboard/calon_siswa'); ?>">
        <i class="fas fa-user-plus"></i>
        <span>Calon Siswa HSI</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(2) == 'calon_lpk') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dashboard/calon_siswa_lain'); ?>">
        <i class="fas fa-user-friends"></i>
        <span>Calon Siswa LPK Lain</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(2) == 'kelola') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dashboard/kelola'); ?>">
        <i class="fas fa-users"></i>
        <span>Kelola Siswa</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(2) == 'siswa_ditolak') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dashboard/siswa_ditolak'); ?>">
        <i class="fas fa-user-times"></i>
        <span>Siswa Ditolak</span>
      </a>
    </li>

    <!-- TRANSAKSI -->
    <div class="sidebar-heading">Transaksi</div>

    <li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_pelatihan') ? 'active' : '' ?>">
    <a class="nav-link" href="<?= base_url('pembayaran_pelatihan/admin'); ?>">
        <i class="fas fa-chalkboard-teacher"></i>
        <span>Pembayaran Pelatihan</span>
    </a>
</li>

<li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_raftel') ? 'active' : '' ?>">
    <a class="nav-link" href="<?= base_url('pembayaran_raftel/admin'); ?>">
        <i class="fas fa-plane-departure"></i>
        <span>Pembayaran Raftel</span>
    </a>
</li>

<li class="nav-item <?= ($this->uri->segment(1) == 'laporan_keuangan' || $this->uri->segment(1) == 'laporan-keuangan') ? 'active' : ''; ?>">
  <a class="nav-link" href="<?= base_url('laporan-keuangan'); ?>">
    <i class="fas fa-fw fa-file-invoice-dollar"></i>
    <span>Laporan Keuangan</span>
  </a>
</li>


    <!-- PENGATURAN -->
    <div class="sidebar-heading">Pengaturan</div>

    <li class="nav-item <?= ($this->uri->segment(1) == 'biaya') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('biaya'); ?>">
        <i class="fas fa-money-bill-wave"></i>
        <span>Pengaturan Biaya</span>
      </a>
    </li>

  <!-- ================= ADMIN 2 (READ ONLY) ================= -->
  <?php elseif ($role_id == 2): ?>
    <div class="sidebar-heading">Master Data</div>

    <li class="nav-item <?= ($this->uri->segment(2) == 'kelola') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dashboard/kelola'); ?>">
        <i class="fas fa-eye"></i>
        <span>Kelola Siswa</span>
      </a>
    </li>

    <div class="sidebar-heading">Transaksi</div>

    <li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_pelatihan') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('pembayaran_pelatihan/admin'); ?>">
        <i class="fas fa-chalkboard-teacher"></i>
        <span>Pembayaran Pelatihan</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_raftel') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('pembayaran_raftel/admin'); ?>">
        <i class="fas fa-plane-departure"></i>
        <span>Pembayaran Raftel</span>
      </a>
    </li>

  <!-- ================= SISWA ================= -->
  <?php elseif ($role_id == 3): ?>

    <div class="sidebar-heading">Siswa</div>

    <li class="nav-item <?= ($this->uri->segment(2) == 'dokumen_saya') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('dokumen'); ?>">
        <i class="fas fa-file"></i>
        <span>Dokumen Saya</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_pelatihan') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('pembayaran_pelatihan'); ?>">
        <i class="fas fa-money-check-alt"></i>
        <span>Pembayaran Pelatihan</span>
      </a>
    </li>

    <li class="nav-item <?= ($this->uri->segment(1) == 'pembayaran_raftel') ? 'active' : '' ?>">
      <a class="nav-link" href="<?= base_url('pembayaran_raftel'); ?>">
        <i class="fas fa-plane"></i>
        <span>Pembayaran Raftel</span>
      </a>
    </li>

  <?php endif; ?>

  <hr class="sidebar-divider d-none d-md-block">

  <!-- Sidebar Toggler -->
  <div class="text-center d-none d-md-inline">
    <button class="rounded-circle border-0" id="sidebarToggle"></button>
  </div>
</ul>
<!-- End of Sidebar -->
