<?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,sucursal 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'];
$sucursal=$row_rs_ingreso0['sucursal'];

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());
}

	#the code for the class
	include ('../ajaxCRUD.class.php'); // <-- this include file MUST go first before any HTML/output

    $tabla1 = new ajaxCRUD("Categoria", "categorias", "id_categ", "../");
	$tabla1->omitPrimaryKey();
	$tabla1->displayAs("categoria", "Categoria");
	$tabla1->omitFieldCompletely("negocio");
	$tabla1->omitFieldCompletely("sucursal");
	$tabla1->setTextboxWidth('categoria', 50);
	$tabla1->emptyTableMessage = "";
	$tabla1->addValueOnInsert("negocio", "$negocio");
	$tabla1->addValueOnInsert("sucursal", "$sucursal");
	$tabla1-> addWhereClause("WHERE (negocio = '$negocio')");
    $tabla1->disallowDelete();
    $tabla1->setLimit(200);
	$tabla1->addOrderBy("ORDER BY orden ASC");
	$allowableValues = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50);
	$tabla1->defineAllowableValues("orden", $allowableValues);
	$tabla1->deleteText = "Borrar";
	$tabla1->addText= "AGREGAR";
	$tabla1->setCSSFile('greysuit.css');

	function makeBold($val){
		if ($val == "") return "-----";
		return "<font style='font-size:10px'><b>$val</b></font>";
	}

	function makeBlue($val){
		return "<span style='color: blue;'>$val</span>";
	}

	function myCallBackFunction($array){
		echo "THE ADD ROW CALLBACK FUNCTION WAS implemented";
		print_r($array);
	}
?>
<!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">
	<div class="row">
		<div class="col-sm-12">
			<HR>
		</div>
	</div>
	
	<div class="row">
		<div class="col-sm-12">
			<a href="negocio_3.php" class="btn btn-warning btn-sm" role="button" style="width:15rem"><b><span class='glyphicon glyphicon-arrow-left'></span> Volver</b></a></p>
		</div>
	</div>
	<div class="container-fluid" style="size:20px">
		<div class="row" >
			El orden es tal como aparecerán en la carta digital (verifica que no haya dos iguales)
		</div>
	</div>
<br>
		<div class="container-fluid text-center" >
			<div class="row" >
				<div class="col" >
					<?php $tabla1->showTable();?>
				</div>
			</div>
</div>
</div>
