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

<?php echo HTML::style('TouchSpin/jquery.bootstrap-touchspin.min.css'); ?>

<?php echo HTML::style('gentemplate/css/min/editor.min.css?=v2.1.0'); ?>

<?php echo HTML::style('jquery-ezdz/jquery.ezdz.min.css'); ?>

<?php /* HTML::style('emojionearea/dist/emojionearea.min.css') */ ?>
<style type="text/css">
	.pointer{ cursor:pointer; }
	.Separacion{ display: inline-block; padding: 1px; }
</style>
<?php echo HTML::style('image-picker/image-picker.css'); ?>

<style type="text/css">
	.image_picker_image{ height: 260px !important; width: 200px !important; }
</style>
<?php echo HTML::style('WebPro/plugins/dropzone/dropzone.css'); ?>

<?php echo HTML::style('image-picker/image-picker.css'); ?>

<style type="text/css">
	.img-biblioteca { height: 100px; }
	.image_picker_image { height: 100px !important; width: 119px !important; }
	.ModalBiblioteca .modal-dialog { width: 75%; }
	.ModalBiblioteca .modal-dialog .modal-footer { display: unset !important; border-top: unset !important; }
	/*.image_picker_image { object-fit: contain; }*/
	.text-count-wrapper-t { display: none; }
	.text-count-wrapper-d { display: none; }
	.modal-backdrop { z-index: 1040 !important; }
	.ModalBiblioteca { z-index: 99999 !important; }
	.image_picker_image {
	    height: 100px !important;
    	width: 119px !important;
    	object-fit: contain;
	}
	.panel-title>a {
		color: inherit;
		font-size: 25px;
		font-weight: bold;
		display:block;
	}
	.basic-wizard ul.nav li a {
		color: white;
		background-color: #687174;
		cursor: default;
		opacity: unset;
	}
	.basic-wizard ul.nav li:not(.active) a:hover {
		background-color: #687174;
		opacity: unset !important;
	}
	.basic-wizard ul.nav li.active a {
		cursor: default;
		opacity: unset;
	}
	/*.basic-wizard .next.disabled a {
		display: none !important;
	}
	.basic-wizard .next.disabled button {
		display: block !important;
	}*/
	.caption {
		text-align: center;
	}
	.caption h3 {
		font-weight: bold;
		font-size: 20px;
		word-break: break-word;
	}
	.caption button {
		display: inline-block;
		width: 135px;
		margin-bottom: 3px;
	}
	.caption a {
		display: inline-block;
		width: 135px;
		margin-bottom: 3px;
	}
	.mdAvatar .modal-footer {
		margin-top: 0px;
	}
	.modal-tablet.portrait iframe{
		width: 600px;
		margin-left: 15px;
	}
	.modal-tablet.portrait .iframe-container {
		background: url(/SysWeb/SumeClientes/VistaPrevia/portatil.png) center center no-repeat;
	}
	.modal-desktop .modal-dialog iframe{
		border: 0px solid transparent;
    	width: 1340px;
	}
	.ezdz-dropzone {
		width: 60px !important;
		height: 50px !important;
		display: inline-block;
		margin-right: 3%;
		border: 3px dotted #787878 !important;
	}
	.ezdz-dropzone div {
		/*line-height: 526%;*/
		padding-top: 6%;
		font: bold 34px arial !important;
		color: #787878;
	}
	.VistaPrevia .modal-header {
		background-color: #363b3f !important;
	}
	.VistaPrevia  .modal-header .close {
		color: #ff3b3b;
		text-shadow: 0 1px 0 #9f0000;
		opacity: 1;
	}
</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>
</div>

