<?php $__env->startSection('CSS'); ?>
<?php echo HTML::style('DataTables/dataTables.bootstrap.min.css'); ?>

<?php echo HTML::style('DataTables/responsive.dataTables.min.css'); ?>

<style type="text/css">
	@media (max-width: 450px) { .ModalEliminar .modal-dialog { width: auto; } }
	@media (min-width: 451px) { .ModalEliminar .modal-dialog { width: 450px; } }
</style>
<?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">
	<?php /*
	<div class="col-md-12">
		<nav class="navbar navbar-inverse">
			<ul class="nav navbar-nav">
				<li><a href="<?php echo URL::to('templates'); ?>">Ver todos los Templates</a></li>
				<li><a href="<?php echo URL::to('templates/create'); ?>">Crear un Template</a>
			</ul>
		</nav>
	</div>
	*/ ?>
	<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"> Formularios vinculados a la lista de suscripción </h3> </div>
			<div class="porlets-content">
				<div class="table-responsive">
					<table class="table table-striped table-bordered table-hover" id="tblListasSuscriptores">
						<thead>
							<tr>
								<th style="width: 90%;"> Formulario </th>
								<th> Acciones </th>
							</tr>
						</thead>
						<tbody>
							<?php $__empty_1 = true; foreach($FbForms as $FbForm): $__empty_1 = false; ?>
							<tr>
								<td> <?php echo $FbForm->form_name; ?> </td>
								<td>
									<a href="javascript:Eliminar(<?php echo $FbForm->id; ?>)" class="btn btn-danger tooltips" data-toggle="tooltip" data-original-title="Desvincular"> <i class="fa fa-trash-o"></i> </a>
								</td>
							</tr>
							<?php endforeach; if ($__empty_1): ?>
							<tr class="danger"> <td colspan="2"> No existe ningún FB Lead Ads Agregado </td> </tr>
							<?php endif; ?>
						</tbody>
					</table>
				</div>
			</div>
			<div class="bottom">
				<?php echo HTML::linkRoute('SysWebEmailMarketingListasSubscriptoresFBLFAgregar', 'Agregar', array($idL), array('class' => 'btn btn-primary', 'id' => 'btnSuscriptoresAgregar')); ?>

				<a href="<?php echo URL::route('SysWebEmailMarketingListasSubscriptores'); ?>" class="btn btn-default">Regresar</a>
			</div>
		</div>
	</div>
</div><!--/row end-->
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JS'); ?>
<?php echo HTML::script('DataTables/jquery.dataTables.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.bootstrap.min.js'); ?>

<?php echo HTML::script('DataTables/dataTables.responsive.min.js'); ?>

<script type="text/javascript">
	<?php
		//$appId = (App::environment() == 'local' || strpos(public_path(), 'desarrollo'))?'216664162092407':'1304262509596042';
		$appId = (App::environment() == 'local' || strpos(public_path(), 'desarrollo'))?'216664162092407':'844034313701236';
		$fbAppV = 'v19.0';
	?>
	/* -------- SDK JAVASCRIPT DE FACEBOOK ------- */
	/*window.fbAsyncInit = function() {
		FB.init({
			appId: "<?= $appId ?>",
			xfbml: true,
			version: 'v2.8'
		});
	};*/
	window.fbAsyncInit = function() {
		FB.init({
			appId: "<?= $appId ?>",
			xfbml: true,
			version: "<?= $fbAppV ?>"
		});
	};
	(function(d, s, id) {
		var js, fjs = d.getElementsByTagName(s)[0];
		if (d.getElementById(id)) {
			return; }
		js = d.createElement(s);
		js.id = id;
		js.src = "//connect.facebook.net/en_US/sdk.js";
		fjs.parentNode.insertBefore(js, fjs);
	}(document, 'script', 'facebook-jssdk'));
	/* --------------------------------------------- */
	function Eliminar(id){
		var id = id;
		var mensaje = "<div class='row'> \
							<div class='col-xs-12'> \
								<form id='frmEliminar'> \
									<h2> ¿Seguro que desea desvincular? </h2> \
									<input type='hidden' name='idL' value='"+id+"'> \
								</form> \
							</div> \
						</div>";
		BootstrapDialog.show({
			title: "Eliminar registro",
			type: BootstrapDialog.TYPE_DANGER,
			message: mensaje,
			draggable: true,
			cssClass: "ModalEliminar",
			buttons: [{
				id: "btnEliminar",
				label: "Eliminar",
				cssClass: "btn-danger",
				action: function(dialogItself){
					$.isLoading({ text: "Cargando..." }); NProgress.start();
					$("#btnEliminar").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Eliminando');
					$.post(
						"<?php echo URL::route('SysWebEmailMarketingListasSubscriptoresFBLFEliminar', array($idL)); ?>",
						{idF:id},
						function(data){
							$.isLoading("hide"); NProgress.done();
							$("#btnEnviar").prop("disabled", false).html("Eliminar");
							if(data.success){
								new PNotify({ title: "Felicidades!", text: data.mensaje, type: "success" });
								dialogItself.close();
								setTimeout( function(){ window.location.reload(); }, 3000 );
							}
							else{
								if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
								$.each(data.errMensajes, function(key, value){ if(value != ''){ $("#err"+key).html(value); } else{ $("#err"+key).html(""); } });
							}
						},
						"json"
					);
				}
			}]
		});
	}
</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
<?php if(Session::has('EliminarMensajeS')): ?>
new PNotify({ title: "Realizado", text: "<?php echo Session::get('EliminarMensajeS'); ?>", type: "success" });
<?php endif; ?>
<?php if(Session::has('EliminarMensajeE')): ?>
new PNotify({ title: "Realizado", text: "<?php echo Session::get('EliminarMensajeE'); ?>", type: "error" });
<?php endif; ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>