<?php 
session_start();
if(isset($_SESSION['codigo'])) {$codigo=$_SESSION['codigo'];}
else {header("Location:" . "http://ponderzone.com");}

if(isset($_SESSION['id_delivery'])) $id_delivery = $_SESSION['id_delivery'];

require_once('../../Connections/odonto_connection1.php');

function eliminar_tildes($cadena){
    //Codificamos la cadena en formato utf8 en caso de que nos de errores
    $cadena = utf8_encode($cadena);
    //Ahora reemplazamos las letras
    $cadena = str_replace(
        array('á', 'à', 'ä', 'â', 'ª', 'Á', 'À', 'Â', 'Ä'),
        array('a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A'),
        $cadena
    );
    $cadena = str_replace(
        array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ê', 'Ë'),
        array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E'),
        $cadena );
    $cadena = str_replace(
        array('í', 'ì', 'ï', 'î', 'Í', 'Ì', 'Ï', 'Î'),
        array('i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'),
        $cadena );
    $cadena = str_replace(
        array('ó', 'ò', 'ö', 'ô', 'Ó', 'Ò', 'Ö', 'Ô'),
        array('o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'),
        $cadena );
    $cadena = str_replace(
        array('ú', 'ù', 'ü', 'û', 'Ú', 'Ù', 'Û', 'Ü'),
        array('u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'),
        $cadena );
    $cadena = str_replace(
        array('ñ', 'Ñ', 'ç', 'Ç'),
        array('n', 'N', 'c', 'C'),
        $cadena
    );

    return $cadena;
}

$query_rs_todos = "SELECT negocio,sucursal,id_delivery FROM mesas WHERE codigo LIKE '$codigo'";
$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
$row_rs_ingreso0 = mysqli_fetch_assoc($rs_ingreso0);

$negocio=$row_rs_ingreso0['negocio'];
$sucursal=$row_rs_ingreso0['sucursal'];
$id_delivery=$row_rs_ingreso0['id_delivery'];

$query_rs_todos7 = "SELECT id_ped FROM pedidos WHERE mesa LIKE '$codigo'";
$rs_ingreso7 = mysqli_query($odonto_connection,$query_rs_todos7) or die(mysqli_error());
$row_rs_ingreso7 = mysqli_fetch_assoc($rs_ingreso7);
$row_cnt7 = mysqli_num_rows($rs_ingreso7);

$q = "SELECT id_categ,categoria FROM categorias WHERE negocio LIKE '$negocio' ORDER BY orden ASC";
$rs_ingreso32 = mysqli_query($odonto_connection,$q) or die(mysqli_error());
$num_rows32 = mysqli_num_rows($rs_ingreso32);
$row_rs_ingreso32 = mysqli_fetch_assoc($rs_ingreso32);

$menu_por_categoria = array();
$num_i = array();
$nom_categ = array();

	if($num_rows32)
	{
		do{
			$categoria = $row_rs_ingreso32['id_categ'];
			$nom_categ[$categoria] = $row_rs_ingreso32['categoria'];
			
			if(!$id_delivery) $q = "SELECT id_pre,imagen,menu,observa,precio FROM precios WHERE negocio LIKE '$negocio' AND id_categ = $categoria AND publicar LIKE 'si'";
			else $q = "SELECT id_pre,imagen,menu,observa,precio FROM precios WHERE negocio LIKE '$negocio' AND id_categ = $categoria AND delivery LIKE 'si'";
			
			$rs_ingreso33 = mysqli_query($odonto_connection,$q) or die(mysqli_error());
			$row_rs_ingreso33 = mysqli_fetch_assoc($rs_ingreso33);
			
			do{
			
				$menu_por_categoria[$categoria]["id_pre"][] = $row_rs_ingreso33['id_pre']; 
				$menu_por_categoria[$categoria]["imagen"][] = $row_rs_ingreso33['imagen']; 
				$menu_por_categoria[$categoria]["menu"][] = $row_rs_ingreso33['menu']; 
				$menu_por_categoria[$categoria]["precio"][] = $row_rs_ingreso33['precio'];
				$menu_por_categoria[$categoria]["observa"][] = $row_rs_ingreso33['observa'];
				$num_i[$categoria] = $num_i[$categoria] + 1; 
				
			} while($row_rs_ingreso33 = mysqli_fetch_assoc($rs_ingreso33));	

		} while($row_rs_ingreso32 = mysqli_fetch_assoc($rs_ingreso32));
	}
	else{
		
		$bandera = "Todavia no hay cargada carta";
	}
