<?php $__env->startSection('CSS'); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('Contenido'); ?>
<div class="row">
	<div class="col-md-12">
		<h2><i class="fa fa-envelope-o"></i> E-Mail Marketing </h2>
	</div><!--/col-md-12-->
</div><!--/row-->

<div class="row">
	<div class="col-md-12">
		<?php if(Session::has('message')): ?>
		<div class="alert alert-info"><?php echo Session::get('message'); ?></div>
		<?php endif; ?>
	</div>
</div>

<div class="row">
	<div class="col-md-12">
		<div class="block-web">
			<div class="header"> <h3 class="content-header"> API Keys de Sume Clientes </h3> </div>
			<div class="porlets-content">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover">
						<thead>
							<tr>
								<th class="col-md-6"> API Key </th>
								<th class="col-md-4"> Estado </th>
								<th class="col-md-2"> Acciones </th>
							</tr>
						</thead>
						<tbody>
							<?php $__empty_1 = true; foreach($APIKeys as $APIKey): $__empty_1 = false; ?>
							<tr>
								<td> <?php echo $APIKey->api_key; ?> </td>
								<td> <?php if($APIKey->estado == 1): ?> En uso <?php else: ?> Disponible <?php endif; ?> </td>
								<td>
									<!-- -->
								</td>
							</tr>
							<?php endforeach; if ($__empty_1): ?>
							<tr class="danger"> <td colspan="3"> No existe ningúna API Key generada </td> </tr>
							<?php endif; ?>
						</tbody>
					</table>
				</div>
			</div>
			<div class="bottom">
				<?php echo Form::button('Generar', array('class' => 'btn btn-primary', 'id' => 'btnGenerar', 'type' => 'button')); ?>

			</div>
		</div>
	</div>
</div><!--/row end-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JS'); ?>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
$("#btnGenerar").click(function(){
	$("#btnGenerar").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Generando');
	$.post(
		"<?php echo URL::route('SysWebPAterrizajeAPIKeysGenerar'); ?>",
		{cid:<?php echo Cliente::select('id')->where('users_id', '=', Auth::user()->id)->first()->id; ?>},
		function(data){
			$("#btnGenerar").prop("disabled", false).html("Generar");
			if(data.success){
				new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
				setTimeout( function(){ window.location.reload(); }, 3000 );
			}
			else{
				if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
			}
		},
		"json"
	);
});
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>