
<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Historial
			<small>modulo</small>
			</h1>
		</div>	
		
		<div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
				<li class="breadcrumb-item" >Inicio</li>
				<li class="breadcrumb-item" >Mantenimiento</li>
				<li class="breadcrumb-item active">Historial</li>
            </ol>
          </div>
		</div>
	</div>
</div>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:0px;"  >
		    <div class="card">
		        <div class="card-header">
		          <button id="btn_actualizar" class="btn btn-default">Actualizar</button>		        
		        </div>
		    </div>
		</div>
	</div>
	</div>
</section>



	
	<!-- formulario de registro -->
			<div class="modal fade" id="div_historial_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;">
			<div class="modal-dialog " style="width: 90% !important;" role="document" >
			<div class="modal-content">
			<div class="modal-body div_historial_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		<div id="div_historial_filtro" ></div>
		<!-- tabla de registros -->	
		<div id="div_historial_tabla" ></div>

<script type="text/javascript">
 
	function historial_filtro()
	{
		$.ajax({
			type: "POST",
			url: "../historial/historial_filtro.php",
			async:true,
			dataType: "html",                      
			data: ({
				
			}),
			beforeSend: function() {
				var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
					
				$('#div_historial_filtro').html(div);
			},
			success: function(html){
				$('#div_historial_filtro').html(html);
			},
			complete: function(){
				
			}
		});
	}

	
	function historial_tabla()
	{	
		$.ajax({
			type: "POST",
			url: "../historial/historial_tabla.php",
			async:true,
			dataType: "html",                      
			data:  $("#for_fil_his").serialize(),
			beforeSend: function() {
				$('#div_historial_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_historial_tabla').html(html);
			},
			complete: function(){			
				$('#div_historial_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	function historial_form(act,idf)
	{
		$('#div_historial_form_dialog').modal();
		
		$.ajax({
			type: "POST",
			url: "../historial/historial_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				cat_id:	idf,
				vista:	'historial'
			}),
			beforeSend: function() {
				var div = "<center> <br> <span class='spinner-border spinner-border-lg mr-2'></span> <span style='font-size:1.5rem;'>PROCESANDO PETICIÓN</span></center>";	
				$('.div_historial_form').html(div);
			},
			success: function(html){
				$('.div_historial_form').html(html);	
						
			}
		});
	}
	function eliminar_historial(id)
	{   
		
		if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../historial/historial_reg.php",
				async:true,
				dataType: "html",
				data: ({
					action: "eliminar",
					id:		id
				}),
				beforeSend: function() {
					
				},
				success: function(html){
					toastr["success"](html);
				},
				complete: function(){
					historial_tabla();
				}
			});
		}
	}
	$(function() {
		$('#btn_actualizar').click(function() {
			$("#contenido").load("../historial/historial_vista.php");
		});
		$("#div_historial_form_dialog").on('hidden.bs.modal', function(){
          	//$("#content").load("../historial/historial_vista.php");
		});
		historial_filtro();
		setTitle("HISTORIAL - "+nombreEmpresa);
	});
</script>