/* BORRAR	
if(isset($_GET['id_pre'])){

	$id_pre = $_GET['id_pre'];
	$cantidad_elegida = $_GET['cantidad_elegida'];

	$query_rs_todos = "SELECT negocio,sucursal,precio FROM precios WHERE id_pre LIKE '$id_pre'";
	$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
	$row_rs_ingreso0 = mysqli_fetch_assoc($rs_ingreso0);

	$negocio=$row_rs_ingreso0['negocio'];
	$sucursal=$row_rs_ingreso0['sucursal'];
	$precio=$row_rs_ingreso0['precio'];

	$query_rs_todos9 = "SELECT cant FROM pedidos WHERE cod_pre LIKE '$id_pre' AND mesa LIKE '$codigo'";
	$rs_ingreso9 = mysqli_query($odonto_connection,$query_rs_todos9) or die(mysqli_error());
	$row_rs_ingreso9 = mysqli_fetch_assoc($rs_ingreso9);
	$row_cnt9 = mysqli_num_rows($rs_ingreso9);
	
	if($row_cnt9 == 0)
	{
		if(isset($precio) && isset($codigo))
		{
			$query_rs_todos1 = "INSERT INTO pedidos (id_ped,cod_pre,cant,negocio,sucursal,mesa) VALUES (NULL, '$id_pre', '$cantidad_elegida', '$negocio', '$sucursal', '$codigo');";
			$rs_ingreso = mysqli_query($odonto_connection,$query_rs_todos1) or die(mysqli_error());
			
		$q = "UPDATE mesas SET ocup = 1 WHERE codigo LIKE '$codigo'";
		$rs= mysqli_query($odonto_connection,$q) or die("Error en $q");	
		
		}
		else header("Location:" . "index_precios.php");
	}
	else
		{
		
			$cant = $row_rs_ingreso9['cant'] + $cantidad_elegida;
			$query_rs_todos55 = "UPDATE pedidos SET cant = \"$cant\",nuevo = \"0\" WHERE cod_pre=$id_pre";
			$rs_update = mysqli_query($odonto_connection,$query_rs_todos55) or die(mysql_error());
		}
		header("Location:" . "index_precios.php");
}
*/

if(isset($_POST['hacer'])){
	$mensaje = $_POST['aclaracion'];
	$suma_total = $_POST['suma'];
	if(!$id_delivery) header("Location:" . "index_pedido.php?mensaje=$mensaje");
	else header("Location:" . "index_pedido_externo.php?mensaje=$mensaje&suma=$suma_total");
}

if(isset($_POST['borrar'])){
	$codigo=$_SESSION['codigo'];
	
	$query_rs_todos = "DELETE FROM pedidos WHERE mesa = '$codigo' ";
	$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
		
		$q = "UPDATE mesas SET ocup = '0',descripcion = '' WHERE codigo LIKE '$codigo'";
		$rs= mysqli_query($odonto_connection,$q) or die("Error en $q");

	header("Location:" . "index_precios.php");
}

if(isset($_GET['borraritem'])){
	$item=$_GET['borraritem'];
	$query_rs_todos = "DELETE FROM pedidos WHERE cod_pre = $item";
	$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());

	header("Location:" . "index_precios.php");
}


?>  
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0" />

