<style type="text/css">

select{

	cursor:pointer;

}





</style>



<div class="content-wrapper">



	<section class="content-header">

		<h1>

			Tarjeta

			<small>modulo</small>

		</h1>

		<ol class="breadcrumb">

			<li><a href="#"><i class="fa fa-dashboard"></i> Inicio</a></li>

			<li><a href="#">Mantenimiento</a></li>

			<li><a href="#">Ventas</a></li>

			<li class="active"></i> Tarjeta</li>

		</ol>

	</section>

	<section class="content" style="min-height:0px;padding-bottom:0px;margin-bottom:-30px;">

		<div class="row">

			<div class="col-xs-12">

				<div class="box">

					<div class="box-header">

						<button id="btn_agregar" onClick="tarjeta_form('insertar')" class="btn btn-primary">Agregar</button>

						<button id="btn_actualizar" class="btn btn-default">Actualizar</button>

					</div>

				</div>

			</div>

		</div>

	</section>



	

	

	

	<!-- formulario de registro -->

			<div class="modal fade" id="div_tarjeta_form_dialog" role="dialog" data-keyboard="true" tabindex="-1"  style="padding:0px;">

			<div class="modal-dialog "  role="document" >



			<div class="modal-content">



			<div class="modal-body div_tarjeta_form" >



			</div>

			<br />

			<br />

			</div>

			</div>

			</div>

			

		<!-- tabla de registros -->	

	<div id="div_tarjeta_tabla"></div>

	



</div>



<script type="text/javascript">



	function tarjeta_tabla()

	{	

		$.ajax({

			type: "POST",

			url: "../tarjeta/tarjeta_tabla.php",

			async:true,

			dataType: "html",                      

			data: ({

			//pro_est:	$('#cmb_fil_pro_est').val()

		}),

			beforeSend: function() {

				$('#div_tarjeta_tabla').addClass("ui-state-disabled");

			},

			success: function(html){

				$('#div_tarjeta_tabla').html(html);

			},

			complete: function(){			

				$('#div_tarjeta_tabla').removeClass("ui-state-disabled");

			}

		});     

	}



	function tarjeta_form(act,idf)

	{	$('#div_tarjeta_form_dialog').modal();

		$.ajax({

			type: "POST",

			url: "../tarjeta/tarjeta_form.php",

			async:true,

			dataType: "html",                      

			data: ({

				action: act,

				tar_id:	idf,

				vista:	'tarjeta_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_tarjeta_form').html(div);

			},

			success: function(html){

				$('.div_tarjeta_form').html(html);

			}

		});

	}



	function eliminar_tarjeta(id){

		$('#msj_tarjeta').hide();  

		if(!confirm('¿Desea eliminar?'))

			return false;

		$.ajax({

			type: "POST",

			url: "../tarjeta/tarjeta_reg.php",

			dataType: "json",

			async:true,                     

			data:({

				action: "eliminar",

				tar_id:		id

			}),

			beforeSend: function() {

				

			},

			success: function(data){

				toastr["success"](data.tar_msj);	

				tarjeta_tabla();

			}

		});

	}



$(function() {

	

	$('#btn_actualizar').click(function() {

		$("#content").load("../tarjeta/tarjeta_vista.php");

	});



	$("#div_tarjeta_form_dialog").on('hidden.bs.modal', function(){

          	$("#content").load("../tarjeta/tarjeta_vista.php");

	});

		

	tarjeta_tabla();



	setTitle("TARJETA - "+nombreEmpresa);	



	

});



</script>