{% extends 'base.html.twig' %}
{% block title %}Tickets{% endblock %}
{% block breadcrumb %}Tickets{% endblock %}
{% block body %}
<div class="card">
<!--begin::Card header-->
<div class="card-header border-0 pt-6">
<!--begin::Card title-->
<div class="card-title d-flex justify-content-between align-items-center w-100">
<h4 class="card-title">Tickets Abiertos</h4>
<div class="card-toolbar">
<!--begin::Search-->
<div class="d-flex align-items-center position-relative my-1">
<i class="ki-outline ki-magnifier fs-3 position-absolute ms-5"></i>
<input type="text" data-kt-customer-table-filter="search" class="form-control form-control-solid w-250px ps-12" placeholder="Buscar Ticket" />
</div>
<!--end::Search-->
</div>
</div>
</div>
<!--end::Card header-->
<!--begin::Card body-->
<div class="card-body pt-0">
<!--begin::Table-->
<table class="table align-middle table-row-dashed fs-6 gy-5" id="kt_customers_table">
<thead>
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
<th>Id</th>
<th>Cliente</th>
<th>Tipo</th>
<th>Prioridad</th>
<th>Asunto</th>
<th>User Email</th>
<th>User Telefono</th>
<th>Estado</th>
<th>Creacion</th>
<th>Atendido por</th>
<th>Última Actividad</th>
<th>Acciones</th>
</tr>
</thead>
<tbody class="fw-semibold text-gray-600">
{% for ticket in tickets %}
{% if ticket.flag_abierto == 1 %}
<tr>
<td>{{ticket.id_ticket_pk}}</td>
<td>{{ticket.desc_cliente}}</td>
<td>{{ticket.label_tipo_ticket}}</td>
<td>{{ticket.cod_prioridad_ticket}}</td>
<td>{{ticket.desc_asunto}}</td>
<td>{{ticket.user_email}}</td>
<td>{{ticket.user_telefono}}</td>
<td style="text-align: center; background-color: {{ticket.cod_color_fondo_hex}}; color: {{ticket.cod_color_fuente_hex}};">{{ ticket.label_estado_ticket}}</td>
<td>{{ticket.timestamp_creacion_ticket}}</td>
<td>{{ticket.desc_usuario_responsable}}</td>
<td>{{ticket.timestamp_ultima_actividad}}</td>
<td><a href="{{path('ticketsView', {'id': ticket.id_ticket_pk})}}" class="btn btn-sm btn-light btn-flex btn-center btn-active-light-primary" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">Ver
<i class="ki-outline ki-eye fs-5 ms-1"></i></a></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<!--end::Table-->
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
<br>
<div class="card">
<!--begin::Card header-->
<div class="card-header border-0 pt-6">
<!--begin::Card title-->
<div class="card-title d-flex justify-content-between align-items-center w-100">
<h4 class="card-title">Tickets Cerrados</h4>
<div class="card-toolbar">
<!--begin::Search-->
<div class="d-flex align-items-center position-relative my-1">
<i class="ki-outline ki-magnifier fs-3 position-absolute ms-5"></i>
<input type="text" data-kt-customer-table-filter2="search" class="form-control form-control-solid w-250px ps-12" placeholder="Buscar Ticket" />
</div>
<!--end::Search-->
</div>
</div>
</div>
<!--end::Card header-->
<!--begin::Card body-->
<div class="card-body pt-0">
<!--begin::Table-->
<table class="table align-middle table-row-dashed fs-6 gy-5" id="kt_customers_table_2">
<thead>
<tr class="text-start text-gray-400 fw-bold fs-7 text-uppercase gs-0">
<th>Id</th>
<th>Cliente</th>
<th>Tipo</th>
<th>Prioridad</th>
<th>Asunto</th>
<th>User Email</th>
<th>User Telefono</th>
<th>Estado</th>
<th>Creacion</th>
<th>Atendido por</th>
<th>Última Actividad</th>
<th>Acciones</th>
</tr>
</thead>
<tbody class="fw-semibold text-gray-600">
{% for ticket in tickets %}
{% if ticket.flag_cerrado == 1 %}
<tr>
<td>{{ticket.id_ticket_pk}}</td>
<td>{{ticket.desc_cliente}}</td>
<td>{{ticket.label_tipo_ticket}}</td>
<td>{{ticket.cod_prioridad_ticket}}</td>
<td>{{ticket.desc_asunto}}</td>
<td>{{ticket.user_email}}</td>
<td>{{ticket.user_telefono}}</td>
<td style="text-align: center; background-color: {{ticket.cod_color_fondo_hex}}; color: {{ticket.cod_color_fuente_hex}};">{{ ticket.label_estado_ticket}}</td>
<td>{{ticket.timestamp_creacion_ticket}}</td>
<td>{{ticket.desc_usuario_responsable}}</td>
<td>{{ticket.timestamp_ultima_actividad}}</td>
<td><a href="{{path('ticketsView', {'id': ticket.id_ticket_pk})}}" class="btn btn-sm btn-light btn-flex btn-center btn-active-light-primary" data-kt-menu-trigger="click" data-kt-menu-placement="bottom-end">Ver
<i class="ki-outline ki-eye fs-5 ms-1"></i></a></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
<!--end::Table-->
</div>
<!--end::Card body-->
</div>
<!--end::Card-->
<script>
$(document).ready(function() {
table1 = $("#kt_customers_table").DataTable();
table2 = $("#kt_customers_table_2").DataTable();
document.querySelector('[data-kt-customer-table-filter="search"]').addEventListener("keyup", function(e) {
table1.search(e.target.value).draw();
});
document.querySelector('[data-kt-customer-table-filter2="search"]').addEventListener("keyup", function(e) {
table2.search(e.target.value).draw();
});
});
</script>
{% endblock %}