
<script src="<?php echo base_url();?>/assets/js/jquery.dataTables.js" type="text/javascript"></script>
    
<script>

$(document).ready( function () {
    $('#tabla_principal').DataTable({
      searching: true,
      paging: false,
      language : {
		  "pagingType": "full_numbers",
                  "info"            : "Viendo _START_ al _END_ de _TOTAL_ Registros",
                  "emptyTable"      : "No existen datos disponibles en esta tabla",
                  "infoEmpty"       : "Mostrando 0 de 0 de 0 Registros",
                  "infoFiltered"    : "(filtrado de un total de _MAX_ Registros)",
                  "infoPostFix"     : "",
                  "thousands"       : ",",
                  "lengthMenu"      : "Mostrando _MENU_ Registros",
                  "loadingRecords"  : "Cargando...",
                  "processing"      : "Procesando...",
                  "search"          : "Buscar:",
                  "zeroRecords"     : "No se Encontraron Registros",
                  "paginate"        : {
                                       "first"     : "Primero",
                                       "last"      : "Ultimo",
                                       "next"      : "Siguiente",
                                       "previous"  : "Previo"
                                      }   
               }
    });
} );

</script>

<div class="panel panel-success">
   <div class="panel-heading">
      <h3 class="panel-title">Informes Solicitados</h3>
   </div>
   <div class="panel-body">

      <table id="tabla_principal" class="table table-hover">
	    <thead>
	      <tr>
		<th>ID</th>
		<th>FECHA</th>
		<th>RUT</th>
		<th>NOMBRES</th>
		<th>APELLIDO PATERNO</th>
		<th>APELLIDO MATERNO</th>
	      </tr>
	    </thead>
	    <tbody><?php
	       foreach($listado_examenes as $fila){?>
		  <tr id='<?php echo $fila->id; ?>'  onmouseover="$(this).css('cursor','pointer')" onmouseout="$(this).css('cursor','default')" >
		     <th scope='row'><?php echo $fila->id;?></th>
		     <td><?php echo $fila->fecha;?></td>
		     <td><?php echo $fila->rut."-".$fila->dv;?></td>
		     <td><?php echo $fila->nombres; ?></td>
		     <td><?php echo $fila->ap_paterno; ?></td>
		     <td><?php echo $fila->ap_materno; ?></td>
		  </tr><?php
		}?>
	    </tbody>  
      </table>
   </div>
</div>
<script>
    $(document).ready(function(){
        $('#tabla_principal').on('click', 'tr', function () {
            var id=$(this).attr('id');
            var parametros={"id":id};
            $.ajax({
                data:  parametros,
                url:   '<?php echo base_url();?>index.php/inicio/editar_informe',
                type:  'post',
                async:false,
                success:  function (response) {                
                    $('.modal-content').html(response); 
                    $('#ventana_modal').modal('show');
                }
           });            
        });
	

    });
</script>