<?php
require_once 'header.php';
require_once 'erpc_usuarios_grupo_toolbar.php';
require_once 'inc/usuarios-grupo.php';

?>

<div class="block">
  <div class="header">
    <h2>Grupo de Usuários - Lista</h2>
  </div>
  <div class="content">
    <?php
    //echo '<pre>' . var_export($_SESSION, true) . '</pre>';
    displayMessagesAndErrors();
    ?>
    <p><a href="erpc_usuarios_grupo_add.php" class="btn btn-default btn-clean"><span class="fa fa-plus"></span> Adicionar Novo</a></p>
    <div class="table-responsive">
      <table class="table table-bordered table-striped table-responsible code-sortable" data-order-by="0">
        <thead>
          <tr>
            <!--<th width="3%"><input type="checkbox" class="checkall" /></th>-->
            <th width="15%" >ID</th>
            <th >Nome</th>
            <th width="3%" class="no-sort">Configurar</th>
            <th width="3%" class="no-sort">Editar</th>
            <th width="3%" class="no-sort">Remover</th>
          </tr>
        </thead>
        <tbody>
          <?php
          $lista = usuariosGrupo_getAll();
          foreach($lista as $item) {
            $idUrl = urlencode(base64_encode($item['id']));
            ?>
          <tr>
            <td><?= htmlentities($item['id'], ENT_NOQUOTES, 'utf-8'); ?></td>
            <td><?= htmlentities($item['ds_grupo'], ENT_NOQUOTES, 'utf-8'); ?></td>

            <td class='text-center'>
              <a href="erpc_grupo_funcionalidade_edit.php?id_grupo_crip=<?= $idUrl; ?>"><i class="glyphicon glyphicon-lock" title='Configurar Acesso a Funcionalidades'><span class="sr-only">Configurar Acesso a Funcionalidades</span></i></a>
            </td>

            <td class='text-center'>
              <a href="erpc_usuarios_grupo_edit.php?id=<?= $idUrl; ?>"><i class="glyphicon glyphicon-pencil" title='Editar'><span class="sr-only">Editar</span></i></a>
            </td>
            <td class='text-center'>
              <a href="erpc_usuarios_grupo_remove.php?id=<?= $idUrl; ?>"><i class="glyphicon glyphicon-remove" title='Remover'><span class="sr-only">Remover</span></i></a>
            </td>
          </tr>
            <?php
          }
          ?>
        </tbody>
      </table>
    </div> <!-- table-responsive -->
  </div> <!-- content -->
</div> <!-- block -->

<?php
include 'footer.php';
?>
