<?php 
session_start();

?>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-12">
		    <div class="card">
		        <div class="card-header">
    		<div class="row">
			
				
					<form  id="for_fil_pro" >
						<div class="row">
						
							
							
							<div class="col-lg-3 col-sm-3 col-6 d-none">
								<label for="txt_fil_pro_acc">Accion:</label>
								<input name="txt_fil_pro_acc" type="text" id="txt_fil_pro_acc" class="form-control  input-sm">
							</div>
							
							<div class="col-lg-3 col-sm-2 col-6">
							<label for="txt_fil_pro_mar">Marca:</label>
							<input type="text" name="txt_fil_pro_mar" id="txt_fil_pro_mar" value="" class="form-control input-sm" > 			
											 	
							</div> 
							
							<div class="col-lg-3 col-sm-3 col-6 d-none">
								<label for="txt_fil_pro_fam">Familia:</label>
								<input type="text" name="txt_fil_pro_fam" id="txt_fil_pro_fam" value="" class="form-control input-sm" > 			
													 	
							</div> 	
							
							<div class="col-lg-3 col-sm-3 col-6">
								<label for="cmb_fil_cat_id">Categoría:</label>
								<select name="cmb_fil_cat_id" id="cmb_fil_cat_id" class="form-control  input-sm"></select>
							</div>
							
							<div class="col-lg-3 col-sm-3 col-6 ">
								<label for="txt_fil_pro_codmar">Codigo</label>
								<input name="txt_fil_pro_codmar" type="text" id="txt_fil_pro_codmar" class="form-control  input-sm">
							</div>
							
						
							<div class="col-lg-3 col-sm-3 col-6">
								<label for="txt_fil_pro_dat1">Busqueda:</label>
								<input name="txt_fil_pro_dat1" type="text" id="txt_fil_pro_dat1" class="form-control  input-sm">
							</div>
							
							<div class="col-lg-3 col-sm-3 col-6">
								<label for="txt_fil_pro_dat2">-</label>
								<input name="txt_fil_pro_dat2" type="text" id="txt_fil_pro_dat2" class="form-control  input-sm">
							</div>
							
							<div class="col-lg-3 col-sm-3 col-6">
								<label for="txt_fil_pro_dat3">-</label>
								<input name="txt_fil_pro_dat3" type="text" id="txt_fil_pro_dat3" class="form-control  input-sm">
							</div>
							
							<div class="col-lg-3 col-sm-3 col-6 d-none">
								<label for="txt_fil_pro_dat4">-</label>
								<input name="txt_fil_pro_dat4" type="text" id="txt_fil_pro_dat4" class="form-control  input-sm">
							</div>
							
							
							
							<div class="col-lg-3 col-sm-3 col-6" style="padding-top: 30px;">
							<span style="cursor:pointer" onClick="producto_tabla()" class="btn btn-primary"> <i class="fa fa-search"></i></span>
							<span style="cursor:pointer" onClick="producto_filtro()" class="btn btn-default"> Restablecer </span>
							</div>
							</div>	
					</form>
												
						

					

			</div>
		</div>
	</div>



</div>
</div>
</div>
</section>

<script type="text/javascript">

	function cmb_fil_cat_id()
	{	
		$.ajax({
			type: "POST",
			url: "../categoria/cmb_cat_id.php",
			async:true,
			dataType: "html",                      
			data: ({
			//cat_id: "<?php //echo $cat_id?>"
		}),
			beforeSend: function() {
				$('#cmb_fil_cat_id').html('<option value="">Cargando...</option>');
			},
			success: function(html){
				$('#cmb_fil_cat_id').html(html);
			}
		});
	}
	
	
	
	$(function() {
		
		$('#txt_fil_pro_nom').focus();
		
		cmb_fil_cat_id();
		
		$( "#txt_fil_pro_fam" ).keydown(function(e){
			if(e.which==13)
			{
				producto_tabla();
				e.preventDefault();
			}
		});
		
		$( "#txt_fil_pro_mar" ).keydown(function(e){
			if(e.which==13)
			{producto_tabla();
				e.preventDefault();
			}
		});

		$( "#txt_fil_pro_dat1" ).keydown(function(e){
			if(e.which==32)
			{
				$( "#txt_fil_pro_dat2" ).focus();
				//producto_tabla();
				e.preventDefault();
			}
		});

		$( "#txt_fil_pro_dat2" ).keydown(function(e){
			if(e.which==32)
			{
				$( "#txt_fil_pro_dat3" ).focus();
				//producto_tabla();
			e.preventDefault();
			}
		});

		$( "#txt_fil_pro_dat3" ).keydown(function(e){
			if(e.which==32)
			{
				$( "#txt_fil_pro_dat4" ).focus();
				//producto_tabla();
				e.preventDefault();
			}
		}); 
		
		$( "#txt_fil_pro_dat1" ).keydown(function(e){
			if(e.which==13)
			{
				
				producto_tabla();
				e.preventDefault();
			
			}
		});
		
			$( "#txt_fil_pro_dat2" ).keydown(function(e){
			if(e.which==13)
			{
				
				producto_tabla();
				e.preventDefault();
			
			}
		});
		
		
			$( "#txt_fil_pro_dat3" ).keydown(function(e){
			if(e.which==13)
			{
				
				producto_tabla();
				e.preventDefault();
			
			}
		});
		
		$( "#txt_fil_pro_dat4" ).keydown(function(e){
			if(e.which==13)
			{
				
				producto_tabla();
				e.preventDefault();
			
			}
		});
		
		
		
		$("#txt_fil_pro_dat4").keydown(function(e){
			if(e.which==8)
			{
				if($("#txt_fil_pro_dat4").val()==""){
					$("#txt_fil_pro_dat3").focus();
				}	
				//e.preventDefault();	
			}
		});
		
		
		$("#txt_fil_pro_dat3").keydown(function(e){
			if(e.which==8)
			{
				if($("#txt_fil_pro_dat3").val()==""){
					$("#txt_fil_pro_dat2").focus();
				}	
			//	e.preventDefault();	
			}
		});
		
		
		$("#txt_fil_pro_dat2").keydown(function(e){
			if(e.which==8)
			{
				if($("#txt_fil_pro_dat2").val()==""){
					$("#txt_fil_pro_dat1").focus();
				}	
			//	e.preventDefault();	
			}
		});

		$('#cmb_fil_cat_id, #cmb_fil_mar_id, #cmb_fil_alm_id,#cmb_fil_lim,#txt_fil_pro_codmar,#txt_fil_pro_acc').change(function(){
			producto_tabla();
		});
		
		
		producto_tabla();
		
	});
</script>