<?php include('meta.php') ?>
<?php $bg_header = "bg_sala"; include('header.php') ?>
	<div id="box_body"><!-- body center -->
<script type="text/javascript">
	$(document).ready(function() {
    $('#allpatient').DataTable( {
        "language": {
        	"search": "Buscar:",
        	"lengthMenu":    "Mostrar _MENU_  productos en la tabla",
            "info":           "Mostrando de [ _START_ -  _END_ ] de un total de  _TOTAL_ registros",
            "infoEmpty":      "No hay elementos en la tabla",       
            "infoPostFix":    "",
            "infoFiltered": "(filtered from _MAX_ total records)",
            "loadingRecords": "Cargando registros...",
            "zeroRecords":    "No hay elementos en la tabla",
            "emptyTable":     "No hay elementos en la tabla",
            "paginate": {
            			"first":      "Primero",
            			"previous":   "Anterior",
            			"next":       "Siguiente",
            			"last":       "&Uacuteltimo"
            			},
        }
	} );
} );
</script>
	<?php

		$result = mysqli_query($con,'SELECT id, name, title, start FROM se_evenement GROUP BY name ORDER BY name');  
				echo "<table id='allpatient' class='display'> \n"; 
				echo "
				<thead>
					<tr>
					<th>Nombre</th>
					<th>Cedula</th>
					<th style='width:380px'>Fecha </th>
					</tr>
					</thead>
					<tbody>	\n"; 
					while ($row = mysqli_fetch_row($result))	{ 
						echo "<tr> 
								<td><strong>$row[1]</strong></td>
						      	<td>$row[2] </td>
						      	<td>";
						      	$num = 1;
						$result_date = mysqli_query($con,'SELECT id,name, start, status FROM se_evenement WHERE name = "'.$row[1].'"');  
						while ($row_date = mysqli_fetch_assoc($result_date)){
							echo "<strong>N°".$num."</strong> / ".$row_date['start']." <strong>Estado:</strong> ".$row_date['status']."&nbsp;&nbsp;&nbsp; <a href='view_event.php?id=".$row_date['id']."'>Detalles</a> <br>";		
							$num++;
						}								
						echo  "</td>
						      	
						      </tr>";
					};
					echo " \n"; 
					echo " </tbody></table> \n"; 
				?> 


	</div><!-- END body center -->
<?php include('../footer.php') ?>
