<?php
require_once './modelos/Consultas.php';
$dbManager = new Consultas();
$MarcacionesHoy = $dbManager->registradosHoy();
?>
<style type="text/css">
  .entrando {
    background-color: #55FF00!important;
  }
  .saliendo {
    background-color: #FFFF00!important;
  }
</style>
<table id="registroshoy" class="table table-condensed" style="font-size: 80%;" data-page-length='50' >
  <thead>
    <tr>
      <th style="width: 39%;"></th>
      <th style="width: 20%;">Marcación</th>
      <th style="width: 10%;">Cédula</th>
      <th style="width: 30%;">Nombre</th>
      <th style="width: 1%;"></th>
    </tr>
  </thead>
  <tbody>
    <?php foreach($MarcacionesHoy as $indice => $Marcacion): ?>
      <tr
      <?php if($Marcacion->sentidoMarca == 'ENTRANDO'): ?>
          class="entrando"
        <?php elseif($Marcacion->sentidoMarca == 'SALIENDO'): ?>
          class="saliendo"
        <?php endif; ?>
        >
        <td><img class="crece" src="<?php echo ( empty($Marcacion->fotoMarca) ? "../img/Logo.png" : "../" . $Marcacion->fotoMarca ) ?>" width="100%" alt="foto"/></td>
        <td><?php echo $Marcacion->fechaMarca ?></td>
        <td><?php echo $Marcacion->cedEmp ?></td>
        <td><?php echo $Marcacion->nombreEmp ?></td>
        <td>
          <?php if($Marcacion->sentidoMarca == 'ENTRANDO'): ?>
            <i class="fa fa-arrow-up"></i>
          <?php elseif($Marcacion->sentidoMarca == 'SALIENDO'): ?>
            <i class="fa fa-arrow-down"></i>
          <?php endif; ?>
        </td>
      </tr>
    <?php endforeach; ?>
  </tbody>
</table>
<script type="text/javascript" >
  $(document).ready(function () {
    $('#registroshoy').DataTable({
      "order": [[0, "desc"]],
      "scrollY": "600px",
      "scrollCollapse": true,
      "paging": false
    });
  });
</script>
