121 line
4.7 KiB
PHP

<?= $this->extend('templates/base') ?>
<!-- title -->
<?= $this->section('title') ?>Prestador<?= $this->endSection() ?>
<!-- head -->
<?= $this->section('head') ?>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.1.3/css/bootstrap.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>
<script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap5.min.js"></script>
<?= $this->endSection() ?>
<!-- content -->
<?= $this->section('content') ?>
<div class="row mb-5">
<!-- ENCUESTAS DISPONIBLES -->
<?php if (isset($encuestas)) : ?>
<div class="col-md-4">
<div class="card">
<div class="card-header">
Encuestas disponibles
</div>
<div class="card-body">
<div class="list-group list-group-flush">
<?php foreach ($encuestas as $encuesta) : ?>
<a href="<?= route_to('encuesta', $encuesta['id']) ?>" class="list-group-item list-group-item-action"><?= $encuesta['title'] ?></a>
<?php endforeach ?>
</div>
</div>
</div>
</div>
<?php endif ?>
<!-- HORAS MENSUALES -->
<div class="col-md-4 mb-5">
<div class="card">
<div class="card-header">
Horas realizadas por mes
</div>
<div class="card-body">
<table class="table table-sm table-hover">
<thead>
<th>Mes</th>
<th>Horas</th>
</thead>
<tbody>
<?php foreach ($segundosMensuales as $mes) : ?>
<tr>
<td><?= esc($mes['mes']) ?> / <?= esc($mes['ano']) ?></td>
<td><?= esc($mes['segundos']) / 3600 ?></td>
</tr>
<?php endforeach ?>
</tbody>
<tfoot class="table-active">
<td>Total</td>
<td><?= $horasTotales ?></td>
</tfoot>
</table>
<!-- <a data-bs-toggle="collapse" href="#collapseHoras" role="button" aria-expanded="true" aria-controls="collapseHoras">Ver desglose de horas</a> -->
</div>
</div>
</div>
<!-- DESGLOSE DE HORAS -->
<!-- <div class="collapse show" id="collapseHoras"> -->
<div class="col-md-5">
<div class="card">
<div class="card-header">
Desglose por día
</div>
<div class="card-body">
<table id="example" class="table table-striped" 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"><?= sprintf("%02d", esc($dia['dia'])) ?> / <?= sprintf("%02d", esc($dia['mes'])) ?> / <?= esc($dia['ano']) ?></td>
<td><?= esc($dia['total_horas_truncadas']) / 3600 ?>
</tr>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- </div> -->
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
let table = new DataTable('#example', {
'searching': false,
'ordering': false,
'language': {
"lengthMenu": "Mostrar _MENU_ registros",
"info": "Página: _PAGE_ / _PAGES_",
"zeroRecords": "No se encontraron registros",
"paginate": {
"first": "Inicio",
"last": "Fin",
"next": ">",
"previous": "<"
},
},
'order': [],
});
});
</script>
<?= $this->endSection() ?>