verturnos.php
11.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<?php
session_start();
require './database.php';
if (isset($_SESSION['user_id'])) {
$records = $conn->prepare('SELECT id, email, password FROM users WHERE id = :id');
$records->bindParam(':id', $_SESSION['user_id']);
$records->execute();
$results = $records->fetch(PDO::FETCH_ASSOC);
$user = null;
if (count($results) > 0) {
$user = $results;
}
}
if (isset($_POST['fecha'])){
$fecha = date("Y-m-d", strtotime($_POST['fecha']));
}
$turnos = $conn->prepare("SELECT * FROM turnosv_turnos t, tipo_solicitantes s WHERE t.id_solicitante=s.id_solicitante AND t.fecha='".$fecha."' ORDER BY t.hora ASC");
$turnos->execute();
$turnosconfirm = $conn->prepare("SELECT * FROM turnosv_turnos t, tipo_solicitantes s WHERE t.id_solicitante=s.id_solicitante AND verificado IS NOT NULL AND t.fecha='".$fecha."' ORDER BY t.hora ASC");
$turnosconfirm->execute();
$turnosnoconfirm = $conn->prepare("SELECT * FROM turnosv_turnos t, tipo_solicitantes s WHERE t.id_solicitante=s.id_solicitante AND verificado IS NULL AND t.fecha='".$fecha."' ORDER BY t.hora ASC");
$turnosnoconfirm->execute();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Listado de turnos - <?php echo date("d/m/Y", strtotime($_POST['fecha']));?></title>
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.21/b-1.6.2/b-html5-1.6.2/b-print-1.6.2/datatables.min.css"/>
<link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
<?php if(!empty($user)): ?>
<nav class="navbar navbar-light" style="background-image: url('img/fondoheader.png'); background-repeat: no-repeat; background-position: center; background-size: cover;">
<div class="navbar-brand mx-auto" >
<img src="img/logo.png" width="350px" height="75%">
</div>
</nav>
<br>
<div class="container">
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-12 col-xs-12">
<h5><b>LISTADO DE TURNOS - <?php echo date("d/m/Y", strtotime($_POST['fecha']));?></b> <h4>Turnos confirmados: <span class="badge badge-info"><?php echo $turnosconfirm->rowCount(); ?></span> Turnos no confirmados: <span class="badge badge-info"><?php echo $turnosnoconfirm->rowCount(); ?></span></h4></h5>
</div>
<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12 text-right">
<a href="logout.php" class="btn btn-sm btn-warning"><b>Cerrar Sesión</b></a>
</div>
</div>
<hr style="border-style: solid; border-width: 1px;">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<nav>
<div class="nav nav-tabs nav-fill" id="nav-tab" role="tablist">
<a class="nav-item nav-link active" id="nav-home-tab" data-toggle="tab" href="#nav-home" role="tab" aria-controls="nav-home" aria-selected="true">Todos los turnos</a>
<a class="nav-item nav-link" id="nav-profile-tab" data-toggle="tab" href="#nav-profile" role="tab" aria-controls="nav-profile" aria-selected="false">Turnos Confirmados</a>
</div>
</nav>
<!-- Todos los turnos -->
<div class="tab-content" id="nav-tabContent">
<div class="tab-pane fade show active" id="nav-home" role="tabpanel" aria-labelledby="nav-home-tab">
<br>
<div class="table-responsive">
<table class="display tabladt" style="width:100%">
<thead>
<tr>
<th>HORARIO</th>
<th>DNI</th>
<th>NOMBRE Y APELLIDO</th>
<th>TIPO SOLICITANTE</th>
<th>TELEFONO</th>
<th>E-MAIL</th>
<th>CONFIRMADO</th>
</tr>
</thead>
<tbody>
<?php
while($row = $turnos->fetch(PDO::FETCH_ASSOC)) {
if (!empty($row['verificado'])){
$verificado = "SI";
} else {
$verificado = "NO";
}
echo "<tr><td>".substr($row['hora'],0,5)."</td><td>".$row["dni"]."</td><td>".$row["nombre_apellido"]."</td><td>".$row["descripcion"]."</td><td>".$row["telefono"]."</td><td>".$row["email"]."</td><td>".$verificado."</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<!-- Fin todos los turnos -->
<!-- Solo turnos confirmados -->
<div class="tab-pane fade" id="nav-profile" role="tabpanel" aria-labelledby="nav-profile-tab">
<br>
<div class="table-responsive">
<table class="display tabladt" style="width:100%">
<thead>
<tr>
<th>HORARIO</th>
<th>DNI</th>
<th>NOMBRE Y APELLIDO</th>
<th>TIPO SOLICITANTE</th>
<th>TELEFONO</th>
<th>E-MAIL</th>
<th>CONFIRMADO</th>
</tr>
</thead>
<tbody>
<?php
while($row = $turnosconfirm->fetch(PDO::FETCH_ASSOC)) {
if (!empty($row['verificado'])){
$verificado = "SI";
} else {
$verificado = "NO";
}
echo "<tr><td>".substr($row['hora'],0,5)."</td><td>".$row["dni"]."</td><td>".$row["nombre_apellido"]."</td><td>".$row["descripcion"]."</td><td>".$row["telefono"]."</td><td>".$row["email"]."</td><td>".$verificado."</td></tr>";
}
?>
</tbody>
</table>
</div>
</div>
<!-- FIN Solo turnos confirmados -->
</div>
<br>
</div>
</div>
</div>
<?php else:
header('Location: login.php');
endif; ?>
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/jszip-2.5.0/dt-1.10.21/b-1.6.2/b-html5-1.6.2/b-print-1.6.2/datatables.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.tabladt').DataTable( {
columnDefs: [ { orderable: false, targets: [0,1,2,3,4,5] }],
language: {
"sProcessing": "Procesando...",
"sLengthMenu": "Mostrar _MENU_ registros",
"sZeroRecords": "No se encontraron resultados",
"sEmptyTable": "Ningún dato disponible en esta tabla",
"sInfo": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
"sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
"sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
"sInfoPostFix": "",
"sSearch": "Buscar:",
"sUrl": "",
"sInfoThousands": ",",
"sLoadingRecords": "Cargando...",
"oPaginate": {
"sFirst": "Primero",
"sLast": "Último",
"sNext": "Siguiente",
"sPrevious": "Anterior"
},
"oAria": {
"sSortAscending": ": Activar para ordenar la columna de manera ascendente",
"sSortDescending": ": Activar para ordenar la columna de manera descendente"
},
"buttons": {
"copy": "Copiar",
"colvis": "Visibilidad",
"print": "Imprimir"
}
},
dom: 'Bfrtip',
buttons: [
'excelHtml5',
{
extend: 'print',
customize: function(win)
{
var last = null;
var current = null;
var bod = [];
var css = '@page { size: landscape; }',
head = win.document.head || win.document.getElementsByTagName('head')[0],
style = win.document.createElement('style');
style.type = 'text/css';
style.media = 'print';
if (style.styleSheet)
{
style.styleSheet.cssText = css;
}
else
{
style.appendChild(win.document.createTextNode(css));
}
head.appendChild(style);
},
messageTop: 'Turnos confirmados: <?php echo $turnosconfirm->rowCount(); ?> - Turnos no confirmados: <?php echo $turnosnoconfirm->rowCount(); ?>'
}
// 'excelHtml5',
// 'pdfHtml5',
// 'print'
]
} );
} );
</script>
</body>
</html>