<div class="row">
	<div class="col-md-12">
		<div class="block-web">
			<div class="header"> <h3 class="content-header"> Nueva secuencia de seguimiento </h3> </div>
			<div class="porlets-content">
				<?php echo Form::open(array('route' => array('SysWebEmailMarketingListasSubscriptoresSecuenciasSeguimientosAgregarV2', $ListaEmail->id), 'method' => 'post', 'class' => 'form-horizontal row-border', 'id' => 'frmAgregar')); ?>

					<div id="progressWizard" class="basic-wizard dvConfCorreoSecuencia">
					<ul class="nav nav-pills nav-justified">
						<li>
							<a href="#ptab1" data-toggle="tab">
								<span>Paso 1:</span> Configura los parametros de la secuencia
							</a>
						</li>
						<li>
							<a href="#ptab2" data-toggle="tab"><span>Paso 2:</span> Selección de plantilla del correo electrónico
							</a>
						</li>
					</ul>
					<div class="tab-content">
						<div class="progress progress-striped">
							<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100"></div>
						</div>
						<div class="tab-pane" id="ptab1">
							<div class="form-group">
								<label class="col-sm-3 control-label"> Campos disponibles de tu lista para el asunto </label>
								<div class="col-sm-9">
									<?php foreach($Campos as $Campo): ?>
									<?php $label = ($Campo->requerido==1)?'success':'info'; ?>
									<div class="Separacion pointer" onclick="AgregarTexto('<?php echo $Campo->slug; ?>');"> <span class="label label-<?php echo $label; ?>"> <?php echo $Campo->nombre; ?> </span> </div>
									<?php endforeach; ?>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"> Asunto </label>
								<div class="col-sm-9">
									<?php echo Form::text('asunto', '',  array('class' => 'form-control', 'placeholder' => '', 'id' => 'asunto')); ?>

									<span class="text-danger" id="errasunto"> </span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"> Adjuntar archivo (Opcional) </label>
								<div class="col-sm-9">
									<div style="padding-top: 10px;"></div>
									<input type="file" name="adjunto" class="flInput" style="border: unset; margin-bottom: 10px;" accept="image/png, image/jpeg, application/pdf, application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/x-rar-compressed, application/zip, application/x-zip-compressed, multipart/x-zip">
									<span class="text-muted" style="display: block;"> Fotmatos soportados "jpg, jpeg, png, pdf, doc*, xls*, ppt*, zip y rar", no mayores a 5MB </span>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label"> Días despues </label>
								<div class="col-sm-9">
									<?php echo Form::text('dias_despues', '',  array('id' => 'dias_despues')); ?>

									<span class="text-danger" id="errdias_despues"> </span>
								</div>
							</div>
							<div class="form-group" style="display: none;">
								<label class="col-sm-3 control-label"> Enviar mensaje a </label>
								<div class="col-sm-9">
									<div class="radio-inline">
										<label>
											<input type="radio" checked value="T" id="suscriptoresTodos" name="suscriptores">
											<span class="custom-radio"></span> Todos los suscriptores
										</label>
									</div>
									<div class="radio-inline">
										<label>
											<input type="radio" value="S" id="suscriptoresSegmento" name="suscriptores">
											<span class="custom-radio"></span> Segmento de etiquetas
										</label>
									</div>
								</div>
							</div>
							<div id="dvSegmentoEtiquetas" style="display: none;">
								<div class="form-group">
									<label class="col-sm-3 control-label"> Etiquetas </label>
									<div class="col-sm-9">
										<select class="form-control selectpicker" multiple data-live-search="true" data-selected-text-format="count" id="etiquetas" name="etiquetas[]">
											<option value="0" disabled> Seleccione las etiquetas a asociar... </option>
											<?php foreach($Etiquetas as $indice => $Etiqueta): ?>
											<option value="<?php echo $Etiqueta->id; ?>" id="op<?php echo $Etiqueta->id; ?>"> <?php echo $Etiqueta->nombre; ?> </option>
											<?php endforeach; ?>
										</select>
										<span class="text-danger" id="erretiquetas"> </span>
										<div id="dvEtiquetas" style="padding-top: 10px;"></div>
									</div>
								</div>
							</div>
						</div>
						<div class="tab-pane" id="ptab2">
							<input type="hidden" name="plantillaDeCorreo" value="">
							<span class="text-danger" id="errplantillaDeCorreo"> </span>
							<!--<div class="row">-->
							<h3> Elige el tipo de plantilla y selecciona una </h3>
								<?php if( count($PlantillasCEC) > 0 ): ?>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaCEC">
												<i class="fa fa-angle-right"></i> Plantillas guardadas <i class="fa fa-star"></i>
											</a>
										</h4>
									</div>
									<div id="plantillaCEC" class="panel-collapse collapse">
										<div class="panel-body" id="plantCEC">
											<div class="row">
												<?php foreach($PlantillasCEC as $Plantilla): ?>
													<div class="col-sm-4 col-md-3">
														<div class="thumbnail" style="margin-bottom: 20px; border: 2px solid #363B3F; background-color: #f2f2f2;">
															<div class="caption">
																<h3 style="height: 50px;"><?php echo $Plantilla->nombre; ?></h3>
															</div>
															<img src="<?php echo asset('SysWeb/SumeClientes/plantilla-correo.png'); ?>" class="thumbnail" style="border: 3px solid #ddd;">
															<div class="caption">
																<button type="button" class="btn btn-success btnSelectionP tooltips" data-idP="<?php echo $Plantilla->id; ?>" id="btnSelectionP" data-toggle="tooltip" data-original-title="Seleccionar" data-nombre="nombre_de_plantilla">
																	<!--Seleccionar-->
																	<i class="fa fa-check"></i>
																</button>
															</div>
														</div>
													</div>
												<?php endforeach; ?>
												<div class="col-md-2"></div>
											</div>
										</div>
									</div>
								</div>
								<?php endif; ?>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaV">
												<i class="fa fa-angle-right"></i> Plantillas de venta
											</a>
										</h4>
									</div>
									<div id="plantillaV" class="panel-collapse collapse">
										<div class="panel-body" id="plantV">
											<div class="row">
												<?php foreach($PlantillasV as $Plantilla): ?>
													<div class="col-sm-4 col-md-3">
														<div class="thumbnail" style="margin-bottom: 20px; border: 2px solid #363B3F; background-color: #f2f2f2;">
															<div class="caption">
																<h3 style="height: 50px;"><?php echo $Plantilla->nombre; ?></h3>
															</div>
															<?php if($Plantilla->rutaImagen == ''): ?>
															<img src="https://via.placeholder.com/450x360?text=N/A" class="thumbnail" style="border: 3px solid #ddd;">
															<?php else: ?>
															<img src="<?php echo asset('SysWeb/EmailMarketing/Plantillas/Imagenes/'.$Plantilla->rutaImagen); ?>" class="thumbnail" style="border: 3px solid #ddd;">
															<?php endif; ?>
															<div class="caption">
																<button type="button" class="btn btn-success btnSelectionP tooltips" data-idP="<?php echo $Plantilla->id; ?>" id="btnSelectionP" data-toggle="tooltip" data-original-title="Seleccionar" data-nombre="nombre_de_plantilla">
																	<!--Seleccionar-->
																	<i class="fa fa-check"></i>
																</button>
																<a href="javascript:void(0);" onclick="vistaPrevia(<?php echo $Plantilla->id; ?>)" class="btn btn-primary tooltips"  id="btnVisualP" data-toggle="tooltip" data-original-title="Previsualizar">
																	<!--Previsualizar-->
																	<i class="fa fa-eye"></i>
																</a>
															</div>
														</div>
													</div>
												<?php endforeach; ?>
												<div class="col-md-2"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaR">
												<i class="fa fa-angle-right"></i> Plantillas relacionales
											</a>
										</h4>
									</div>
									<div id="plantillaR" class="panel-collapse collapse">
										<div class="panel-body" id="plantCER">
											<div class="row">
												<?php foreach($PlantillasR as $Plantilla): ?>
													<div class="col-sm-4 col-md-3">
														<div class="thumbnail" style="margin-bottom: 20px; border: 2px solid #363B3F; background-color: #f2f2f2;">
															<div class="caption">
																<h3 style="height: 50px;"><?php echo $Plantilla->nombre; ?></h3>
															</div>
															<?php if($Plantilla->rutaImagen == ''): ?>
															<img src="https://via.placeholder.com/450x360?text=N/A" class="thumbnail" style="border: 3px solid #ddd;">
															<?php else: ?>
															<img src="<?php echo asset('SysWeb/EmailMarketing/Plantillas/Imagenes/'.$Plantilla->rutaImagen); ?>" class="thumbnail" style="border: 3px solid #ddd;">
															<?php endif; ?>
															<div class="caption">
																<button type="button" class="btn btn-success btnSelectionP tooltips" data-idP="<?php echo $Plantilla->id; ?>" id="btnSelectionP" data-toggle="tooltip" data-original-title="Seleccionar" data-nombre="nombre_de_plantilla">
																	<!--Seleccionar-->
																	<i class="fa fa-check"></i>
																</button>
																<a href="javascript:void(0);" onclick="vistaPrevia(<?php echo $Plantilla->id; ?>)" class="btn btn-primary tooltips" id="btnVisualP" data-toggle="tooltip" data-original-title="Previsualizar">
																	<!--Previsualizar-->
																	<i class="fa fa-eye"></i>
																</a>
															</div>
														</div>
													</div>
												<?php endforeach; ?>
												<div class="col-md-2"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaC">
												<i class="fa fa-angle-right"></i> Plantillas de comunicación
											</a>
										</h4>
									</div>
									<div id="plantillaC" class="panel-collapse collapse">
										<div class="panel-body" id="plantC">
											<div class="row">
												<?php foreach($PlantillasC as $Plantilla): ?>
													<div class="col-sm-4 col-md-3">
														<div class="thumbnail" style="margin-bottom: 20px; border: 2px solid #363B3F; background-color: #f2f2f2;">
															<div class="caption">
																<h3 style="height: 50px;"><?php echo $Plantilla->nombre; ?></h3>
															</div>
															<?php if($Plantilla->rutaImagen == ''): ?>
															<img src="https://via.placeholder.com/450x360?text=N/A" class="thumbnail" style="border: 3px solid #ddd;">
															<?php else: ?>
															<img src="<?php echo asset('SysWeb/EmailMarketing/Plantillas/Imagenes/'.$Plantilla->rutaImagen); ?>" class="thumbnail" style="border: 3px solid #ddd;">
															<?php endif; ?>
															<div class="caption">
																<button type="button" class="btn btn-success btnSelectionP tooltips" data-idP="<?php echo $Plantilla->id; ?>" id="btnSelectionP" data-toggle="tooltip" data-original-title="Seleccionar" data-nombre="nombre_de_plantilla">
																	<!--Seleccionar-->
																	<i class="fa fa-check"></i>
																</button>
																<a href="javascript:void(0);" onclick="vistaPrevia(<?php echo $Plantilla->id; ?>)" class="btn btn-primary tooltips" id="btnVisualP" data-toggle="tooltip" data-original-title="Previsualizar">
																	<!--Previsualizar-->
																	<i class="fa fa-eye"></i>
																</a>
															</div>
														</div>
													</div>
												<?php endforeach; ?>
												<div class="col-md-2"></div>
											</div>
										</div>
									</div>
								</div>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed aCETextoPlano" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaCTP">
												<i class="fa fa-angle-right"></i> Plantilla de texto plano
											</a>
										</h4>
									</div>
									<div id="plantillaC" class="panel-collapse collapse">
										<div class="panel-body" id="plantillaCTP">
										</div>
									</div>
								</div>
								<?php /* <?php if( count($PlantillasCEC) == 0 ): ?>
								<div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
											<a class="collapsed" data-toggle="collapse" data-parent="#CrearPlantilla" href="#plantillaCEC">
												<i class="fa fa-angle-right"></i> Plantillas guardadas <i class="fa fa-star"></i>
											</a>
										</h4>
									</div>
									<div id="plantillaCEC" class="panel-collapse collapse">
										<div class="panel-body" id="plantCEC">
											<div class="row">
												<?php foreach($PlantillasCEC as $Plantilla): ?>
													<div class="col-sm-4 col-md-3">
														<div class="thumbnail" style="margin-bottom: 20px; border: 2px solid #363B3F; background-color: #f2f2f2;">
															<div class="caption">
																<h3 style="height: 50px;"><?php echo $Plantilla->nombre; ?></h3>
															</div>
															<div class="caption">
																<button type="button" class="btn btn-success btnSelectionP tooltips" data-idP="<?php echo $Plantilla->id; ?>" id="btnSelectionP" data-toggle="tooltip" data-original-title="Seleccionar" data-nombre="nombre_de_plantilla">
																	<!--Seleccionar-->
																	<i class="fa fa-check"></i>
																</button>
																<a href="https://google.com" class="btn btn-primary tooltips disabled" target="_blank" id="btnVisualP" data-toggle="tooltip" data-original-title="Previsualizar">
																	<!--Previsualizar-->
																	<i class="fa fa-eye"></i>
																</a>
															</div>
														</div>
													</div>
												<?php endforeach; ?>
												<div class="col-md-2"></div>
											</div>
										</div>
									</div>
								</div>
								<?php endif; ?> */ ?>
							<!--</div>-->
						</div>
					</div>
					<ul class="pager wizard">
						<li class="previous">
							<a href="javascript:void(0);">
								Anterior
							</a>
						</li>
						<li class="next">
							<a href="javascript:void(0);">
								Siguiente
							</a>
							<button class="btn btn-success" style="display: none; float: right;">Finalizar y agregar secuencia de seguimiento</button>
						</li>
						<!--<li class="finish">
							<a href="javascript:void(0);">Finalizar y agregar secuencia de seguimiento</a>
						</li>-->
					</ul>
					<?php /* <div class="bottom">
						<button id="btnPreview" type="button" class="btn btn-default tooltips" onclick="PruebaEnvio()" data-toggle="tooltip" data-original-title="Realiza una prueba del envío del mensaje"> <i class="fa fa-eye"></i> </button>
						<?php echo Form::button('Guardar', array('class' => 'btn btn-primary', 'id' => 'btnAgregar', 'type' => 'submit')); ?>

						<?php echo HTML::linkRoute('SysWebEmailMarketingListasSubscriptoresSecuenciasSeguimientos', 'Cancelar', array($ListaEmail->id), array('class' => 'btn btn-default')); ?>

					</div> */ ?>
				<?php echo Form::close(); ?>

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

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

