

<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Igv
			<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 Interno</li>
				<li class="breadcrumb-item active">Igv</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_agregar" onClick="igv_form('insertar')" class="btn btn-primary">Agregar</button>
		          <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_igv_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_igv_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		<!-- tabla de registros -->	
		<div id="div_igv_tabla" ></div>

<script type="text/javascript">

	
	function igv_tabla()
	{	
		$.ajax({
			type: "POST",
			url: "../igv/igv_tabla.php",
			async:true,
			dataType: "html",                      
			data: ({
		}),
			beforeSend: function() {
				$('#div_igv_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_igv_tabla').html(html);
			},
			complete: function(){			
				$('#div_igv_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	function igv_form(act,idf)
	{
		$('#div_igv_form_dialog').modal();
		
		$.ajax({
			type: "POST",
			url: "../igv/igv_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				igv_id:	idf
			}),
			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_igv_form').html(div);
			},
			success: function(html){
				$('.div_igv_form').html(html);	
						
			}
		});
	}
	function eliminar_igv(id)
	{   
		
		if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../igv/igv_reg.php",
				async:true,
				dataType: "json",
				data: ({
					action: "eliminar",
					id:id
				}),
				beforeSend: function() {
					
				},
				success: function(data){
					toastr["success"](data.msj);
				},
				complete: function(){
					igv_tabla();
				}
			});
		}
	}
	$(function() {
		$('#btn_actualizar').click(function() {
			$("#contenido").load("../igv/igv_vista.php");
		});
		$("#div_igv_form_dialog").on('hidden.bs.modal', function(){
          
		});
		igv_tabla();
		setTitle("IGV - "+nombreEmpresa);
	});
</script>