@extends('BaseSistemaWeb')
@section('CSS')
{{ HTML::style('bootstrap-select/css/bootstrap-select.min.css') }}
{{ HTML::style('jquery-ezdz/jquery.ezdz.min.css') }}
{{ HTML::style('gentemplate/css/min/editor.min.css?=v2.1.0') }}
{{ HTML::style('image-picker/image-picker.css') }}
{{ HTML::style('WebPro/plugins/dropzone/dropzone.css') }}
{{ HTML::style('image-picker/image-picker.css') }}
@stop
@section('Contenido')
{{ Form::open(array('route' => 'SysWebEmailMarketingCampanhasAgregar', 'method' => 'post', 'class' => 'form-horizontal row-border', 'id' => 'frmAgregar')) }}
Elige el tipo de plantilla y selecciona una
@if( count($PlantillasCEC) > 0 )
@foreach($PlantillasCEC as $Plantilla)
{{ $Plantilla->nombre }}
@endforeach
@endif
@foreach($PlantillasV as $Plantilla)
{{ $Plantilla->nombre }}
@if($Plantilla->rutaImagen == '')

@else
 }})
@endif
@endforeach
@foreach($PlantillasR as $Plantilla)
{{ $Plantilla->nombre }}
@if($Plantilla->rutaImagen == '')

@else
 }})
@endif
@endforeach
@foreach($PlantillasC as $Plantilla)
{{ $Plantilla->nombre }}
@if($Plantilla->rutaImagen == '')

@else
 }})