<title>PonderZone</title>

<?php 
require_once($_SERVER['DOCUMENT_ROOT'] .'/warn/bootstrap/bootstrap_js_gral.php');
require_once($_SERVER['DOCUMENT_ROOT'] .'/warn/bootstrap/bootstrap_css_gral.php');
?>

<link href='https://fonts.googleapis.com/css?family=Handlee' rel='stylesheet'>

<style>
<?php 
/////// colores e imagen de fondo customizada
$link_fondo = "fondos/".$negocio."/fondo_".$negocio.".png";
////// colores por default:
if(!file_exists($link_fondo)) $link_fondo = "fondos/fondo_index_precios.jpg";

/////// customizacion letras y fondos
switch($negocio){
	case "negocio_03": //casimiro
		$color_letra = "#040853";
		$background = "transparent";
		$background_titulo = "transparent";
		$color_titulo = "#1C9CBB";
		break;
	default:		
		$color_letra = "white";
		//$background = "#00000085";
		$background = "transparent";
		$background_titulo = "#0000000";
		$color_titulo = "#FFF";
}
////////////////
?>
body {
  text-align:left;
  //background:linear-gradient(180deg, #000 25%, #4AABBF 40%, #ddd 65%);
  background:black;
  color:#555;
  font-family:'Handlee';
  font-weight:bold;
  font-size:10px;
  padding-top:1vh;
  background-image:url("<?php echo $link_fondo;?>");
}

:root {
  --main-bg-negocio: url(fondos/fondo_index_precios.jpg);
  --main-bg-opacidad: 0.7;
  	background-size: cover;
	background-repeat: no-repeat;
	height: 100%;

}

.footer {
   position: fixed;
   left: 0;
   bottom: 0;
   width: 100%;
   color: white;
   text-align: left;
}
  
</style>


<script type="text/javascript">

$(document).ready(function(){
  $("#myInput").on("keyup", function() {
    var value = $(this).val().toLowerCase();
    $("#myTable tr").filter(function() {
      $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
    });
  });
});

function myFunction1(value) {
		var item = document.getElementById(value);
		var  child=document.createElement("div");
		child.id= value;
		child.innerHTML = "<div class='spinner-border' style='color:#fff'></div>";
		item.appendChild(child);
		window.open("./index0.php","_parent");
}

var clikeado = new Array();
var borrado = new Array();
var eligiendo = 0;

<?php 
		$q = "SELECT sin_carta_digital FROM datos WHERE negocio LIKE '$negocio'";
		$rs = mysqli_query($odonto_connection,$q) or die(mysqli_error());
		$row = mysqli_fetch_assoc($rs);
		$sin_carta_digital = $row['sin_carta_digital'];?>

