<?php $__env->startSection('CSS'); ?>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.webui-popover/1.2.1/jquery.webui-popover.min.css">
<?php /* HTML::style('WebPro/plugins/bootstrap-colorpicker/css/colorpicker.css') */ ?>
<?php echo HTML::style('bootstrap-colorpicker/css/bootstrap-colorpicker.min.css'); ?>

<?php echo HTML::style('SysWeb/SumeClientes/BootstrapMod.css'); ?>

<?php echo HTML::style('SysWeb/SumeClientes/bootstrap-custom-breakpoint.css'); ?>

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

<style type="text/css">
	.pointer{ cursor:pointer; }
	.Separacion{ display: inline-block; padding: 1px; }
	.disenhador{ background: url(<?php echo asset('SysWeb/SumeClientes/edit-bg.png'); ?>); }
	.colorpicker.dropdown-menu.alpha{ z-index: 500000000; }
	/*.BordesDiv:hover{ border-width: 1px; border-color: blue; border-style: dashed; }*/
	/*.BordesElemento:hover{ border-width: 1px; border-color: blue; border-style: dashed; }*/
	.BordesElemento:hover{ box-shadow: 0px 0px 0px 1px #03ddff; }
	.BordesElemento{ transition: box-shadow 0.3s ease-in-out 0s; }
	.SepararCampos{ display: inline-block; }
	.brd { border:1px solid #000; }
	.placeholder { width:300px; height:50px; background-color:#DDD; }
	.img-biblioteca{ height: 100px; }
	.image_picker_image{ height: 100px !important; width: 119px !important; object-fit: contain; }
	.ModalBiblioteca .modal-dialog { width: 75%; }
	.ModalBiblioteca .modal-dialog .modal-footer{ display: unset !important; border-top: unset !important; }
	.iframeModal .modal-header{ background-color: #363b3f !important;}
	#btn-laptop, #btn-movil {
		font-size: 25px;
		padding-right: 15px;
		padding-left: 15px;
		cursor: pointer;
		opacity: 1;
		position: relative;
	}
	.modal .bootstrap-dialog-header .bootstrap-dialog-close-button{
		display: block !important;
	}
</style>
<?php echo HTML::style('jquery-ezdz/jquery.ezdz.min.css'); ?>

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

<?php echo HTML::style('jQueryUI/NT/jquery-ui.structure.min.css'); ?>

<?php /* HTML::style('VideoJS/video-js.css') */ ?>
<?php /* HTML::script('VideoJS/videojs-ie8.min.js') */ ?>
<?php echo HTML::style('bootstrap-select/css/bootstrap-select.min.css'); ?>

<?php if(isset($_GET["nomin"])): ?>
<?php /* HTML::style('SysWeb/SumeClientes/EditorDeFormularios.css?v='.date('H:i:s')) */ ?>
<?php else: ?>
<?php echo HTML::style('SysWeb/SumeClientes/EditorDeFormularios.min.css?=v2.8.43'); ?>

<?php endif; ?>
<?php echo HTML::style('WebPro/plugins/dropzone/dropzone.css'); ?>

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

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

<?php echo HTML::style('Webui-Popover/jquery.webui-popover.min.css'); ?>

<?php echo HTML::style('VideoJS/video-js.min.css'); ?>

<?php
	/*
	$json = file_get_contents('https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyBHLrXP6aOOUOUmI2oA5vpfnhWQE3r32O8');
	$fonts = json_decode($json);
	foreach($fonts->items as $font){ echo '<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family='.$font->family.'">'; }
	*/
?>
<link id="Adamia" href="//fonts.googleapis.com/css?family=Adamina" rel="stylesheet" type="text/css">
<link id="DancingScript" href="//fonts.googleapis.com/css?family=Dancing+Script" rel="stylesheet" type="text/css">
<link id="DroidSans" href="//fonts.googleapis.com/css?family=Droid+Sans" rel="stylesheet" type="text/css">
<link id="JustAnotherHand" href="//fonts.googleapis.com/css?family=Just+Another+Hand" rel="stylesheet" type="text/css">
<link id="LobsterTwo" href="//fonts.googleapis.com/css?family=Lobster+Two" rel="stylesheet" type="text/css">
<link id="Montserrat" href="//fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<link id="NixieOne" href="//fonts.googleapis.com/css?family=Nixie+One" rel="stylesheet" type="text/css">
<link id="OpenSans" href="//fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css">
<link id="Oswald" href="//fonts.googleapis.com/css?family=Oswald" rel="stylesheet" type="text/css">
<link id="Pacifico" href="//fonts.googleapis.com/css?family=Pacifico" rel="stylesheet" type="text/css">
<link id="ShadowsIntoLightTwo" href="//fonts.googleapis.com/css?family=Shadows+Into+Light+Two" rel="stylesheet" type="text/css">
<link id="TheGirlNextDoor" href="//fonts.googleapis.com/css?family=The+Girl+Next+Door" rel="stylesheet" type="text/css">
<link id="BubblegumSans" href="//fonts.googleapis.com/css?family=Bubblegum+Sans" rel="stylesheet" type="text/css">
<link id="LondrinaSolid" href="//fonts.googleapis.com/css?family=Londrina+Solid" rel="stylesheet" type="text/css">
<link id="RockSalt" href="//fonts.googleapis.com/css?family=Rock+Salt" rel="stylesheet" type="text/css">
<link id="Dosis" href="//fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Acme|Anton|Archivo+Narrow|Arimo|Asap|Bangers|Cabin|Fira+Sans|Indie+Flower|Josefin+Sans|Lato|Luckiest+Guy|Monoton|Nanum+Gothic|Nunito|Orbitron|PT+Sans|Permanent+Marker|Poiret+One|Poppins|Raleway|Roboto|Rubik|Source+Sans+Pro|Ubuntu" rel="stylesheet">
<?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" style="display: inline-block; width: 50%;"> Agregar formulario a <strong> <?php echo $ListaEmail->nombre; ?> </strong> </h3> <div style="width: 40%; display: inline-block;"><span class="fa fa-mobile vista-movil tooltip" title="Vista Móvil" data-toggle="tooltip" id="btn-movil"></span> <span class="fa fa-laptop vista-movil tooltip" data-toggle="tooltip" title="Vista PC" id="btn-laptop"></span></div>  </div>
			<div class="porlets-content">
				<?php echo Form::open(array('route' => array('SysWebEmailMarketingFormulariosAgregar', $ListaEmail->id), 'method' => 'post', 'class' => 'form-horizontal row-border', 'id' => 'frmAgregar', 'files' => true, 'target' => 'upload_iframe')); ?>

					<div class="form-group">
						<label class="col-sm-3 control-label"> Nombre del formulario </label>
						<div class="col-sm-9">
							<?php echo Form::text('nombre_form', '',  array('class' => 'form-control', 'placeholder' => '')); ?>

							<span class="text-danger" id="errnombre_form"> </span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Etiquetas a asociar (Opcional) </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>
					<?php if( $ListaEmail->gestion_clientes == 'P' ): ?>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Producto/Servicio de gestión de prospectos </label>
						<div class="col-sm-9">
							<select class="form-control selectpicker" data-live-search="true" id="producto" name="producto">
								<option value=""> Seleccione un producto o servicio de la gestión de prospectos... </option>
								<?php foreach($ProductosServicio as $indice => $ProductoServicio): ?>
								<option value="<?php echo $ProductoServicio->id; ?>" id="opP<?php echo $ProductoServicio->id; ?>"> <?php echo $ProductoServicio->nombre; ?> </option>
								<?php endforeach; ?>
							</select>
							<span class="text-danger" id="errproducto"> </span>
							<div id="dvEtiquetas" style="padding-top: 10px;"></div>
						</div>
					</div>
					<?php endif; ?>
					<div class="form-group" style="display: none;">
						<label class="col-sm-3 control-label"> Úbicación de agradecimiento </label>
						<div class="col-sm-9">
							<label class="checkbox-inline">
								<input type="checkbox" value="1" id="chUbicacion">
								<span class="custom-checkbox"></span> Deseo que permanezcan en la página
							</label>
						</div>
					</div>
					<div class="form-group" id="dvPagina">
						<label class="col-sm-3 control-label"> Página de agradecimiento </label>
						<div class="col-sm-9">
							<?php echo Form::text('pagina_agradecimiento', '',  array('class' => 'form-control', 'id' => 'pagina_agradecimiento')); ?>

							<span class="text-danger" id="errpagina_agradecimiento"> </span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Opciones visibles </label>
						<div class="col-sm-9" id="OpcionesVisibles">
							<label class="checkbox-inline">
								<input type="checkbox" value="1" id="ch1" checked onclick="Checkes()">
								<span class="custom-checkbox"></span> Título
							</label>
							<label class="checkbox-inline">
								<input type="checkbox" value="2" id="ch2" checked onclick="Checkes()">
								<span class="custom-checkbox"></span> Sub Título
							</label>
							<label class="checkbox-inline">
								<input type="checkbox" value="3" id="ch3" checked onclick="Checkes()">
								<span class="custom-checkbox"></span> Multimedia
							</label>
							<label class="checkbox-inline">
								<input type="checkbox" value="6" id="ch6" checked onclick="Checkes()">
								<span class="custom-checkbox"></span> Pie de formulario
							</label>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Diseño </label>
						<div class="col-sm-9">
							<label class="radio-inline">
								<input type="radio" value="V" id="rdVertical" name="Diseño" onclick="Disenho(this)" checked>
								<span class="custom-radio"></span> Vertical
							</label>
							<label class="radio-inline">
								<input type="radio" value="V2" id="rdVertical2" name="Diseño" onclick="Disenho(this)">
								<span class="custom-radio"></span> Vertical 2
							</label>
							<label class="radio-inline">
								<input type="radio" value="H1" id="rdHorizontal" name="Diseño" onclick="Disenho(this)">
								<span class="custom-radio"></span> Horizontal
							</label>
							<label class="radio-inline">
								<input type="radio" value="H2" id="rdHorizontal2" name="Diseño" onclick="Disenho(this)">
								<span class="custom-radio"></span> Horizontal 2
							</label>
							<label class="radio-inline">
								<input type="radio" value="H3" id="rdHorizontal3" name="Diseño" onclick="Disenho(this)">
								<span class="custom-radio"></span> Horizontal 3
							</label>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Campos disponibles </label>
						<div class="col-sm-9">
							<?php foreach($Campos as $Campo): ?>
							<?php $label = ($Campo->requerido==1)?'success':'info'; ?>
							<div class="Separacion pointer" onclick="AgregarCampo('<?php echo $Campo->slug; ?>', '<?php echo $Campo->nombre; ?>')"> <span class="label label-<?php echo $label; ?>"> <?php echo $Campo->nombre; ?> </span> </div>
							<?php endforeach; ?>
						</div>
					</div>
					<div class="row"></div>
					<!-- <div class="form-group"> -->
						<!-- label class="col-sm-3 control-label"> Diseñador de formulario </label> -->
						<!-- <div class="col-md-5"> -->
						<div class="col-md-8" style="padding: 25px;">
							<div id="disenhador" class="row disenhador" style="padding: 15px;"> </div>
						</div>
						<div class="col-md-4" id="Opciones"> </div>
					</div>
					<!-- <input id="colorpicker" type="text" class="colorpicker-rgba form-control" value="" data-color-format="rgba" onchange="edCuerpoColor(this)"> -->
					<div class="bottom">
						<input type="hidden" id="libraryInput" value="<?php echo asset("Intl-Tel-Input/js/utils.js"); ?>">
						<input type="hidden" id="paisC" value="<?php echo Cliente::select('pais')->where('users_id', '=', Auth::user()->id)->first()->pais; ?>">
						<input type="hidden" id="cid" value="<?php echo Cliente::select('id')->where('users_id', '=', Auth::user()->id)->first()->id; ?>">
						<input type="hidden" id="rutabibliotecascliente" value="<?php echo URL::route('SysWebPAterrizajeBibliotecaImagenesClientes', array('')); ?>/">
						<input type="hidden" id="rutabibliotecasc" value="<?php echo URL::route('SysWebPAterrizajeBibliotecaImagenesSC'); ?>">
						<input type="hidden" id="hdnRutaImagenes" value="<?php echo URL::route('SysWebPAterrizajeGenTemplateImagenes'); ?>">
						<input type="hidden" id="rutaeliminarbiblioteca" value="<?php echo URL::route('SysWebPAterrizajeBibliotecaImagenesClientesEliminar', array(Cliente::select('id')->where('users_id', '=', Auth::user()->id)->first()->id)); ?>">
						<?php echo Form::button('Guardar', array('class' => 'btn btn-primary', 'id' => 'btnAgregar', 'type' => 'submit')); ?>

						<?php echo HTML::linkRoute('SysWebEmailMarketingFormularios', '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 /* HTML::script('WebPro/plugins/ckeditor-new/ckeditor.js') */ ?>
<?php /*<script src="https://cdn.jsdelivr.net/jquery/1.11.3/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.webui-popover/1.2.1/jquery.webui-popover.min.js"></script>*/ ?>
<?php /* HTML::script('WebPro/plugins/bootstrap-colorpicker/js/bootstrap-colorpicker.js') */ ?>
<?php echo HTML::script('jquery-ezdz/jquery.ezdz.min.js'); ?>

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

<?php if(isset($_GET["nomin"])): ?>
	<?php echo HTML::script('SysWeb/SumeClientes/EditorDeFormularios.js?v='.date('H:i:s')); ?>

<?php else: ?>
	<?php echo HTML::script('SysWeb/SumeClientes/EditorDeFormularios.min.js?=v2.8.43'); ?>

<?php endif; ?>
<?php echo HTML::script('jQueryUI/NT/jquery-ui.min.js'); ?>

<?php /* HTML::script('VideoJS/video.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 echo HTML::script('bootstrap-slider/bootstrap-slider.min.js'); ?>

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

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

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

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

<?php echo HTML::script('Webui-Popover/jquery.webui-popover.min.js'); ?>

<?php echo HTML::script('bootstrap-number-input/bootstrap-number-input.js'); ?>

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

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

<script type="text/javascript">
	function Disenho(elemento){
		var Disenho = elemento.value;
		Formulario(Disenho, '<?php echo asset('SysWeb/SumeClientes/Multimedia.png'); ?>', true);
	}
	function VistaPrevia(dispositivo){
		var dispositivo = dispositivo;
		var btnClass = "";
		if(dispositivo == 'TI'){
			var mobile = true;
			var titulo = "Vista previa en teléfono inteligente";
			var clase = "modal-movil portrait";
		}
		else if(dispositivo == 'C'){
			var mobile = false;
			var titulo = "Vista previa en computadoras"
			var clase = "modal-desktop";
			btnClass = "hide";
		}
		$.isLoading({ text: "Cargando..." }); NProgress.start();
		htmlModal = '<div id="dvContenedoriFrame"  class="iframe-container" >\
			<iframe id="iFCodigoHTML" src="#" name="iFCodigoHTML"></iframe>\
		</div>';
		var jsonPostIframe = { 
			codigoHTML: '<section class="block-movable editable section configurado" style="padding: 20px 0; height: 100%;">\
				<div class="container" style="height: inherit;">\
					<div class="row el-sortable2 ui-sortable" style="height: inherit;">\
						<div class="col-xs-12 col-sm-4 col-md-4 vacio el-movable column">\
							<div class="row el-sortable3 ui-sortable"></div>\
						</div>\
						<div class="col-xs-12 col-sm-4 col-md-4 el-movable column" style="height: inherit; display: table; position: relative;">\
							<div class="row el-sortable3 ui-sortable" style="margin-right: 0px; margin-left: 0px; vertical-align: middle; display: table-cell;">\
								<div class="col-xs-12 col-sm-12 col-md-12 el-movable">\
									<div class="resize center-block text-center editable formulario ui-resizable configurado" style="padding-top: 10px; padding-bottom: 10px;">\
										'+$("#codigo_html").html()+'\
									</div>\
								</div>\
							</div>\
						</div>\
						<div class="col-xs-12 col-sm-4 col-md-4 vacio el-movable column">\
							<div class="row el-sortable3 ui-sortable"></div>\
						</div>\
					</div>\
				</div>\
			</section>', 
			mobile: false
		}
		$.post(
			"<?php echo URL::route('SysWebPAterrizajePlantillaxClienteVeriFrame', array(0)); ?>",
			jsonPostIframe,
			function(data){
				$.isLoading("hide"); NProgress.done();
				if(data.success){
					BootstrapDialog.show({
						title: titulo,
						type: BootstrapDialog.TYPE_PRIMARY,
						message: htmlModal,
						size: BootstrapDialog.SIZE_WIDE,
						draggable: true,
						cssClass: clase + " color-head-modal iframeModal",
						onshown: function(modalDialog){
							ventanaIframe = modalDialog.getModalBody();
							var iframe = ventanaIframe.find("#iFCodigoHTML");
							var doc = iframe[0].contentWindow.document;
							doc.open();
							doc.write("<!DOCTYPE HTML>"+data.codigoHTML);
							doc.close();
						},
						buttons: 
							[
								{
									id: "btnModal",
									label: " Rotar",
									cssClass: "btn btn-primary " + btnClass ,
									action: function(dialogItself){
										var modalIframe = $(".iframeModal");
										if( modalIframe.hasClass("portrait") ){
											modalIframe.removeClass("portrait").addClass("landscape");
										}
										else{
											modalIframe.removeClass("landscape").addClass("portrait");
										}
									}
								},
							],
						onhide: function(modal){
							$("#printable").find('.sidebar').css({"pointer-events": "none", "opacity" : "0.5"});
						}
					});
				}
				else{
					if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
				}
			},
			"json"
		);
	}
</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
$("#etiquetas").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; \
			');
		}
	);
});
$(".sidebar-toggle-box").trigger("click");
Formulario('V', '<?php echo asset('SysWeb/SumeClientes/Multimedia.png'); ?>', false);
$(window).keydown(function(event){
	if(event.keyCode == 13) {
		event.preventDefault();
		return false;
	}
});
$("#chUbicacion").click(function(){
	if($("#chUbicacion").is(":checked")){ $("#pagina_agradecimiento").val(""); $("#dvPagina").hide("slow"); }
	else{ $("#dvPagina").show("slow"); }
});
$("#frmAgregar").submit(function(e){
	$.isLoading({ text: "Cargando..." }); NProgress.start();
	$('[id^="err"]').html("");
	$("#btnAgregar").html('<i class="fa fa-spinner fa-spin"></i> Cargando').prop("disabled", true);
	e.preventDefault();
	$(".menu-bt").remove();
	$("#codigo_html").find(".intl-tel-input").each(function(){
		var input = $(this).find("input").prop("outerHTML");
		$(this).prop("innerHTML", input);
	});
	var frmAgregar = new FormData(document.getElementById("frmAgregar"));
	frmAgregar.append("codigo_html", $("#codigo_html").html().trim());
	$.ajax({
		type: "POST",
		url: "<?php echo URL::route('SysWebEmailMarketingFormulariosAgregar', array($ListaEmail->id)); ?>",
		data: frmAgregar,
		cache: false,
		contentType: false,
		processData: false,
		dataType: "json",
		success: function(data){
			$.isLoading("hide"); NProgress.done();
			$("#btnAgregar").html("Guardar").prop("disabled", false);
			if(data.success){
				new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
				setTimeout( function(){ window.location.href = "<?php echo URL::route('SysWebEmailMarketingFormularios', array($ListaEmail->id)); ?>"; }, 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" });
		}
	});
});
$("#btn-laptop").on("click", function(){
	VistaPrevia("C");
});
$("#btn-movil").on("click", function(){
	VistaPrevia("TI");
});
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>