<?php
session_start();
require_once('conexion.php');
require_once('include/sesiones.php');
if (isset($_SESSION['clie_id']))
{
?>
<!DOCTYPE html>
<html lang="en">
  <head><meta charset="gb18030">
  <?php include ('head.php');?>
<script>
function estado(art_id) {
    $.ajax({
        type: "POST",
        url: "php_articulo/cambiar_estado.php",
        data: "art_id="+art_id,
        
        success: function(datos){
    $("#resultados").html(datos);
        load(1);
    }
      });
    } 

   
  </script>
  </head>
<bodY>
<?php  include ('menu.php'); ?> 
    
<div class="main">
    <div class="col-md-2">
        <?php include ('include/menu_ventas.php');?>
    </div> <!-- /span6 -->
    <div class="col-md-10"> 
        <div class="widget stacked">
            <div class="widget-content">
                <div class="panel panel-default">
                    <div class="panel-body">
                        <h1 class="panel-title pull-left" style="font-size:20px;"><i class="fas fa-list-alt fa-2x"></i> ARTICULOS</h1>
                    </div>
                </div> 
                <div class="widget stacked">
                    <div class="widget-content">
                        <section id="buttons">
                            <div class="col-md-6"></div>
                            <input type="hidden" class="form-control input-sm" id="proveedor" value="" autocomplete="off"   >
                            <div class="col-md-3">
                                <section id="intro" >
                                    <select  id="familia"  class="form-control input-sm" onchange='load(1);'>
                                        <option value="">Buscar Familia (Todos)</option>
                                            <?php
                                                    $datos = mysqli_query($con,"SELECT * FROM familias f, articulos a WHERE familias_fam_id=fam_id and art_referencia='$art_referencia' and a.empresa='$empresa'  and f.empresa='$empresa'  ") ;
                                                    while( $fila = mysqli_fetch_array( $datos ) )
                                                    {
                                                    echo' <option value="'.$fila['fam_id'].'">'.$fila['fam_nombre'].'</option>';
                                                    }
                                                    $datos = mysqli_query($con,"SELECT * FROM familias  WHERE   empresa='$empresa' order by fam_nombre asc   ") ;
                                                    while( $fila = mysqli_fetch_array( $datos ) )
                                                    {
                                                    echo' <option value="'.$fila['fam_id'].'">'.$fila['fam_nombre'].'</option>';
                                                    }
                                                    ?>
                                    </select>
                                </section>
                            </div>
                            <div class="col-md-3">
                                <input type="text" class="form-control input-sm" id="q" autocomplete="off" placeholder="Código o Nombre" onkeyup='load(1);' autofocus >
                            </div>
                        </section>
                    </div> <!-- /widget-content -->
                </div> <!-- /widget -->
                <center> <span id="loader"></span></center>
                <div id="resultados"></div><!-- Carga los datos ajax -->
                <div class='outer_div'></div><!-- Carga los datos ajax -->
            </div> <!-- /widget-content -->
        </div> <!-- /widget --> </br></br>
    </div> <!-- /row -->
</div>

<div class="modal fade bs-example-modal-lg" id="modificar_articulo" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" >
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title">INFORMACIÓN </h4>
            </div>
            <div class="modal-body">
                <div id="form-art"></div>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<?php
  include ('script.php');
?>
  <script type="text/javascript" src="php_articulo/ajax.js"></script>

<script >

$( "#add_name" ).submit(function( event ) {
$('#submit').attr("disabled", true);
 var formData = new FormData($("#add_name")[0]);
  var ruta = "php_articulo/registrar_articulos.php";
   $.ajax({
      type: "POST",
      url: ruta,
      data: formData,
      contentType: false,
      processData: false, 
        beforeSend: function(objeto){
         $('#resultados_articulo').html('<center><img src="./img/ajax-loader.gif"> CARGANDO...</center>');
        },
      success: function(datos){
      $("#resultados_articulo").html(datos);
      $('#submit').attr("disabled", false);
      load(1);
      }
  });
  event.preventDefault();
})
</script>

</body>
</html>
<?php

}
else
{
    echo '<script>location.href = "index.php";</script>';
}
?>
 