function miFuncion(id_pre){
		    var sin_carta_digital = <?php echo $sin_carta_digital;?>;
			if(!sin_carta_digital){

				var count = 0;
				var id = setInterval(frame, 1000);
				function frame() {
				if (count == 0) {
					document.getElementById("Miok_anim").className = "far fa-thumbs-up";
					count++;
				}
				else {
					document.getElementById("Miok_anim").className = "fas fa-thumbs-up";
					count = 0;
				}
				}

			var popi_id_pre = 'popi_'+id_pre;
			var row_id_pre = 'row_'+id_pre;
			
			var item = document.getElementById(popi_id_pre);
			
			if(!eligiendo){
				
				document.getElementById(row_id_pre).style.backgroundColor = "grey";
				document.getElementById(row_id_pre).style.color = "white";
			
				var  child=document.createElement("div");
				child.id= popi_id_pre;
				//child.class="alert alert-success";
				
				child.innerHTML= "<div style='position:relative;left:0px;top:0px;color:#fff;width:300px;height:250px;padding:1rem;border-radius: 11px 11px 11px 11px;border: 1px solid #fff;background-color:#000;text-align:left;box-shadow: 0px 28px 79px 3px rgba(0,0,0,0.75);' id='modal_"+id_pre+"' ><div class='row'><div class='col'>Cantidad?<div id='div_"+id_pre+"'></div></div><div class='col'>Precio unitario<div id='calculo_precio_"+id_pre+"'></div></div></div><div class='row'><hr></div><div class='row'><div class='col-6'><button type='button' style=width:90px;background-color:grey;border-color:#fff;color:#000' class='btn btn-primary' onclick='miOkey("+id_pre+")'>Ok <i id='Miok_anim'></i></button></div><div class='col-6'><button type='button' style='width:90px;background-color:black;border-color:#fff' class='btn btn-info' onclick='miCancelar("+id_pre+")'>Cancel</button></div></div></div>"
				item.appendChild(child);
				
				var div_id_pre = 'div_'+id_pre;
				item_div = document.getElementById(div_id_pre);
				
				var x = document.createElement("SELECT");
				var mySelect_id_pre = "mySelect_"+id_pre;
				x.setAttribute("id", mySelect_id_pre);
				x.setAttribute("name", mySelect_id_pre);
				item_div.appendChild(x);

				var calculo_precio = "calculo_precio_"+id_pre;
				item_calculo_precio = document.getElementById(calculo_precio);
				var campo_precio = "precio_"+id_pre;
				var item_precio = document.getElementById(campo_precio).value;
				var y_precio = document.createElement("DIV");
				y_precio.innerHTML = "$"+item_precio;
				item_calculo_precio.appendChild(y_precio);

				var i;
				var z = new Array();
				var t = new Array();
				
				for (i = 1; i < 37; i++) {
					z[i] = document.createElement("option");
					z[i].setAttribute("value", i);
					t[i] = document.createTextNode(i);
					z[i].appendChild(t[i]);
					document.getElementById(mySelect_id_pre).appendChild(z[i]);
				}
				
				eligiendo = popi_id_pre;
				
				return;
			}
			else {
				if(eligiendo != popi_id_pre) document.location = '#'+eligiendo;
				}
}
}

function miFuncionSpinner(value) {
		var item = document.getElementById(value);
		var  child=document.createElement("div");
		child.id= value;
		child.innerHTML = "<div class='spinner-border' style='color:#fff'></div>";
		item.appendChild(child);
		
}


function miOkey(id_pre){
		var modal_id_pre = 'modal_'+id_pre;
		var mySelect_id_pre = 'mySelect_'+id_pre;
		var cantidad_elegida = document.getElementById(mySelect_id_pre).value;
		var codigo_pasar = '<?php echo $codigo;?>';
		document.getElementById(modal_id_pre).style.backgroundColor = "grey";
		var item = document.getElementById(modal_id_pre);
		var  child=document.createElement("div");
		child.id= modal_id_pre;
		child.innerHTML = "<div class='spinner-border' style='position:relative;top:-5rem;left:50%;color:white;font-size:1rem'></div>";
		item.appendChild(child);
		$.post("getuser_limpia.php",{id_pre:id_pre,cantidad_elegida:cantidad_elegida,codigo_pasar:codigo_pasar});
		//window.open("./index_precios.php?id_pre="+id_pre+"&cantidad_elegida="+cantidad_elegida,"_parent");
		return;
}

function miCancelar(id_pre){
		var popi_id_pre = 'popi_'+id_pre;
		document.getElementById(popi_id_pre).style.backgroundColor = "black";
		var modal_id_pre = 'modal_'+id_pre;
		document.getElementById(modal_id_pre).style.backgroundColor = "grey";
		
		var item = document.getElementById(modal_id_pre);
		var  child=document.createElement("div");
		child.id= modal_id_pre;
		child.innerHTML = "<div class='spinner-border' style='position:relative;top:-5rem;left:50%;color:white;font-size:1rem'></div>";
		item.appendChild(child);
			//var item_borrar=document.getElementById(popi_id_pre);
			//item_borrar.parentNode.removeChild(item_borrar);
		window.open("./index_precios.php","_parent");
		return;
}


