

<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Servicio Pago
			<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">Servicio Pago</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="serviciopago_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_serviciopago_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_serviciopago_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		<!-- tabla de registros -->	
		
		<div id="div_serviciopago_filtro" ></div>
		
		<div id="div_serviciopago_tabla" ></div>
		

<script type="text/javascript">
 
	
	
	function serviciopago_tabla()
	{	
		$.ajax({
			type: "POST",
			url: "../serviciopago/serviciopago_tabla.php",
			async:true,
			dataType: "html",                      
			data: $("#for_fil_serpag").serialize(),
			beforeSend: function() {
				$('#div_serviciopago_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_serviciopago_tabla').html(html);
			},
			complete: function(){			
				$('#div_serviciopago_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	
	
	function serviciopago_filtro()
	{
		$.ajax({
			type: "POST",
			url: "../serviciopago/serviciopago_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_serviciopago_filtro').html(div);
			},
			success: function(html){
				$('#div_serviciopago_filtro').html(html);
			},
			complete: function(){
					
			}
		});
	}
	
	function serviciopago_form(act,idf)
	{
		$('#div_serviciopago_form_dialog').modal();
		
		$.ajax({
			type: "POST",
			url: "../serviciopago/serviciopago_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				cat_id:	idf,
				vista:	'serviciopago'
			}),
			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_serviciopago_form').html(div);
			},
			success: function(html){
				$('.div_serviciopago_form').html(html);	
						
			}
		});
	}
	function eliminar_serviciopago(id)
	{   
		
		if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../serviciopago/serviciopago_reg.php",
				async:true,
				dataType: "json",
				data: ({
					action: "eliminar",
					id:	id
				}),
				beforeSend: function() {
					
				},
				success: function(data){
					toastr["success"](data.msj);
				},
				complete: function(){
					serviciopago_tabla();
				}
			});
		}
	}
	
	$(function() {
		$('#btn_actualizar').click(function() {
			$("#contenido").load("../serviciopago/serviciopago_vista.php");
		});
		$("#div_serviciopago_form_dialog").on('hidden.bs.modal', function(){
          	//$("#content").load("../serviciopago/serviciopago_vista.php");
		});
		serviciopago_filtro();
		setTitle("SERVICIO PAGO - "+nombreEmpresa);
	});
</script>