@endif
@endforeach
{{-- @if( count($PlantillasCEC) == 0 )
@foreach($PlantillasCEC as $Plantilla)
@endforeach
@endif --}}
{{--
{{ Form::button('Guardar', array('class' => 'btn btn-primary', 'id' => 'btnAgregar', 'type' => 'submit')) }}
{{ HTML::linkRoute('SysWebEmailMarketingCampanhas', 'Cancelar', array(), array('class' => 'btn btn-default')) }}
--}}
{{ Form::close() }}
@stop
@section('JS')
{{ HTML::script('bootstrap-select/js/bootstrap-select.min.js') }}
{{ HTML::script('bootstrap-select/js/i18n/defaults-es_CL.min.js') }}
{{ HTML::script('WebPro/plugins/bootstrap-wizard/bootstrap-wizard.min.js') }}
{{-- HTML::script('emojionearea/dist/emojionearea.min.js') --}}
{{ HTML::script('jQueryValidate/jquery.validate.min.js') }}
{{ HTML::script('jQueryValidate/additional-methods.min.js') }}
{{ HTML::script('jQueryValidate/jquery.validationEngine-es.js') }}
{{ HTML::script('jQueryValidate/messages_es.min.js') }}
{{ HTML::script('jquery-ezdz/jquery.ezdz.min.js') }}
{{ HTML::script('Alphanum/jquery.alphanum.min.js') }}
{{ HTML::script('jQuery-Text-Counter/textcounter.min.js') }}
@stop
@section('JSOr')
$(".aCETextoPlano").click(function(e){
e.preventDefault();
var mensaje = '
';
BootstrapDialog.show({
cssClass: "mdAvatar",
title: "Creación de campaña",
message: mensaje,
draggable: true,
buttons: [{
id: "btnAgrgarP",
label: "Empezar",
cssClass: "btn-success btn-lg btn-block",
action: function(dialogItself){
$("#btnAgrgarP").prop("disabled", true).html('
Procesando...');
$.isLoading({ text: "Cargando..." }); NProgress.start();
var formData = new FormData(document.getElementById("frmAgregar"));
//formData.append("tipo", $("#frmCrearCampanha").find('[name="idP"]').val());
$.ajax({
type: "POST",
url: "{{ URL::route('SysWebEmailMarketingCampanhasAgregarV2TP', array()) }}",
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: "
",
validators: {
maxSize: 5500000
},
previewImage: false
});
});
$("#listas_emails_id").change(function(){
if($(this).val()!=""){
$('[name="listas_emails_ids[]"]').val( $('[name="listas_emails_id"]').val() );
$.post(
"{{ URL::route('SysWebEmailMarketingCampanhasVerificarCampos') }}",
$("input[name='listas_emails_ids[]']").serialize(),
function(data){
$("#CargandoCampos").hide();
if(data.success){
var Campos = '';
var CamposPreCabecera = '';
for(i=0;i
'+data.campos[i].nombre+' ';
if(data.campos[i].requerido==1){ var label = "success"; }else{ var label = "info"; }
CamposPreCabecera += '
'+data.campos[i].nombre+'
';
}
$("#Campos").html(Campos);
$("#CamposPreCabecera").html(CamposPreCabecera);
}
else{
if(data.mensaje != ''){ new PNotify({ title: "Error", text: data.mensaje, type: "error" }); }
}
},
"json"
);
}
});
$(".selectpicker").selectpicker({
container: "body"
});
$("[name='suscriptores']").click(function(e){
$("#etiquetas option:selected, #etiquetasE option:selected").removeAttr("selected");
$("#etiquetas, #etiquetasE").selectpicker("refresh");
$("#dvEtiquetas, #dvEtiquetasE").html("");
if($(this).val() == "T"){
$("#dvSegmentoEtiquetas").hide("slow");
$("#dvSegmentoEtiquetasE").hide("slow");
//$("#etiquetas option:selected").removeAttr("selected");
//$("#etiquetas").selectpicker("refresh");
//$("#dvEtiquetas, #dvEtiquetasE").html("");
$("#etiquetas").rules("remove");
$("#etiquetasE").rules("remove");
}
else if($(this).val() == "S"){
$("#dvSegmentoEtiquetasE").hide("slow");
$("#dvSegmentoEtiquetas").show("slow");
$("#etiquetas").rules("add", {
required: true,
minlength: 1
});
}
else{
$("#dvSegmentoEtiquetas").hide("slow");
$("#dvSegmentoEtiquetasE").show("slow");
$("#etiquetasE").rules("add", {
required: true,
minlength: 1
});
}
});
$("#etiquetas, #etiquetasE").on("changed.bs.select", function(e){
if( $(this).attr("id") == "etiquetas" ){
var dvEtiquetas = $("#dvEtiquetas");
}
else{
var dvEtiquetas = $("#dvEtiquetasE");
}
dvEtiquetas.html("");
$.each(
$(this).val(),
function(key, value){
dvEtiquetas.append(' \
\
'+$("#op"+value).html()+' \
\
');
}
);
});
$("#frmAgregar").validate({
lang: "es",
ignore: [],
rules: {
nombre: {
required: true
},
asunto: {
required: true
},
dias_despues: {
required: true
},
configuraciones_emails_id: {
required: true
},
listas_emails_id: {
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("");
}
});
$(".dvConfCampanha").bootstrapWizard({
onInit: function(tab, navigation, index){
$(".dvConfCampanha .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;
$(".dvConfCampanha #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");
}
}
});
$('[name="pre_cabecera"]').alphanum({
allow: "@!¡¿?+{}_",
disallow: "",
allowSpace: true,
allowNewline: false,
allowNumeric: true,
allowLatin: true,
allowOtherCharSets: true,
maxLength: 250
});
$(".btnSelectionP").click(function(){
//var titulo = $(this).attr("data-nombre");
var id = $(this).attr("data-idP");
var mensaje = '
';
BootstrapDialog.show({
cssClass: "mdAvatar",
title: "Creación de campaña",
message: mensaje,
draggable: true,
closeByBackdrop: false,
buttons: [{
id: "btnAgrgarP",
label: "Empezar",
cssClass: "btn-success btn-lg btn-block",
action: function(dialogItself){
$("#btnAgrgarP").prop("disabled", true).html('
Procesando...');
$.isLoading({ text: "Cargando..." }); NProgress.start();
var formData = new FormData(document.getElementById("frmAgregar"));
formData.append("idP", $("#frmCrearCampanha").find('[name="idP"]').val());
$.ajax({
type: "POST",
url: "{{ URL::route('SysWebEmailMarketingCampanhasAgregarV2', array()) }}",
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" });
}
});
}
}]
});
});
$("#asunto").textcounter({
type: "character",
min: 1,
max: 100,
countContainerClass: "text-count-wrapper-t",
counterText: "Caracteres contados: %d",
minimumErrorText: "40 son los caracteres mínimos recomendados",
maximumErrorText: "Ha excedido la cantidad de caracteres recomendados",
countSpaces: true,
countDown: false,
countDownText: "Le restan %d caracteres",
countOverflowText: "La cantidad de caracteres excede los %d",
init: function(el){
barraProgreso("Asunto");
}
});
$("#asunto").on("keyup click blur focus change paste", function(e){
barraProgreso("Asunto");
});
$("#pre_cabecera").textcounter({
type: "character",
min: 0,
max: 250,
countContainerClass: "text-count-wrapper-d",
counterText: "Caracteres contados: %d",
minimumErrorText: "20 son los caracteres mínimos recomendados",
maximumErrorText: "Ha excedido la cantidad de caracteres recomendados",
countSpaces: true,
countDown: false,
countDownText: "Le restan %d caracteres",
countOverflowText: "La cantidad de caracteres excede los %d",
init: function(el){
barraProgreso("preCabecera");
}
});
$("#pre_cabecera").on("keyup click blur focus change paste", function(e){
barraProgreso("preCabecera");
});
@stop