<?php
require_once ("../../config/Cado.php");
require_once ("cMesa.php");
?>
<script type="text/javascript">
  $(function() {	
   $('.btn_editar').button({
    icons: {primary: "ui-icon-pencil"},
    text: false
  });

   $('.btn_eliminar').button({
    icons: {primary: "ui-icon-trash"},
    text: false
  });

   $.tablesorter.defaults.widgets = ['zebra'];
   $("#tabla_mesa").tablesorter({ 
    headers: {
     1: {sorter: false }, 
     2: { sorter: false}},
		//sortForce: [[0,0]],
		sortList: [[0,0]]
  });
 }); 
</script>
<table cellspacing="1" id="tabla_mesa" class="tablesorter">
  <thead>
    <tr>
      <th>MESA</th>
      <th>SALÓN</th>   
      <th>ID</th>
      <th>&nbsp;</th>
    </tr>
  </thead>      
  <tbody>
   <?php

   $salon_id = $_POST['cmb_fil_salon_id'];
   $oMesa = cMesa::soloSalon($salon_id);
   
   $datos = $oMesa->filtrar();
   $num_rows = $datos ->num_rows;
   while ($fila = mysql_fetch_array($datos)) { ?>
   <tr>
    <td><?php echo $fila['tb_mesa_nom']?></td>   
    <td><?php echo $fila['tb_salon_nom']?></td>
    <td><?php echo $fila['tb_mesa_id']?></td>
    <td align="center">
      <a class="btn_editar"  onClick="mesa_form('editar','<?php echo $fila['tb_mesa_id']?>')">Editar</a> 
      <a class="btn_eliminar"  onClick="eliminar_mesa('<?php echo $fila['tb_mesa_id']?>')">Eliminar</a>
    </td>
  </tr>
  <?php }
    mysqli_free_result($datos);
  ?>


</tbody>     
<tr class="even">
  <td colspan="5"><?php echo $num_rows.' registros'?></td>
</tr>
</table>