 <!--  BEGIN SIDEBAR  -->
 <div class="sidebar-wrapper sidebar-theme">

     <nav id="sidebar">

         <div class="navbar-nav theme-brand flex-row  text-center">
             <div class="nav-logo">
                 <div class="nav-item theme-logo">
                     <a href="<?= base_url() ?>">
                         <img src="<?= base_url() ?>assets/img/<?= $setting->logo ?>" class="navbar-logo" alt="logo">
                     </a>
                 </div>
                 <div class="nav-item theme-text">
                     <a href="<?= base_url() ?>" class="nav-link"> <?= $setting->appname ?> </a>
                 </div>
             </div>
             <div class="nav-item sidebar-toggle">
                 <div class="btn-toggle sidebarCollapse">
                     <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevrons-left">
                         <polyline points="11 17 6 12 11 7"></polyline>
                         <polyline points="18 17 13 12 18 7"></polyline>
                     </svg>
                 </div>
             </div>
         </div>
         <div class="profile-info">
             <div class="user-info">
                 <div class="profile-img">
                     <img src="<?= base_url() ?>src/assets/img/profile-30.png" alt="avatar">
                 </div>
                 <div class="profile-content">
                     <h6 class=""><?= session()->get('nama') ?></h6>
                     <p class=""><?= session()->get('role') ?></p>
                 </div>
             </div>
         </div>

         <div class="shadow-bottom"></div>
         <ul class="list-unstyled menu-categories" id="accordionExample">
             <li class="menu">
                 <a href="<?= base_url('home') ?>" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="home"></i>
                         <span>Dashboard</span>
                     </div>
                 </a>
             </li>

             <li class="menu">
                 <a href="#menuLevel1" data-bs-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="layers"></i>
                         <span>Data Referensi</span>
                     </div>
                     <div>
                         <i data-feather="chevron-right"></i>
                     </div>
                 </a>
                 <ul class="collapse submenu list-unstyled" id="menuLevel1" data-bs-parent="#accordionExample">
                     <li>
                         <a href="<?= base_url('referensi/tahunpelajaran') ?>"> Tahun Pelajaran </a>
                     </li>
                     <li>
                         <a href="<?= base_url('referensi/matapelajaran') ?>"> Mata Pelajaran </a>
                     </li>
                     <li>
                         <a href="<?= base_url('referensi/tingkat') ?>"> Tingkat </a>
                     </li>
                     <li>
                         <a href="<?= base_url('referensi/rombel') ?>"> Rombongan Belajar </a>
                     </li>
                     <li>
                         <a href="<?= base_url('referensi/tujuan') ?>"> Tujuan Pembelajaran </a>
                     </li>
                     <li>
                         <a href="<?= base_url('referensi/ekstrakulikuler') ?>"> Ekstrakulikuler </a>
                     </li>
                 </ul>
             </li>

             <li class="menu">
                 <a href="#menuuser" data-bs-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="users"></i>
                         <span>Data User</span>
                     </div>
                     <div>
                         <i data-feather="chevron-right"></i>
                     </div>
                 </a>
                 <ul class="collapse submenu list-unstyled" id="menuuser" data-bs-parent="#accordionExample">

                     <li>
                         <a href="<?= base_url('siswa') ?>"> Data Siswa </a>
                     </li>
                     <li>
                         <a href="<?= base_url('user') ?>"> Data User </a>
                     </li>
                 </ul>
             </li>

             <li class="menu">
                 <a href="#menunilai" data-bs-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="file-text"></i>
                         <span>Penilaian</span>
                     </div>
                     <div>
                         <i data-feather="chevron-right"></i>
                     </div>
                 </a>
                 <ul class="collapse submenu list-unstyled" id="menunilai" data-bs-parent="#accordionExample">

                     <li>
                         <a href="<?= base_url('penilaian/akhir') ?>"> Penilaian Akhir </a>
                     </li>
                     <li>
                         <a href="<?= base_url('penilaian/eskul') ?>"> Penilaian Eskul </a>
                     </li>
                     <li>
                         <a href="<?= base_url('penilaian/absensi') ?>"> Absensi dan Catatan </a>
                     </li>
                 </ul>
             </li>

             <li class="menu">
                 <a href="#menuprint" data-bs-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="printer"></i>
                         <span>Cetak Rapor</span>
                     </div>
                     <div>
                         <i data-feather="chevron-right"></i>
                     </div>
                 </a>
                 <ul class="collapse submenu list-unstyled" id="menuprint" data-bs-parent="#accordionExample">
                     <li>
                         <a href="<?= base_url('rapor/akhir') ?>"> Akhir Semester </a>
                     </li>
                 </ul>
             </li>

             <li class="menu">
                 <a href="<?= base_url('pengaturan/sekolah') ?>" aria-expanded="false" class="dropdown-toggle">
                     <div class="">
                         <i data-feather="settings"></i>
                         <span>Pengaturan</span>
                     </div>
                 </a>
             </li>
         </ul>
     </nav>
 </div>
 <!--  END SIDEBAR  -->

 <?= $this->section('pagejs'); ?>
 <script type="text/javascript">
     $(document).ready(function() {
         var currentUrl = window.location.href;
         $('#accordionExample').find('a').each(function() {
             var menuUrl = $(this).attr('href');
             if (currentUrl.includes(menuUrl)) {
                 // Tambahkan kelas aktif pada tautan menu
                 $(this).addClass('active');
                 // Jika tautan menu adalah submenu, tambahkan kelas active pada dropdown-toggle dan kelas show pada submenu
                 if ($(this).hasClass('dropdown-toggle')) {
                     $(this).addClass('active');
                     $(this).next('.submenu').addClass('show');
                     $(this).closest('.menu').addClass('active');
                 }
                 // Jika tautan menu adalah submenu tetapi tidak memiliki class dropdown-toggle
                 if ($(this).closest('.submenu').length > 0) {
                     $(this).closest('.submenu').addClass('show');
                     $(this).closest('.menu').find('.dropdown-toggle').addClass('active');
                     $(this).closest('.menu').addClass('active');
                     $(this).closest('.submenu').closest('.menu').addClass('active'); // Tambahkan class active pada parent li
                 }
                 // Tambahkan kelas active pada elemen li yang merupakan submenu yang aktif
                 $(this).closest('.submenu').find('li').removeClass('active');
                 $(this).closest('li').addClass('active');
                 // Hentikan iterasi setelah menemukan tautan yang cocok
                 return false;
             }

         });


     });
 </script>
 <?= $this->endSection(); ?>