<?= $this->extend('templates/base') ?>

<!-- title -->
<?= $this->section('title') ?>HORAS TABLE<?= $this->endSection() ?>

<!-- head -->
<?= $this->section('head') ?>

<link rel="stylesheet" href="https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.12.1/js/jquery.dataTables.min.js"></script>

<?= $this->endSection() ?>

<!-- content -->
<?= $this->section('content') ?>


<table id="example" class="display dataTable" style="width:100%" aria-describedby="example_info">
    <thead>
        <tr>
            <th class="sorting sorting_asc" tabindex="0" aria-controls="example" rowspan="1" colspan="1" style="width: 128.867px;" aria-sort="ascending" aria-label="Name: activate to sort column descending">Fecha</th>
            <th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" style="width: 217.267px;" aria-label="Position: activate to sort column ascending">Horas</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($segundosDiarios as $dia) : ?>
            <tr>
                <td class="sorting_1"><?= esc($dia['dia']) ?> / <?= esc($dia['mes']) ?> / <?= esc($dia['ano']) ?></td>
                <td><?= esc($dia['total_horas_truncadas']) / 3600 ?>
            </tr>
            </tr>
        <?php endforeach ?>
    </tbody>
</table>


<script>
    document.addEventListener('DOMContentLoaded', function() {
        let table = new DataTable('#example');
    });
</script>

<?= $this->endSection() ?>