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

<style type="text/css">
	.image_picker_image{
		height: 260px !important;
		width: 200px !important;
	}
	.mdSegmentacionxEtiquetas .modal-dialog {
		width: 750px;
	}
	#frmReglaAutomatizacionSxE .input-group .input-group-btn button {
		border-radius: 0 !important;
	}
	.dvRegla .bootstrap-select {
		z-index: unset !important;
	}
	.color-head-modal .modal-header {
		background-color: #363b3f !important;
	}
</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"> Crear nueva plantilla de correo electrónico </h3> </div>
			<div class="porlets-content">
				<?php echo Form::open(array('route' => 'SysWebEmailMarketingListasSubscriptoresAgregar', '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 de la plantilla </label>
						<div class="col-sm-9">
							<?php echo Form::text('nombre', '',  array('class' => 'form-control', 'placeholder' => '')); ?>

							<span class="text-danger" id="errnombre"> </span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-3 control-label"> Tipo plantilla </label>
						<div class="col-sm-9">
							<select name="tipo" class="form-control selectpicker">
								<option value="V">Venta</option>
								<option value="R">Relacional</option>
								<option value="C">Comunicación</option>
							</select>
							<span class="text-danger" id="errnombre"> </span>
						</div>
					</div>
					<div class="bottom">
						<?php echo Form::button('Guardar', array('class' => 'btn btn-primary', 'id' => 'btnAgregar', 'type' => 'submit')); ?>

						<?php /* <a href="<?php echo URL::previous(); ?>" class="btn btn-default"> Cancelar </a> */ ?>
						<?php echo HTML::linkRoute('SysWebEmailMarketingPlantillas', 'Cancelar', array(), 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('bootstrap-select/js/bootstrap-select.min.js'); ?>

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

<?php $__env->stopSection(); ?>

<?php $__env->startSection('JSOr'); ?>
$("#frmAgregar").submit(function(e){
	$.isLoading({ text: "Cargando..." }); NProgress.start();
	$("#btnAgregar").html('<i class="fa fa-spinner fa-spin"></i> Cargando').prop("disabled", true);
	e.preventDefault();
	$("input[type='submit']").prop("disabled", true);
	$.post(
		"<?php echo URL::route('SysWebEmailMarketingPlantillasCrear', array()); ?>",
		$("#frmAgregar").serialize(),
		function(data){
			$.isLoading("hide"); NProgress.done();
			$("#btnAgregar").html("Guardar").prop("disabled", false);
			if(data.success){
				var urlRetorno = "<?php echo URL::route('SysWebEmailMarketingPlantillasEditor', array('idPCE')); ?>";
				urlRetorno = urlRetorno.replace("idPCE", data.idPCE);
				new PNotify({ title: "Realizado", text: data.mensaje, type: "success" });
				setTimeout( function(){ window.location.href = urlRetorno; }, 3000 );
			}
			else{
				if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
				$("[id^='err']").html(""); $.each(data.errMensajes, function(key, value){ $("#err"+key).html(value); });
			}
		},
		"json"

	);
});
<?php $__env->stopSection(); ?>
<?php echo $__env->make('BaseSistemaWeb', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>