 <?php
 include_once '../php/config.php';
 $sql = mysql_query("select * from mesas") or die(mysql_error());
$sql2 = mysql_query("select * from empresa") or die(mysql_error());
 mysql_query("update mesas set estado='Disponible' where estado=''") or die(mysql_error());

		 while($r = mysql_fetch_array($sql)){
			  $mesa = $r['nombre'];
			  $tr = "<button id=".$mesa." onClick='modal_credencial_mesa(), cur_mesa(this.id), get_mesa(this.id)' class='btn-secundary ".estado($r['estado'])." mt-2 ml-2 mb-2'>";
			  ///$tr .= "<div class='card-body'>";
			  ///$tr .= "<div class='card-text h2 text-light'>";
			  $tr .= "<center><div class='mesa'><i class='fas fa-cocktail'></i><br><b>".$r['nombre']."</b></div></center>";
			  $tr .= "<span  style='color:white; font-size=10px;'>".$r['ticket']."</span><hr></button>";
			  //$tr .= "</div>";
			  ///$tr .= "<div class='card-footer'></div>";
			  //$tr .= "</a>";
			  
			   echo $tr;
		 }
		mysql_close($con);


		function estado($e){
	if($e=="Ocupada"){
		return "btn-danger";
	}
	
		if($e=="Disponible"){
		return "btn-success";
	}
}
		 ?>