function AnimaMaxi(){
	var count = 0;
	var id = setInterval(frame, 1000);
		var Arma_anim = document.getElementById("Arma_anim");
	function frame() {
		if (count == 0) {
		  	if(Arma_anim) document.getElementById("Arma_anim").className = "far fa-arrow-alt-circle-down";
		  	count++;
			} else {
			if(Arma_anim) document.getElementById("Arma_anim").className = "fas fa-arrow-alt-circle-down";
			count = 0;
		}
  }
}

function showUser(str) {
			<?php 
			require_once('../../Connections/odonto_connection1.php'); 
			$query_rs_todos = "SELECT cant,recibido FROM pedidos WHERE negocio like '$negocio' AND mesa like '$codigo'";
			$rs_ingreso = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
			$row_rs_ingreso = mysqli_fetch_assoc($rs_ingreso);
			$count = 0;
			$recib = 0;
			do{
			$count = $count + $row_rs_ingreso['cant'];
			$recib = $recib + $row_rs_ingreso['recibido'];
			}
			while($row_rs_ingreso= mysqli_fetch_assoc($rs_ingreso));

			?>	
			var negocio = "<?php echo $negocio;?>";
			var orig = "<?php echo $count;?>";
			var codigo = "<?php echo $codigo;?>";
			var recib = "<?php echo $recib;?>";

			if (str == "") {
			document.getElementById("txtHint").innerHTML = "";
			return;
			} else { 
			if (window.XMLHttpRequest) {
			// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp = new XMLHttpRequest();
			} else {
			// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			xmlhttp.onreadystatechange = function() {
			if (this.readyState == 4 && this.status == 200) {
				document.getElementById("txtHint").innerHTML = this.responseText;
				var vemos = this.responseText;
				if(vemos.indexOf("x") == '2'){myFunction('dos');}
				if(vemos.indexOf("x") == '3'){myFunction('tres');}
			}
			};
			//xmlhttp.open("GET","getuser.php?q="+str,true);
			xmlhttp.open("GET","./getuser_precios.php?q="+negocio+"&r="+orig+"&codigo="+codigo+"&recib="+recib,true);
			xmlhttp.send();

			}
}

function myFunction(data) {//alert(vemos);
  var ver = data;
  if(ver == 'dos') window.open("index_precios.php" , '_parent');
  if(ver == 'tres') window.open("index_pedido_recib.php" , '_parent');
}


 </script>

</head>
<body onload="setInterval('showUser()',2000);AnimaMaxi()" >
<div class="container-fluid">
<div class='row'>
	<div class='col'>
		<br>
	</div>
