

<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Presentacion
			<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" >Catalogo</li>
				<li class="breadcrumb-item active">Presentacion</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="presentacion_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_presentacion_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_presentacion_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		<!-- tabla de registros -->	
		<div id="div_presentacion_tabla" ></div>

<script type="text/javascript">

	
	
	function presentacion_tabla()
	{	
		$.ajax({
			type: "POST",
			url: "../presentacion/presentacion_tabla.php",
			async:true,
			dataType: "html",                      
			data: ({
		}),
			beforeSend: function() {
				$('#div_presentacion_tabla').addClass("ui-state-disabled");
			},
			success: function(html){
				$('#div_presentacion_tabla').html(html);
			},
			complete: function(){			
				$('#div_presentacion_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	function presentacion_form(act,idf)
	{
		$('#div_presentacion_form_dialog').modal();
		
		$.ajax({
			type: "POST",
			url: "../presentacion/presentacion_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				pre_id:	idf,
				vista:	'presentacion'
			}),
			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_presentacion_form').html(div);
			},
			success: function(html){
				$('.div_presentacion_form').html(html);	
						
			}
		});
	}
	function eliminar_presentacion(id)
	{   
		
		if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../presentacion/presentacion_reg.php",
				async:true,
				dataType: "html",
				data: ({
					action: "eliminar",
					id:		id
				}),
				beforeSend: function() {
					
				},
				success: function(html){
					toastr["success"](html);
				},
				complete: function(){
					presentacion_tabla();
				}
			});
		}
	}
	$(function() {
		$('#btn_actualizar').click(function() {
			$("#contenido").load("../presentacion/presentacion_vista.php");
		});
		$("#div_presentacion_form_dialog").on('hidden.bs.modal', function(){
          	//$("#content").load("../presentacion/presentacion_vista.php");
		});
		presentacion_tabla();
		setTitle("PRESENTACION - "+nombreEmpresa);
	});
</script>