<?php $render('header', ['loggedUser'=>$loggedUser, 'title'=>$titlePage]); ?>
<?=$render('sidebar', [
  'loggedUser'=>$loggedUser, 
  'pageActive'=>$pageActive,
  'permissions'=>$permissions
]);?>

<!-- Content System -->
<div class="content-wrapper">
  <div class="pages">
    <h3>Permissões</h3>
    <div class="permissions">

      <div class="buttons">
        <a href="<?=$base;?>/addgroup" class="btn btn-primary lh-30">Adicionar Novo Grupo</a>
      </div>
      <!-- Message -->

      <?php if(!empty($error)): ?>
        <div class="alert <?=$error['alertType'];?>" role="alert">
          <?=$error['msg']; ?>
        </div>
      <?php endif; ?>

      <!-- /Message -->

      <table class="table table-hover">
        <tbody>
          <tr>
            <th scope="col">Nome do Grupo</th>
            <th scope="col">Ações</th>
          </tr>
          <?php foreach ($groupsList as $group): ?>
            <tr>
              <td><?=$group['name']; ?></td>
              <td>
                <a href="<?=$base;?>/editgroup&g=<?=$group['id'];?>" class="btn btn-info">Editar</a>
                <a href="<?=$base;?>/deletegroup&g=<?=$group['id'];?>" class="btn btn-danger" onclick="return confirm('Tem certeza que deseja excluir?')">Excluir</a>
              </td>
            </tr>
          <?php endforeach; ?>
        </tbody>
      </table>
    </div>
  </div>  		
</div>
<!-- /.content-system -->

<?=$render('footer');?>