<?php 
session_start();
 if($_SESSION['usuariogrupo_id']!=1){
	 ?>

<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Moneda
			<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" >Caja</li>
				<li class="breadcrumb-item active">Moneda</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">
		    <div class="card">
		        <div class="card-header">
		          <strong>USTED NO TIENE PERMISOS PARA VER ESTA PAGINA</strong>
		        </div>
		    </div>
		</div>
	</div>
	</div>
</section>





	 <?php 
 }
 else{
?>


<div class="content-header" >
      <div class="container-fluid">
        <div class="row mb-2">
		 <div class="col-sm-6">
			<h1>
			Moneda
			<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" >Caja</li>
				<li class="breadcrumb-item active">Moneda</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="moneda_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_moneda_form_dialog" role="dialog" data-keyboard="false" data-backdrop="static" tabindex="-1"  style="padding:0px;">
			<div class="modal-dialog " role="document" >
			<div class="modal-content">
			<div class="modal-body div_moneda_form" >
			</div>
			<br />
			<br />
			</div>
			</div>
			</div>
			
		<!-- tabla de registros -->	
		<div id="div_moneda_tabla"></div>
		

<script type="text/javascript">
	function moneda_tabla(){	
		console.log('tabla');
		$.ajax({
			type: "POST",
			url: "../moneda/moneda_tabla.php",
			async:true,
			dataType: "html",                      
			data: ({
				//pro_est:	$('#cmb_fil_pro_est').val()
			}),
			beforeSend: function() {
				$('#div_moneda_tabla').addClass("ui-state-disabled");
	        },
			success: function(html){
				$('#div_moneda_tabla').html(html);
			},
			complete: function(){			
				$('#div_moneda_tabla').removeClass("ui-state-disabled");
			}
		});     
	}
	function moneda_form(act,idf){
		$('#div_moneda_form_dialog').modal();
		$.ajax({
			type: "POST",
			url: "../moneda/moneda_form.php",
			async:true,
			dataType: "html",                      
			data: ({
				action: act,
				mon_id:	idf,
				vista:	'moneda_tabla'
			}),
			beforeSend: function() {
				var div = "<center><div class='overlay col-lg-12 col-sm-12 col-xs-12' style='background-color:#fff;padding:0%;font-size:3rem;' >  <i class='fa fa-refresh fa-spin ' ></i> </div>  </center>";	
				$('.div_moneda_form').html(div);	
	        },
			success: function(html){
				$('.div_moneda_form').html(html);		
			}
		});
	}
	function eliminar_moneda(id)
	{   
		$('#msj_moneda').hide();   
		if(confirm("Realmente desea eliminar?")){
			$.ajax({
				type: "POST",
				url: "../moneda/moneda_reg.php",
				async:true,
				dataType: "html",
				data: ({
					action: "eliminar",
					mon_id:		id
				}),
				beforeSend: function() {
					
				},
				success: function(html){
					toastr["success"](html);
				},
				complete: function(){
					moneda_tabla();
				}
			});
		}
	}
$(function() {
	
	$('#btn_actualizar').click(function() {
		$("#contenido").load("../moneda/moneda_vista.php");
	});
	moneda_tabla();
	setTitle("MONEDAS - "+nombreEmpresa);	
	
});
</script>
 <?php } ?>