<?php $r="../";
require_once($r."inc/funciones.php");
validNotSession($r);
$mysqli = connectDB($r);
$spe=$_SESSION['perfil'];
$row1 = $mysqli->query("SELECT * FROM z_ruta WHERE eliminado=0");
?>

<!DOCTYPE html>
<html lang="es">
  <?php include $r."inc/head.php"; ?>
  <style>
      .container-fluid{padding-right:5px;padding-left:5px;}
  </style>
<script>
  function limpiarFormulario() {
    document.getElementById("miForm").reset();
  }
</script>
<body class="fixed-nav sticky-footer sidenav-toggled bg-dark" id="page-top">
  <div class="content-wrapper">
    <div class="container-fluid">
      <?php include $r."inc/nav.php"; ?>
      <form action="grafico-productos.php" method="get" id="miForm">
        <div class="row">
          <div class="col-sm-4">
            <label for="exampleSelect2">Ruta</label>
            <select name="ruta"  data-placeholder="Seleccione Una ruta" id="picturegallery" class="chosen-select" >
              <option value="">Todos</option>
               <? $row1 = $mysqli->query("SELECT * FROM z_ruta WHERE eliminado=0");
               while($row2 = $row1->fetch_assoc()) {
               ?>
              <option value="<? echo $row2["id"] ?>"><? echo $row2["nombre"] ?></option>
              <? } ?>
            </select>
          </div>
          <div class="col-sm-4">
            <label for="exampleSelect2">Call-Center</label>
            <select name="call"  data-placeholder="Seleccione un tipo" id="picturegallery2" class="chosen-select" >
              <option value="">Todos</option>
               <? $row1 = $mysqli->query("SELECT * FROM z_usuarios WHERE tipo=4 AND eliminado=0");
               while($row2 = $row1->fetch_assoc()) {
               ?>
              <option value="<? echo $row2["id"] ?>"><? echo $row2["nombre"] ?></option>
              <? } ?>
            </select>
            </select>
          </div>
          <div class="col-sm-4">
            <label for="exampleSelect2">Call-center</label>
            <select name="Call-center"  data-placeholder="Seleccione un tipo" id="picturegallery2" class="chosen-select" >
              <option value="">Todos</option>
              <option value="2">Distribuidor</option>
              <option value="1">Salsamentaria</option>
              <option value="3">Elaborador</option>
            </select>
          </div>
          <div class="col-sm-4">
            <label for="exampleSelect2">Estado</label>
            <select name="estado"  data-placeholder="Seleccione el estado" id="picturegallery3" class="chosen-select" >
              <option value="">Todos</option>
              <option value="0">Por Aprovar</option>
              <option value="1">Por Entregar</option>
              <option value="2">En Ruta</option>
              <option value="3">Finalizado</option>
              <option value="4">Cancelado</option>
              <option value="5">Devuelto</option>
            </select>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-4">
            <label for="exampleSelect2">Pago</label>
            <select name="pago"  data-placeholder="Seleccione el estado" id="picturegallery4" class="chosen-select" >
              <option value="">Todos</option>
              <option value="0">Por cobrar</option>
              <option value="1">bono</option>
              <option value="2">cobrado</option>
            </select>
          </div>
          <div class="col-sm-3">
            <label for="exampleSelect2">Cliente</label>
            <select name="cliente"  data-placeholder="Seleccione un cliente" id="picturegallery5" class="chosen-select" >
              <option value="">Todos</option>
               <? $row1 = $mysqli->query("SELECT * FROM z_clientes WHERE eliminado=0");
               while($row2 = $row1->fetch_assoc()) {
               ?>
              <option value="<? echo $row2["id"] ?>"><? echo $row2["nombre"] ?></option>
              <? } ?>
            </select>
            </select>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-6">
            <label for="exampleSelect2">fecha Inicial</label>
            <input name="inicial" type="date"  class="form-control" >
          </div>
          <div class="col-sm-6">
            <label for="exampleSelect2">fecha Final</label>
            <input name="final" type="date"  class="form-control" >
          </div>
        </div>
        <br>
  <button type="submit" class="btn btn-primary">Ver Grafica</button>
	 <button type="button"  class="btn btn-primary" id="btnLimpiar">Limpiar</button>
    
</form>
      
    <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
   $("#btnLimpiar").click(function(event) {
	   $("#miForm")[0].reset();
        var newOption = $('<option value="1">test</option>');
        $('#picturegallery').append(newOption);
        $('#picturegallery').trigger("chosen:updated");
        var newOption = $('<option value="1">test</option>');
        $('#picturegallery2').append(newOption);
        $('#picturegallery2').trigger("chosen:updated");
        var newOption = $('<option value="1">test</option>');
        $('#picturegallery3').append(newOption);
        $('#picturegallery3').trigger("chosen:updated");
        var newOption = $('<option value="1">test</option>');
        $('#picturegallery4').append(newOption);
        $('#picturegallery4').trigger("chosen:updated");
        var newOption = $('<option value="1">test</option>');
        $('#picturegallery5').append(newOption);
        $('#picturegallery5').trigger("chosen:updated");
   });
</script>  
      
      <?php include $r."inc/foot.php"; ?>
    </div>
  </div>
</body>
</html>