<?php	require_once('../preheader1.php'); // <-- this include file MUST go first before any HTML/output
$user=$_SESSION['MM_Username'];
if(!isset($user)) header("Location:" . "../../index.php?deslogeo");
require_once('../../Connections/odonto_connection1.php'); 

$query_rs_todos = "SELECT negocio,categ FROM ingreso WHERE user LIKE '$user'";
$rs_ingreso0 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
$row_rs_ingreso0 = mysqli_fetch_assoc($rs_ingreso0);
$categ=$row_rs_ingreso0[categ];
$negocio=$row_rs_ingreso0[negocio];

if(isset($_GET[id_avi])){$id_avi=$_GET[id_avi];
$query_rs_todos = "UPDATE avisos SET avisado = 1 WHERE id_avi = $id_avi";
$rs_ingreso2 = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
}

$q = "SELECT color_titulo,color_letra,color_observa FROM datos WHERE negocio LIKE '$negocio'";
$rs = mysqli_query($odonto_connection,$q) or die(mysqli_error());
$row = mysqli_fetch_assoc($rs);
$color_titulo = $row[color_titulo];
$color_letra = $row[color_letra];
$color_observa = $row[color_observa];


if($_POST[colores_submit]) {
	
	$color_titulo = $_POST[color_titulo];
	$q = "UPDATE datos SET color_titulo = '$color_titulo' WHERE negocio = '$negocio' ";
	$rs = mysqli_query($odonto_connection,$q) or die(mysqli_error());
	$color_letra = $_POST[color_letra];
	$q = "UPDATE datos SET color_letra = '$color_letra' WHERE negocio = '$negocio' ";
	$rs = mysqli_query($odonto_connection,$q) or die(mysqli_error());
	$color_observa = $_POST[color_observa];
	$q = "UPDATE datos SET color_observa = '$color_observa' WHERE negocio = '$negocio' ";
	$rs = mysqli_query($odonto_connection,$q) or die(mysqli_error());

}
?>
<!DOCTYPE HTML>
<html>
<head>
<!--<meta http-equiv="refresh" content="7" charset="UTF-8"> -->
<meta charset="UTF-8">
<title>PonderZone</title>
<link rel="icon" href="../../pondercode.jpg">

	<link rel="stylesheet" href="../../alertify/themes/alertify.core.css" />
	<link rel="stylesheet" href="../../alertify/themes/alertify.default.css" id="toggleCSS" />

<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0" />

<?php require_once('../../inc/bootstrap.php');?>
	
</head>
<body style="background-color:#0D1749"/>
 
 <?php	 require_once('menu.php');?>
  <br>
  <?php	 require_once('botones.php');?>
  
  <div class="container-fluid text-center">
		<div class="row">
			<div class="col text-white">
				<h3>Configuración Colores WebApp</h3>
			</div>
		</div>
		<div class="row">
			<div class="col">
				<h5>Se recomienda hacer los cambios e ir verificándolos con un Celular</h5>				
			<form action="colores.php" method="post">
				<label for="color_titulo">Color de Titulos:</label>
				<input type="color" id="color_titulo" name="color_titulo" value="<?php echo $color_titulo; ?>"><br>
				<label for="color_letra">Color de letra Productos:</label>
				<input type="color" id="color_letra" name="color_letra" value="<?php echo $color_letra; ?>"><br>
				<label for="color_observa">Color de letra Observaciones:</label>
				<input type="color" id="color_observa" name="color_observa" value="<?php echo $color_observa; ?>"><br>
				<hr>
				<input type="submit" class="btn btn-info" id="colores_submit" name="colores_submit" value="Cambiar">
			</form>
			</div>
		</div>
	</div>



<style>
.text {
  font-size:18px;
  font-family:helvetica;
  font-weight:bold;
  color:#71d90b;
  text-transform:uppercase;
}

</style>

</body>
</html>


<script type="text/javascript">

function showUser(str) {
<?php 
require_once('../../Connections/odonto_connection1.php'); 

$query_rs_todos = "SELECT id_avi FROM `avisos` WHERE `negocio` like '$negocio'";
$rs_ingreso = mysqli_query($odonto_connection,$query_rs_todos) or die(mysqli_error());
$row_rs_ingreso = mysqli_fetch_assoc($rs_ingreso);
$row_cnt_orig = mysqli_num_rows($rs_ingreso);

?>	
	var negocio = "<?php echo $negocio;?>";
	var orig = "<?php echo $row_cnt_orig;?>";

	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("aqui") > -1){startFlashTitle('nuevo PEDIDO');}
		}
        };
        //xmlhttp.open("GET","getuser.php?q="+str,true);
        xmlhttp.open("GET","./getuser.php?q="+negocio+"&r="+orig,true);
        xmlhttp.send();

		
    }
}

 </script>
 