<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
?>
<!DOCTYPE html>
<html lang="es">
<head>
  <meta charset="UTF-8">
  <title>Tabla estilo DataTables</title>
  <link rel="stylesheet" href="<?php echo URL_PATH; ?>/public/css/table.css">
  <link rel="stylesheet" href="<?php echo URL_PATH; ?>/public/colors.css">
  <link rel="stylesheet" href="<?php echo URL_PATH; ?>/public/menu.css">
  <link rel="stylesheet" href="<?php echo URL_PATH; ?>/public/app.css">
  <link rel="stylesheet" href="<?php echo URL_PATH; ?>/public/css/admin.css">

</head>
<body>
<?php include APP_PATH .'/views/components/navbar.php'; ?>
  <h1>Acuerdos</h1>
  <div style="display: flex; justify-content: flex-end; margin-bottom: 15px;">
  <a href="<?php echo URL_PATH; ?>/agreement/create" class="btn-create">
    <i class="fas fa-plus"></i> Crear Nuevo
  </a>
</div>  
  <div class="datatable-container">
    <table class="datatable">
      <thead>
        <tr>
          <th>Codigo Acuerdo</th>
          <th>Nombre Acuerdo</th>
          <th>Accion</th>
        </tr>
      </thead>
      <?php 
        echo "<pre>";
        print_r($data['agreements']);
        echo "</pre>";
      ?>
      <tbody>
        <?php if (empty($data['agreements'])): ?>
        <tr>
          <td colspan="3">No hay acuerdos</td>
        </tr>
        <?php endif; ?>
        <?php foreach ($data['agreements'] as $acuerdo): ?>
        <tr>
          <td><?php echo $acuerdo['AcuerdoId']; ?></td>
          <td><?php echo $acuerdo['NombreAcuerdo']; ?></td>
          <td>
          <a href="<?php echo URL_PATH; ?>/agreements/edit/<?php echo $acuerdo['AcuerdoId']; ?>" class="btn-edit"> <i class="fas fa-edit"></i> Editar </a>
          </td>
        </tr>
        <?php endforeach; ?>
        <!-- Agrega más filas según necesites -->
      </tbody>
    </table>

    <div class="datatable-footer">
      <div class="info">
        Showing 1 to 10 of 57 entries
      </div>
      <div class="pagination">
        <button disabled>Previous</button>
        <button class="active">1</button>
        <button>2</button>
        <button>3</button>
        <button>4</button>
        <button>5</button>
        <button>6</button>
        <button>Next</button>
      </div>
    </div>
  </div>
</body>
<?php include APP_PATH .'/views/components/footer.php'; ?>
</html>