<?php echo HTML::script('image-picker/image-picker.min.js'); ?>

<?php /* HTML::script('SysWeb/SumeClientes/php.js') */ ?>
<?php echo HTML::script('bootstrap-select/js/bootstrap-select.min.js'); ?>

<?php echo HTML::script('bootstrap-select/js/i18n/defaults-es_CL.min.js'); ?>

<?php /* HTML::script('WebPro/plugins/dropzone/dropzone.min.js') */ ?>
<?php echo HTML::script('WebPro/plugins/bootstrap-wizard/bootstrap-wizard.min.js'); ?>

<?php /* HTML::script('emojionearea/dist/emojionearea.min.js') */ ?>
<?php echo HTML::script('jQueryValidate/jquery.validate.min.js'); ?>

<?php echo HTML::script('jQueryValidate/additional-methods.min.js'); ?>

<?php echo HTML::script('jQueryValidate/jquery.validationEngine-es.js'); ?>

<?php echo HTML::script('jQueryValidate/messages_es.min.js'); ?>

<?php echo HTML::script('jquery-ezdz/jquery.ezdz.min.js'); ?>

<?php echo HTML::script('Alphanum/jquery.alphanum.min.js'); ?>

<script type="text/javascript">
	function AgregarTexto(slug){
		var slug = slug;
		slug = "{ "+slug+" }";
		var txtAsunto = $("#asunto");
		var caretPos = txtAsunto[0].selectionStart;
		var textAreaTxt = txtAsunto.val();
		var txtToAdd = slug;
		txtAsunto.val(textAreaTxt.substring(0, caretPos) + txtToAdd + textAreaTxt.substring(caretPos));
	}
	function vistaPrevia(id){
		var id = id;
		var mensaje = "<div class='row'> \
			<div class='col-xs-12'> \
				<div class='viewports'>\
					<ul class='viewlist' >\
						<!-- li id='liTi' class='480px resolucion' style=' title='Vista previa en teléfonos inteligentes'>\
							<i class='fa fa-mobile'></i>\
						</li -->\
						<li id='liT' class='800px resolucion' style=' title='Vista previa en teléfonos inteligentes'>\
							<i class='fa fa-mobile'></i>\
						</li >\
						<li id='liC' class='1280px resolucion' style=' title='Vista previa computadoras'>\
							<i class='fa fa-laptop'></i>\
						</li>\
					</ul>\
				</div>\
				<div class='iframe-container'> \
					<iframe id='VistaPreviaIframe' src='#' name='VistaPreviaIframe'></iframe> \
				</div> \
			</div> \
		</div>";
		BootstrapDialog.show({
			title: "Vista previa",
			type: BootstrapDialog.TYPE_PRIMARY,
			size: BootstrapDialog.SIZE_WIDE,
			message: mensaje,
			draggable: true,
			cssClass: "VistaPrevia modal-desktop",
			onshown: function(dialogRefs){
				var ventana = dialogRefs.getModalBody();
				ventana.find(".iframe-container").isLoading({
					text:       "La vista previa está cargando...",
					position:   "overlay"
				});
				ventana.find('.glyphicon').removeClass("glyphicon-refresh glyphicon-spin").addClass("fa fa-spinner fa-pulse fa-fw i-cargador");
				var movil = false;
				var ruta = "<?php echo URL::route('SysWebEmailMarketingPlantillasCECVistaPrevia'); ?>";
				var iframe = ventana.find("#VistaPreviaIframe");
				var doc = ventana.find("#VistaPreviaIframe")[0].contentWindow.document;
				doc.open();
				doc.write("");
				doc.close();
				obtenerCodigoCE(id, ruta, ventana, movil);
				ventana.find(".resolucion").click(function (){
					var idR = $(this).attr("id");
					if(idR == "liC"){
						$(this).closest(".VistaPrevia").removeClass("modal-movil modal-tablet modal-desktop portrait").addClass("modal-desktop");
					}
					else if(idR == "liTi"){
						$(this).closest(".VistaPrevia").removeClass("modal-movil modal-tablet modal-desktop portrait").addClass("modal-movil portrait");
						movil = true;
					}
					else{
						$(this).closest(".VistaPrevia").removeClass("modal-movil modal-tablet modal-desktop portrait").addClass("modal-tablet portrait");
						movil = true;
					}
					obtenerCodigoCE(id, ruta, ventana, movil);
					ventana.find("#VistaPreviaIframe").removeAttr("style");
				});
			},
			/*buttons: [{
				id: "btnCerrar",
				label: "Cerrar",
				cssClass: "btn-default",
				action: function(dialogItself){
					dialogItself.close();
				}
			}]*/
		});
	}
	function obtenerCodigoCE(id, ruta, obj, movil) {
		var id = id;
		var ruta = ruta;
		var obj = obj
		var movil = movil;
		var doc = obj.find("#VistaPreviaIframe")[0].contentWindow.document;
		doc.open();
		doc.write("");
		doc.close();
		$.post(
			ruta,
			{ idP: id, mobile:movil},
			function(data){
				$(".VistaPrevia").find(".iframe-container").isLoading( "hide" );
				if(data.success){
					var iframe = obj.find("#VistaPreviaIframe");
					var doc = iframe[0].contentWindow.document;
					doc.open();
					doc.write("<!DOCTYPE HTML>"+data.codigoHTML);
					doc.close();
				}
				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'); ?>
$(".aCETextoPlano").click(function(e){
	e.preventDefault();
	var mensaje = '<form action="#" id="frnCrearSecuencia"> \
		<div class="form-group" style="margin-bottom: 0px;"> \
			<label> ¿Seguro que deseas crear tu correo con texto plano? </label> \
			<div class="alert alert-info" role="alert" style="margin-bottom: 0px;"> \
				Los correos de texto plano tienden a ser más leídos ya que tienen el mismo formato de los correos que recibes de tus familiares o amigos y no parecen un correo comercial. \
				<br><br> \
				Al seleccionar crear tu correo con texto plano no podrás cambiar la plantilla para este correo en el futuro. \
			</div> \
		</div> \
		<!--<input type="hidden" name="tipo" value="TP">--> \
	</form>';
	BootstrapDialog.show({
		cssClass: "mdAvatar",
		title: "Creación de secuencia de seguimiento",
		message: mensaje,
		draggable: true,
		buttons: [{
			id: "btnAgrgarP",
			label: "Empezar",
			cssClass: "btn-success btn-lg btn-block",
			action: function(dialogItself){
				$("#btnAgrgarP").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Procesando...');
				$.isLoading({ text: "Cargando..." }); NProgress.start();
				var formData = new FormData(document.getElementById("frmAgregar"));
				//formData.append("tipo", $("#frnCrearSecuencia").find('[name="idP"]').val());
				$.ajax({
					type: "POST",
					url: "<?php echo URL::route('SysWebEmailMarketingListasSubscriptoresSecuenciasSeguimientosAgregarV2TP', array($ListaEmail->id)); ?>",
					data: formData,
					cache: false,
					contentType: false,
					processData: false,
					dataType: "json",
					success: function(data){
						$.isLoading("hide"); NProgress.done();
						$("#btnAgrgarP").prop("disabled", false).html("Empezar");
						if(data.success){
							new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
							setTimeout( function(){ window.location.href = data.ruta; }, 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(""); } });
						}
					},
					error: function(jqXHR, textStatus, errorThrown){
						new PNotify({ title: "Error", text: textStatus + " " + errorThrown, type: "error" });
					}
				});
			}
		}]
	});
});
$(".flInput").each(function(e){
	$(this).ezdz({
		text: "<i class='fa fa-paperclip'></i>",
		validators: {
			maxSize: 5500000
		},
		previewImage: false
	});
});
$("[name='suscriptores']").click(function(e){
	if($(this).val() == "T"){
		$("#dvSegmentoEtiquetas").hide("slow");
		$("#etiquetas option:selected").removeAttr("selected");
		$("#etiquetas").selectpicker("refresh");
		$("#dvEtiquetas").html("");
		$("#etiquetas").rules("remove");
	}
	else{
		$("#dvSegmentoEtiquetas").show("slow");
		$("#etiquetas").rules("add", {
			required: true,
			minlength: 1
		});
	}
});
$("#etiquetas").selectpicker({
	container: "body"
}).on("changed.bs.select", function(e){
	$("#dvEtiquetas").html("");
	$.each(
		$(this).val(),
		function(key, value){
			$("#dvEtiquetas").append(' \
				<span class="label label-info" data-valor="'+$("#op"+value).html()+'"> \
					'+$("#op"+value).html()+' \
				</span> &nbsp; \
			');
		}
	);
});
<?php $minDiasDespues = (SecuenciaSeguimiento::where('listas_emails_id', '=', $ListaEmail->id)->count() == 0)?0:1; ?>
$("#dias_despues").TouchSpin({
	min: <?php echo $minDiasDespues; ?>,
	verticalbuttons: true,
	verticalupclass: "glyphicon glyphicon-plus",
	verticaldownclass: "glyphicon glyphicon-minus",
	initval: 0
});
$("#dias_despues").numeric();
/*$("#asunto").emojioneArea({
	//container: $("body")
});*/
$("#frmAgregar").validate({
	lang: "es",
	ignore: [],
	rules: {
		asunto: {
			required: true
		},
		dias_despues: {
			required: true
		},
		suscriptores: {
			required: true
		}
	},
	submitHandler: function(form){
		console.log(";)");
	},
	errorPlacement: function(error, element){
		var mensaje = error.html();
		var id = "err"+error.attr("id").substr(0, error.attr("id").indexOf("-error"));
		$("#"+id).html(mensaje);
	},
	success: function(label, element){
		var id = "err"+label.attr("id").substr(0, label.attr("id").indexOf("-error"));
		$("#"+id).html("");
	}
});
$(".dvConfCorreoSecuencia").bootstrapWizard({
	onInit: function(tab, navigation, index){
		$(".dvConfCorreoSecuencia .progress").addClass("active");
	},
	onTabClick: function(tab, navigation, index){
		return false;
	},
	onTabShow: function(tab, navigation, index){
		var $total = navigation.find("li").length;
		var $current = index+1;
		var $percent = ($current/$total) * 100;
		$(".dvConfCorreoSecuencia .progress-bar").css({
			width: $percent+"%"
		});
	},
	onNext: function(tab, navigation, index){
		console.log( index );
		if( index == 1 ){
			var pasa = true;
			if( $("#frmAgregar").valid() ){
				$('[name="plantillaDeCorreo"]').rules("add", {
					required: true
				});
			}
			else{
				pasa = false;
			}
			return pasa;
		}
	},
	onPrevious: function(tab, navigation, index){
		console.log( index );
		if( index == 0 ){
			$('[name="plantillaDeCorreo"]').rules("remove");
		}
	}
});
$(".btnSelectionP").click(function(){
	//var titulo = $(this).attr("data-nombre");
	var id = $(this).attr("data-idP");
	var mensaje = '<form action="#" id="frnCrearSecuencia"> \
		<div class="form-group" style="margin-bottom: 0px;"> \
			<label> ¿Seguro que deseas seleccionar esta plantilla? </label> \
			<div class="alert alert-info" role="alert" style="margin-bottom: 0px;"> \
				Al seleccionar esta plantilla para tu correo tu podrás cambiar su estructura, modificar los elementos que la componen y agregar nuevas secciones y elementos a esta. Una vez seleccionada no podrás cambiar la plantilla para este correo. \
			</div> \
		</div> \
		<input type="hidden" name="idP" value="'+id+'"> \
	</form>';
	BootstrapDialog.show({
		cssClass: "mdAvatar",
		title: "Creación de secuencia de seguimiento",
		message: mensaje,
		draggable: true,
		buttons: [{
			id: "btnAgrgarP",
			label: "Empezar",
			cssClass: "btn-success btn-lg btn-block",
			action: function(dialogItself){
				$("#btnAgrgarP").prop("disabled", true).html('<i class="fa fa-spinner fa-spin"></i> Procesando...');
				$.isLoading({ text: "Cargando..." }); NProgress.start();
				var formData = new FormData(document.getElementById("frmAgregar"));
				formData.append("idP", $("#frnCrearSecuencia").find('[name="idP"]').val());
				$.ajax({
					type: "POST",
					url: "<?php echo URL::route('SysWebEmailMarketingListasSubscriptoresSecuenciasSeguimientosAgregarV2', array($ListaEmail->id)); ?>",
					data: formData,
					cache: false,
					contentType: false,
					processData: false,
					dataType: "json",
					success: function(data){
						$.isLoading("hide"); NProgress.done();
						$("#btnAgrgarP").prop("disabled", false).html("Empezar");
						if(data.success){
							new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
							setTimeout( function(){ window.location.href = data.ruta; }, 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(""); } });
						}
					},
					error: function(jqXHR, textStatus, errorThrown){
						new PNotify({ title: "Error", text: textStatus + " " + errorThrown, type: "error" });
					}
				});
			}
		}]
	});
});
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>