<?php
$data_menu = "";
$data_akses = $this->db->get_where('kategori_admin', 'id_user=' . $this->session->userdata('id_user'))->result();
//    $data_akses=$this->Kategori_admin_model->get_admin_cabang_akses($this->session->userdata('id_user'));
if (empty($data_akses)) {
  $data_menu = "0";
} else {
  foreach ($data_akses as $data_akses) {

    $data_menu .= "" . $data_akses->id_jenis_form . ",";
  }
}
$data_menu = explode(",", substr($data_menu, 0, 1));

?>
<!-- Page Wrapper -->
<div id="wrapper">

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

    <!-- Sidebar - Brand -->
    <a class="sidebar-brand d-flex align-items-center justify-content-center" href="<?php echo base_url(); ?>">
      <div class="sidebar-brand-icon">

        <img src="<?php echo base_url('assets/images/bml.png'); ?>" style="width: 35%;">
      </div>
    </a>

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

    <!-- Nav Item - Dashboard -->
    <li class="nav-item <?php if ($active == "dashboard") echo "active" ?>">
      <a class="nav-link" href="<?php echo base_url(); ?>">
        <i class="fas fa-fw fa-tachometer-alt"></i>
        <span>Dashboard</span></a>
    </li>

    <!-- Divider -->
    <hr class="sidebar-divider">

    <?php
    if ($this->session->userdata('level') == "0") {
    ?>

      <li class="nav-item">
        <a class="nav-link <?php if (!($active == "admin" || $active == "admin_supervisor")) echo "collapsed" ?>" href="#" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
          <i class="fas fa-fw fa-cog"></i>
          <span>User Control Panel</span>
        </a>
        <div id="collapseTwo" class="collapse <?php if ($active == "admin" || $active == "admin_supervisor") echo "show" ?>" aria-labelledby="headingTwo" data-parent="#accordionSidebar">
          <div class="bg-white py-2 collapse-inner rounded">
            <?php
            if ($this->session->userdata('level') == "0") {
            ?>
              <!--<a class="collapse-item <?php if ($active == "admin") echo "active" ?>" href="<?php echo base_url('user/admin'); ?>">Admin</a> -->
              <a class="collapse-item <?php if ($active == "admin") echo "active" ?>" href="#">Control Panel</a>
              <!--<a class="collapse-item <?php if ($active == "admin_supervisor") echo "active" ?>" href="<?php echo base_url('user/admin_supervisor'); ?>">Admin Supervisor</a> -->
            <?php
            }
            ?>
          </div>
        </div>
      </li>
    <?php
    }
    ?>
    <?php
    if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
    ?>

    <?php
    }
    ?>

    <?php
    if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
    ?>
      <li class="nav-item">
        <a class="nav-link <?php if (!($active == "checker" || $active == "checker_batubara_kirim")) echo "collapsed" ?>" href="#" data-toggle="collapse" data-target="#menu_checker" aria-expanded="true" aria-controls="collapseUtilities">
          <i class="fas fa-fw fa-users"></i>
          <span>EDP BML</span>
        </a>
        <div id="menu_checker" class="collapse <?php if ($active == "checker" || $active == "checker_batubara_kirim") echo "show" ?>" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
          <div class="bg-white py-2 collapse-inner rounded">
            <?php
            if ($this->session->userdata('level') == "0") {
            ?>
            <?php
            }
            ?>

            <a class="collapse-item <?php if ($active == "checker") echo "active" ?>" href="<?php echo base_url('checker'); ?>">EDP Stockpile</a>
            <a class="collapse-item <?php if ($active == "checker_batubara_kirim") echo "active" ?>" href="<?php echo base_url('checker_batubara_kirim'); ?>">EDP Jetty</a>
          </div>
        </div>
      </li>
    <?php
    }
    ?>

    <?php
    if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
    ?>
      <li class="nav-item">
        <a class="nav-link <?php if (!($active == "form_batubara_masuk" || $active == "asal_batubara_masuk" || $active == "stockpile_batubara_masuk" || $active == "stockpile2_batubara_masuk" || $active == "kode_batubara_masuk")) echo "collapsed" ?>" href="#" data-toggle="collapse" data-target="#menu_batubara_masuk" aria-expanded="true" aria-controls="collapseUtilities">
          <i class="fas fa-fw fa-file"></i>
          <span>Form Batubara Masuk</span>
        </a>
        <div id="menu_batubara_masuk" class="collapse <?php if ($active == "form_batubara_masuk" || $active == "asal_batubara_masuk" || $active == "stockpile_batubara_masuk" || $active == "stockpile_batubara_masuk2" || $active == "kode_batubara_masuk") echo "show" ?>" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
          <div class="bg-white py-2 collapse-inner rounded">
            <?php
            if ($this->session->userdata('level') == "0") {
            ?>
            <?php
            }
            ?>

            <a class="collapse-item <?php if ($active == "asal_batubara_masuk") echo "active" ?>" href="<?php echo base_url('asal_batubara_masuk'); ?>">Asal Batubara</a>
            <a class="collapse-item <?php if ($active == "kode_batubara_masuk") echo "active" ?>" href="<?php echo base_url('kode_batubara_masuk'); ?>">Kode Kirim</a>
            <!--<a class="collapse-item <?php if ($active == "site") echo "active" ?>" href="<?php echo base_url('site'); ?>">Site</a> -->
            <!--<a class="collapse-item <?php if ($active == "stockpile_batubara_masuk") echo "active" ?>" href="<?php echo base_url('stockpile_batubara_masuk'); ?>">Stockpile</a> -->
            <a class="collapse-item <?php if ($active == "form_batubara_masuk") echo "active" ?>" href="<?php echo base_url('form_batubara_masuk'); ?>">Batubara Masuk</a>
          </div>
        </div>
      </li>
    <?php
    }
    ?>

    <?php
    if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
    ?>
      <li class="nav-item">
        <a class="nav-link <?php if (!($active == "form_batubara_produksi")) echo "collapsed" ?>" href="#" data-toggle="collapse" data-target="#menu_batubara_produksi" aria-expanded="true" aria-controls="collapseUtilities">
          <i class="fas fa-fw fa-file"></i>
          <span>Form Batubara Produksi</span>
        </a>
        <div id="menu_batubara_produksi" class="collapse <?php if ($active == "form_batubara_produksi") echo "show" ?>" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
          <div class="bg-white py-2 collapse-inner rounded">
            <?php
            if ($this->session->userdata('level') == "0") {
            ?>
            <?php
            }
            ?>

            <a class="collapse-item <?php if ($active == "form_batubara_kirim") echo "active" ?>" href="<?php echo base_url('form_batubara_produksi'); ?>">Batubara Produksi</a>
          </div>
        </div>
      </li>
    <?php
    }
    ?>

    <?php
    if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
    ?>
      <li class="nav-item">
        <a class="nav-link <?php if (!($active == "form_batubara_kirim" || $active == "asal_batubara_kirim" || $active == "unit_batubara_kirim" || $active == "tujuan_batubara_kirim" || $active == "kode_batubara_kirim")) echo "collapsed" ?>" href="#" data-toggle="collapse" data-target="#menu_batubara_kirim" aria-expanded="true" aria-controls="collapseUtilities">
          <i class="fas fa-fw fa-file"></i>
          <span>Form Batubara Kirim</span>
        </a>
        <div id="menu_batubara_kirim" class="collapse <?php if ($active == "form_batubara_kirim" || $active == "asal_batubara_kirim" || $active == "unit_batubara_kirim" || $active == "tujuan_batubara_kirim" || $active == "kode_batubara_kirim") echo "show" ?>" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">
          <div class="bg-white py-2 collapse-inner rounded">
            <?php
            if ($this->session->userdata('level') == "0") {
            ?>
            <?php
            }
            ?>

            <a class="collapse-item <?php if ($active == "kode_batubara_kirim") echo "active" ?>" href="<?php echo base_url('kode_batubara_kirim'); ?>">Kode Kirim</a>
            <a class="collapse-item <?php if ($active == "tujuan_batubara_kirim") echo "active" ?>" href="<?php echo base_url('tujuan_batubara_kirim'); ?>">Tujuan Kirim</a>
            <a class="collapse-item <?php if ($active == "form_batubara_kirim") echo "active" ?>" href="<?php echo base_url('form_batubara_kirim'); ?>">Batubara Kirim</a>
          </div>
        </div>
      </li>
    <?php
    }
    ?>







    <!--<?php
        if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
        ?>
      <li class="nav-item <?php if ($active == "resume") echo "active" ?>">
        <a class="nav-link" href="<?php echo base_url('resume'); ?>">
          <i class="fas fa-fw fa-calculator"></i>
          <span>Resume</span></a>
      </li>
    <?php
        }
    ?> -->


    <!--<?php
        if ($this->session->userdata('level') == 0 or (in_array(1, $data_menu))) {
        ?>
      <li class="nav-item <?php if ($active == "resume") echo "active" ?>">
        <a class="nav-link" href="<?php echo base_url('resume'); ?>">
          <i class="fas fa-fw fa-calculator"></i>
          <span>Resume</span></a>
      </li>
    <?php
        }
    ?> -->

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

    <!-- Sidebar Toggler (Sidebar) -->
    <div class="text-center d-none d-md-inline">
      <button class="rounded-circle border-0" id="sidebarToggle"></button>
    </div>
  </ul>
  <!-- End of Sidebar -->
  <?php
  /*
	if($this->session->userdata('level') == "1"){
  ?>
<script>
if (window.innerWidth > 768) {
	document.getElementById("accordionSidebar").style.visibility = "visible"; 
}else{
	document.getElementById("accordionSidebar").style.visibility = "hidden"; 
}
</script>
<?php
	}
	*/
  ?>