<?php
    $urlRoot = $_SESSION['UrlRoot'];
    $Empresa = $_SESSION['usuarioEmpresa'];
    if($Empresa == 0) {
        $Empresa = isset($_GET['Empresa']) ? 0 : $Empresa;
    }
?>
    <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <?php
        echo "<a href='#' class='brand-link'>";
        if($Empresa == 0){
            echo "<img src='".$urlRoot."/img/ico.png' alt='QDT' class='brand-image img-circle elevation-3' style='opacity: .8'>";
        }
        echo "<span class='brand-text font-weight-light'>Control BD Intersolid</span></a>";
    ?>


    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar user panel (optional) -->
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
        <div class="image">
          <img src="dist/img/boxed-bg.png" class="img-circle elevation-2" alt="User Image">
        </div>
        <div class="info">
          <a href="#" class="d-block"><?php echo $_SESSION['usuarioNome']?></a>
        </div>
      </div>
      <!-- Desconectar-->
      <?php
            echo '<a href="'.$urlRoot.'php/desconectar.php">';
            echo '  <div class="user-panel mt-3 pb-3 mb-3 d-flex">';
            echo '    <button type="button" class="btn btn-block bg-gradient-danger" _msttexthash="76817" _msthash="285">Desconectar</button>';
            echo '  </div>';
            echo '</a>';
      ?>
      <!-- SidebarSearch Form -->
      <div class="form-inline">
        <div class="input-group" data-widget="sidebar-search">
          <input class="form-control form-control-sidebar" type="search" placeholder="Search" aria-label="Search">
          <div class="input-group-append">
            <button class="btn btn-sidebar">
              <i class="fas fa-search fa-fw"></i>
            </button>
          </div>
        </div>
      </div>

      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
          <!-- Codigo Para SuperUsuarios -->
          <?php
            if($_SESSION['usuarioSUP'] == 1) {
              echo '<li class="nav-item">';
              echo '  <a href="#" class="nav-link"> ';
              echo '      <i class="nav-icon fas fa-th"></i>';
              echo '      <p>Administradores';
              echo '        <i class="right fas fa-angle-left"></i>';
              echo '      </p>';
              echo '  </a>';
              echo '  <ul class="nav nav-treeview">';
              echo '    <li class="nav-item">';
              echo '      <a href="'.$urlRoot.'/painel.php" class="nav-link">';
              echo '        <i class="nav-icon fas fa-tachometer-alt"></i>';
              echo '        <p>Painel Principal</p>';
              echo '      </a>';
              echo '    </li>';
              echo '    <li class="nav-item">';
              echo '      <a href="#" class="nav-link">';
              echo '        <i class="nav-icon fas fa-table"></i>';
              echo '          <p>Cadastros';
              echo '            <i class="right fas fa-angle-left"></i>';
              echo '          </p>';
              echo '      </a>';
              echo '      <ul class="nav nav-treeview">';
              /*echo '        <li class="nav-item">';
              echo '          <a href="#" class="nav-link">';
              echo '            <i class="fas fa-circle nav-icon"></i>';
              echo '              <p>Acessos</p>';
              echo '           </a>';
              echo '        </li>';*/
              echo '        <li class="nav-item">';
              echo '          <a href="Forms/ListagemGruposAcesso.php" class="nav-link">';
              echo '            <i class="fas fa-circle nav-icon"></i>';
              echo '              <p>Grupos</p>';
              echo '           </a>';
              echo '        </li>';
              /*echo '        <li class="nav-item">';
              echo '          <a href="#" class="nav-link">';
              echo '            <i class="fas fa-circle nav-icon"></i>';
              echo '              <p>Canais</p>';
              echo '           </a>';
              echo '        </li>';*/
              echo '        <li class="nav-item">';
              echo '          <a href="Forms/ListagemUsuarios.php" class="nav-link">';
              echo '            <i class="fas fa-circle nav-icon"></i>';
              echo '              <p>Usuarios Intersolid</p>';
              echo '           </a>';
              echo '        </li>';
              echo '      </ul>';
              echo '</li>';
            }
          ?>
        </ul>
        <li class="nav-item">
          <a href="https://adminlte.io/docs/3.1/" class="nav-link">
            <i class="nav-icon fas fa-edit"></i>
            <p>Cadastro Usuário</p>
          </a>
        </li>
        <li class="nav-header"></li>
        <li class="nav-item">
          <a href="Forms/AlterarSenha.php" class="nav-link">
            <i class="nav-icon far fa-circle text-warning"></i>
            <p>Alterar Senha</p>
          </a>
        </li>
      </nav-->
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>
