{% extends 'navbar.html.twig' %}
{% block title %}Historial{% endblock %}
{% block content_user %}
<span class="h5">Historial de Tareas</span>
<br>
<hr>
{{ form_start(form, { 'attr' : { 'novalidate' : 'novalidate'}}) }}
<div class="form-row pt-2">
<div class="col col-lg-3">
{{ form_label(form.from, 'Desde') }}
{{ form_widget(form.from, { 'attr' : { 'class' : 'form-control form-control inherit'} }) }}
{{ form_errors(form.from) }}
</div>
<div class="col col-lg-3">
{{ form_label(form.to, 'Hasta') }}
{{ form_widget(form.to, { 'attr' : { 'class' : 'form-control form-control inherit'} }) }}
{{ form_errors(form.to) }}
</div>
<div class="col col-lg-4">
{{ form_label(form.equipo) }}
{{ form_widget(form.equipo, { 'attr' : { 'class' : 'form-control form-control inherit form-select'} }) }}
{{ form_errors(form.equipo) }}
</div>
<div class="col col-lg-2 px-2 mt-4 pt-4">
{{ form_widget(form.cargar, { 'attr' : { 'class' : 'btn btn-success btn-block'} }) }}
</div>
</div>
{{ form_end(form) }}
<hr>
{% if history is defined %}
<table id="example" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>Equipo</th>
<th>Fecha</th>
<th>Departamento</th>
<th>Tarea Realizada</th>
<th></th>
</tr>
</thead>
<tbody>
{% for diagrama_tarea in history %}
<tr>
<td>{{ diagrama_tarea.nomequipo }}</td>
<td data-sort="{{ diagrama_tarea.fecha|date('Y-m-d') }}">{{ diagrama_tarea.fecha ? diagrama_tarea.fecha|date('d/m/Y') : '' }}</td>
<td>{{ diagrama_tarea.nomdepto }}</td>
<td>{{ diagrama_tarea.observacionResponsable }}</td>
<td>
<a href="{{ path('app_mantenimiento_diagrama_tarea_show', {'id': diagrama_tarea.id}) }}"><i class="bi bi-eye" style="font-size: 1rem;"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}
{% block javascripts_footer %}
{{ parent() }}
<script type="text/javascript">
$('.btn-delete').click(function(event) {
event.preventDefault();
let a = $(this);
if (confirm('Seguro eliminar el diagrama NÂș ' + a.data('nro') + '?'))
$.post(a.attr('href'),
function(data) {
if (data.ok)
{
window.location.reload();
}
else
{
alert(data.msg);
}
});
});
$('#example').DataTable({
fixedHeader: true,
paging: true,
responsive: true,
order: [[ 0, 'desc' ]],
language: {
url: '{{ asset('i18n/spanish.json') }}'
}
});
</script>
{% endblock %}