</div>
	<div class="row text-left" style="color:white;font-size:0.9rem" id="precio">
		<div class="col">

			<?php
			$q = $negocio;
			$r = $codigo;
			$s = $sucursal;

			$sql="SELECT * FROM pedidos WHERE negocio = '".$q."' AND mesa = '".$r."' AND sucursal = '".$s."' ORDER BY id_ped ASC";
			$result0 = mysqli_query($odonto_connection,$sql);
			$row_rs_ingreso0 = mysqli_fetch_assoc($result0);
			$row_cnt = mysqli_num_rows($result0);
			//$row_cnt = $row_cnt + 10;

			if($row_cnt >= 1){
				echo "<div class='row text-center'>";
				echo "<div class='col-12'>";
					echo "<button type=\"button\" class=\"btn btn-danger degrade btn-lg btn-circle\" style='background-color:#000;color:white;border-color:white' name=\"volver\" onclick=\"myFunction1('volver')\"><b><i class='fas fa-chevron-left'></i><i class='fas fa-chevron-left'></i> Volver</b></button><div id=\"volver\"></div>";
				echo "</div>";
				echo "</div><br>";
				$suma=0;
				echo "<font style='font-size:1.3rem;color:white;background-color:black'><u><b>Tu Pedido:</b></u></font>";
				echo "<br><table class='table' style='background-color:black;opacity:0.99'><b><font style='color:white' >";
				do{
					$id_pre=$row_rs_ingreso0['cod_pre'];
					$cant=$row_rs_ingreso0['cant'];

					$sql="SELECT * FROM precios WHERE id_pre = '".$id_pre."'";
					$result = mysqli_query($odonto_connection,$sql);
					$row_rs_ingreso = mysqli_fetch_assoc($result);

					$subtotal = $cant * $row_rs_ingreso['precio'];
					$suma = $subtotal + $suma;
					echo "<tr><td style='font-size:1.1rem;color:white'>".$cant." - ".eliminar_tildes($row_rs_ingreso['menu']);
					if($row_rs_ingreso['observa'] != 'nota' && $row_rs_ingreso['observa']) echo " (".$row_rs_ingreso['observa'].")";

					echo "<td style='font-size:0.9rem;width:auto;color:white'>$".$subtotal;
						echo "<a href='index_precios.php?borraritem=$id_pre' style='color:white'>&nbsp;&nbsp;&nbsp;<i class='fas fa-trash'></i></a>";
						echo "</td></tr>";
					
					}while($row_rs_ingreso0= mysqli_fetch_assoc($result0));
					
					echo "</font></b>";
					echo "</div>";
					
					echo  "<tr><td style='text-align:right;color:white'>Total:</td><td style='color:white'>$ ".$suma."</td></tr>";
					
					$q = "SELECT propina FROM datos WHERE negocio LIKE '$negocio' LIMIT 1";
					$rs= mysqli_query($odonto_connection,$q) or die("Error en $q");
					$row = mysqli_fetch_assoc($rs);
					$propina=$row['propina'];
					if($propina != '1' && !$id_delivery){
						$propina = $suma * 0.08;
						echo  "<tr><td style='text-align:right;color:white'>Propina estipulada:</td><td style='color:white'>$ ".$propina."</td></tr>";
					}

					$q = "SELECT costo_envio FROM datos WHERE negocio LIKE '$negocio' LIMIT 1";
					$rs= mysqli_query($odonto_connection,$q) or die("Error en $q");
					$row = mysqli_fetch_assoc($rs);
					$costo_envio=$row['costo_envio'];
					if($costo_envio && $id_delivery){
						echo  "<tr><td style='text-align:right;color:white'>Costo Envio:</td><td style='color:white'>$ ".$costo_envio."</td></tr>";
					}

				echo "</table>";
		}
			
		mysqli_close($odonto_connection);	
			
			?>

		</div>
	</div>

		<form action="index_precios.php" method="post">
			<?php if($row_cnt7 != 0)
			{
				echo "<div class=\"form-group\">";
	
	echo "<div class='row'>";
			echo "<div class='col'>";
				if(isset($_GET['mensaje'])) $mensaje = $_GET['mensaje']; 
				echo "<input type=\"form-group\" maxlength=\"200\" class=\"form-control\" id=\"aclaracion\" placeholder=\"Alguna Aclaración?\" name=\"aclaracion\" value=\"$mensaje\" style=\"border-radius:18px;font-size:22px\">";
			echo "</div>";
	echo "</div>";
	echo "<br>";
	echo "<div class='row text-center'>";
			echo "<div class='col-6'>";
				echo "<button type=\"submit\" class=\"btn btn-light text-white degrade4 btn-lg btn-circle\" name=\"hacer\" onclick=\"miFuncionSpinner('hacer')\"><b><i class='far fa-thumbs-up'></i> Marchar Pedido <span class=\"oi oi-check\"></span></b></button><div id=\"hacer\"></div>";
			echo "</div>";		
			echo "<div class='col-6'>";
				echo "<button type=\"submit\" class=\"btn btn-warning text-white degrade2 btn-lg btn-circle\" style=\"color:white;background-color:gray;border-color:#fff\" name=\"borrar\" onclick=\"miFuncionSpinner('borrar')\"><b><i class='fas fa-sync-alt'></i> Reiniciar Pedido</b></button><div id=\"borrar\"></div>";
			echo "</div>";
			echo "<input value='$suma' id='suma' name='suma' style='visibility:hidden'></input>";	
	echo "</div>";			
	echo "<br>";	
		}
			else {
				echo "<div class='container text-center'>";
					echo "<div class='row'>";
						echo "<div class='col'>";
							if(!$bandera) $armatupedido = "Arma tu Pedido <i id='Arma_anim'></i>";
							else $armatupedido = $bandera;
							echo "<font style='font-size:1.6rem;text-align:right;color:white;background-color:black'>".$armatupedido."</font>";
						echo "</div>";
					echo "</div>";
					echo "<div class='row'>";
						echo "<div class='col'>";
							echo "<button type=\"button\" class=\"btn btn-danger degrade text-white btn-lg btn-circle\" style='background-color:#000;color:white;border-color:white' name=\"volver\" id=\"volver1\" onclick=\"myFunction1('volver1')\"><b><i class='fas fa-chevron-left'></i><i class='fas fa-chevron-left'></i> Volver</b></button><br>";
						echo "</div>";
					echo "</div>";
				echo "</div>";
			}	?>	
		</form>
		</div>
	
