<?php
require_once 'inc/regiao.php';

include 'header.php';
include 'erpc_regiao_toolbar.php';
?>

<div class="block">
  <div class="header">
    <h2>Região - Lista</h2>
  </div>
  <div class="content">
    <?php
    //echo '<pre>' . var_export($_SESSION, true) . '</pre>';
    displayMessagesAndErrors();
    ?>
    <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 >Região</th>
            <th width="3%" class="no-sort">Editar</th>
            <th width="3%" class="no-sort">Remover</th>
          </tr>
        </thead>
        <tbody>
          <?php
          $lista = regiao_getAll();
          if ($lista !== false) {
            foreach($lista as $item) {
              $idUrl = urlencode(base64_encode($item['id']));
              ?>
          <tr>
            <td><?= htmlentities($item['id'], ENT_NOQUOTES, 'utf-8'); ?></td>
            <td><?= htmlentities($item['ds_regiao'], ENT_NOQUOTES, 'utf-8'); ?></td>
            <td class='text-center'>
              <a href="erpc_regiao_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_regiao_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';
?>