<?php 
		
echo "<div class='container'>";
	echo "<br>";
	echo "<div class='row fixed-bottom'>";	
		echo "<div class='col'>";	
			echo '<br><input class="form-control" id="myInput" maxlength"120" type="text" placeholder="Buscar en el menu..." name="myInput" style="border-radius:18px;font-size:22px">';
		echo "</div>";
	echo "</div>";


	echo "<div class='row'>";
		echo "<table id='myTable' class='table align-items-center' style='border-color:black'>";
		
	echo "<tbody>";
		
			foreach($menu_por_categoria as $id_categoria => $value_array){
				for($i = 0; $i < $num_i[$id_categoria]; $i++){ //$num_rows32 es el numero de categorias
					$id_pre = $value_array[id_pre][$i];
					$imagen = $value_array[imagen][$i];
					$menu = $value_array[menu][$i];
					$observa = $value_array[observa][$i];
					$precio = $value_array[precio][$i];
					if($id_pre){
						if($i == 0){
							echo "<tr onclick='miFuncion(".$id_pre.")' id='row_".$id_pre."' style='font-size:1.7rem;text-align:center' >";
								echo "<td>";
								echo "<font style='color:$color_titulo;background-color:$background_titulo'>".$nom_categ[$id_categoria]."</font>";
								echo "</td>";
							echo "</tr>";
						}
						echo "<tr onclick='miFuncion(".$id_pre.")' id='row_".$id_pre."' style='background-color:$background;color:$color_letra;font-size:1.1rem' >";
							echo "<td>";
								if($imagen) echo "<img src='../../../imagenes_productos/".$negocio."/".$imagen."' class='mr-3 mt-3 align-self-center' width='65px' height='70px'>";
								$menu = eliminar_tildes($menu);								
								echo "<b>".$menu."</b>";
								if($observa) echo " (".$observa.")";
								echo "<div id='popi_".$id_pre."'></div>		
							</td>
							<td style='width:3rem'>";
							if($precio){
								echo "$<input id='precio_".$id_pre."' value=".$precio." style='display:none'>".$precio."</input>";
								}
								else echo "---"; 
							echo "</td>
						</tr>
					";
					}
				}
			}


echo "</tbody>";
echo "</table>";
echo "</div>";

?>
</div>

<p  id="txtHint" style="position;absolute;width:200px;height:5px;visibility:shown"></p>
	
</div>	
</body>
</html>