",{"class":"amaran-wrapper-inner"}).appendTo(h)),"object"==typeof this.config.content?c=null!=this.config.themeTemplate?this.config.themeTemplate(this.config.content):e[this.config.theme.split(" ")[0]+"Theme"](this.config.content):(this.config.content={},this.config.content.message=this.config.message,this.config.content.color="#27ae60",c=e.defaultTheme(this.config.content)),i={"class":this.config.themeTemplate?"amaran "+this.config.content.themeName:this.config.theme&&!this.config.themeTemplate?"amaran "+this.config.theme:"amaran",html:this.config.closeButton?'
",i).appendTo(s),"center"===o[0]&&this.centerCalculate(h,s),this.animation(this.config.inEffect,a,"show"),this.config.onClick&&(n=this,t(a).on("click",function(i){return t(i.target).is(".amaran-close")?void i.preventDefault():void n.config.onClick()})),this.config.sticky!==!0&&this.hideDiv(a)},centerCalculate:function(t,i){var n,e,o;e=i.find(".amaran").length,o=i.height(),n=(t.height()-o)/2,i.find(".amaran:first-child").animate({"margin-top":n},200)},animation:function(t,i,n){return"fadeIn"===t||"fadeOut"===t?this.fade(i,n):"show"===t?this.cssanimate(i,n):this.slide(t,i,n)},fade:function(t,i){var n;return n=this,"show"===i?this.config.cssanimationIn?t.addClass("animated "+this.config.cssanimationIn).show():t.fadeIn():this.config.cssanimationOut?(t.addClass("animated "+this.config.cssanimationOut),t.css({"min-height":0,height:t.outerHeight()}),void t.animate({opacity:0},function(){t.animate({height:0},function(){n.removeIt(t)})})):(t.css({"min-height":0,height:t.outerHeight()}),void t.animate({opacity:0},function(){t.animate({height:0},function(){n.removeIt(t)})}))},removeIt:function(i){var n,e;clearTimeout(this.timeout),i.remove(),e=t(this.config.wrapper+"."+this.config.position.split(" ")[0]+"."+this.config.position.split(" ")[1]),n=e.find(".amaran-wrapper-inner"),"center"===this.config.position.split(" ")[0]&&this.centerCalculate(e,n),this.config.afterEnd()},getWidth:function(t){var i,n;return i=t.clone().hide().appendTo("body"),n=i.outerWidth()+i.outerWidth()/2,i.remove(),n},getInfo:function(i){var n,e;return n=i.offset(),e=t(this.config.wrapper).offset(),{t:n.top,l:n.left,h:i.height(),w:i.outerWidth(),wT:e.top,wL:e.left,wH:t(this.config.wrapper).outerHeight(),wW:t(this.config.wrapper).outerWidth()}},getPosition:function(n,e){var o,a,s;return o=this.getInfo(n),a=this.config.position.split(" ")[1],s={slideTop:{start:{top:-(o.wT+o.wH+2*o.h)},move:{top:0},hide:{top:-(o.t+2*o.h)},height:o.h},slideBottom:{start:{top:t(i).height()-o.wH+2*o.h},move:{top:0},hide:{top:t(i).height()-o.wH+2*o.h},height:o.h},slideLeft:{start:{left:"left"===a?1.5*-o.w:-t(i).width()},move:{left:0},hide:{left:"left"===a?1.5*-o.w:-t(i).width()},height:o.h},slideRight:{start:{left:"right"===a?1.5*o.w:t(i).width()},move:{left:0},hide:{left:"right"===a?1.5*o.w:t(i).width()},height:o.h}},s[e]?s[e]:0},slide:function(t,i,n){var e,o;return o=this.getPosition(i,t),"show"!==n?(e=this,i.animate(o.hide,function(){i.css({"min-height":0,height:o.height},function(){i.html(" ")})}).animate({height:0},function(){return e.removeIt(i)})):void i.show().css(o.start).animate(o.move)},close:function(){var i;return i=this,t("[data-amaran-close]").on("click",function(){i.animation(i.config.outEffect,t(this).closest("div.amaran"),"hide")}),!this.config.closeOnClick&&this.config.closeButton?void i.animation(i.config.outEffect,t(this).parent("div.amaran"),"hide"):void(this.config.closeOnClick&&t(".amaran").on("click",function(){i.animation(i.config.outEffect,t(this),"hide")}))},hideDiv:function(t){var i;i=this,i.timeout=setTimeout(function(){i.animation(i.config.outEffect,t,"hide")},i.config.delay)}},e={defaultTheme:function(t){var i;return i="","undefined"!=typeof t.color&&(i=t.color),"
"+t.message+"
"},awesomeTheme:function(t){return'
'+t.title+"
"+t.message+''+t.info+"
"},userTheme:function(t){return'
'+t.user+""+t.message+"
"},colorfulTheme:function(t){var i,n;return"undefined"!=typeof t.color&&(n=t.color),"undefined"!=typeof t.bgcolor&&(i=t.bgcolor),"
"+t.message+"
"},tumblrTheme:function(t){return'
'+t.title+'
'+t.message+"
"}},t.amaran=function(t){var i;return i=new n(t)},t.amaran.close=function(){return t(".amaran-wrapper").remove(),!1}}(jQuery,window,document)}).call(this);
function cuerponoti(mensaje,color){
$(function(){
$.amaran({
content:{
bgcolor :color,
color :'#ffffff',
message :mensaje
},
position :'top right',
'inEffect' :'slideTop',
'outEffect' :'slideTop',
theme :'colorful'
});
});
}
function cuerponoti_persistente(mensaje,color){
$(function(){
$.amaran({
content:{
bgcolor :color,
color :'#ffffff',
message :mensaje
},
position :'top right',
'inEffect' :'slideTop',
'outEffect' :'slideTop',
theme :'colorful',
closeButton : false,
'sticky' : true
});
});
}
var verde = "rgba(66, 211, 109, 0.8)"; //sucess
var rojo = "rgba(211, 86, 66, 0.8)"; //error
var naranja = "rgba(211, 182, 66, 0.8)"; //advertence
switch(idnotificacion){
case 'color_update':
var mensaje = "Color guardado correctamente.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'guardado':
var mensaje = "Guardado correctamente.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'eliminado':
var mensaje = "Eliminado correctamente.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'modificado':
var mensaje = "Modificado correctamente.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'error_guardando':
var mensaje = "No se ha podido guardar la información. Inténtelo de nuevo pasado un tiempo.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'error_eliminando':
var mensaje = "No se ha podido eliminar. Inténtelo de nuevo pasado un tiempo..";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'solo_png':
var mensaje = "Sólo se admiten imágenes en formato PNG.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'img_eliminada':
var mensaje = "Imágen eliminada correctamente.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'img_noeliminada':
var mensaje = "La imágen no se ha eliminado.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'campos_incorrectos':
var mensaje = "Hay campos incorrectos. Revíselos e inténtelo de nuevo.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'rellene_campos':
var mensaje = "Rellene todos los campos.";
var color = naranja;
cuerponoti(mensaje, color);
break;
case 'suceso_activo_modificado':
var mensaje = "Suceso activo modificado.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'suceso_desactivo_modificado':
var mensaje = "Suceso desactivado modificado.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'fechas_incorrectas':
var mensaje = "Las fechas introducidas no son correctas.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'error_no_esperado':
var mensaje = "Se produjo un error no esperado. Por favor, póngase en contacto con el administrador del sistema.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'solapamiento_multiple':
var mensaje = "Está intentando modificar mas de un intervalo de fechas.
Modifique las fechas individualmente";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'seleccione_dispositivos':
var mensaje = "Seleccione un dispositivo o más.";
var color = naranja;
cuerponoti(mensaje, color);
break;
case 'error_consulta':
var mensaje = "Error tramitando la consulta.Inténtelo más tarde.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'advertencia_potencia_periodo':
var mensaje = "Las potencias definidas no son correctas, por favor, revíselo";
var color = naranja;
cuerponoti(mensaje, color);
break;
case 'informe_activado':
var mensaje = "Recibirá el informe todos los lunes.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'informe_desactivado':
var mensaje = "Dejará de recibir el informe todos los lunes.";
var color = verde;
cuerponoti(mensaje, color);
break;
case 'error_login':
var mensaje = "Usuario o password incorrecto. Inténtelo de nuevo.";
var color = rojo;
cuerponoti(mensaje, color);
break;
case 'error_cookies':
var mensaje = "Su navegador no tiene las COOKIES habilitadas.Necesita habilitarlas para poder acceder a la aplicación.";
var color = rojo;
cuerponoti_persistente(mensaje, color);
break;
}
}
function notificacion_msj(idnotificacion, mensaje){
(function(){!function(t,i){var n,e;return n=function(i){var n;n={position:"bottom right",content:" ",delay:10e3,sticky:!1,inEffect:"fadeIn",outEffect:"fadeOut",theme:"default",themeTemplate:null,closeOnClick:!0,closeButton:!1,clearAll:!1,cssanimationIn:!1,cssanimationOut:!1,beforeStart:function(){},afterEnd:function(){},onClick:function(){},wrapper:".amaran-wrapper"},this.config=t.extend({},n,i),this.config.beforeStart(),this.init(),this.close()},n.prototype={init:function(){var i,n,o,a,s,c,h,r;h=null,r=null,o=this.config.position.split(" "),t(this.config.wrapper).length&&t(this.config.wrapper).hasClass(this.config.position)?(h=t(this.config.wrapper+"."+o[0]+"."+o[1]),s=h.find(".amaran-wrapper-inner")):(h=t("
",{"class":this.config.wrapper.substr(1,this.config.wrapper.length)+" "+this.config.position}).appendTo("body"),s=t("
",{"class":"amaran-wrapper-inner"}).appendTo(h)),"object"==typeof this.config.content?c=null!=this.config.themeTemplate?this.config.themeTemplate(this.config.content):e[this.config.theme.split(" ")[0]+"Theme"](this.config.content):(this.config.content={},this.config.content.message=this.config.message,this.config.content.color="#27ae60",c=e.defaultTheme(this.config.content)),i={"class":this.config.themeTemplate?"amaran "+this.config.content.themeName:this.config.theme&&!this.config.themeTemplate?"amaran "+this.config.theme:"amaran",html:this.config.closeButton?'
'+c:c},this.config.clearAll&&t(".amaran").remove(),a=t("
",i).appendTo(s),"center"===o[0]&&this.centerCalculate(h,s),this.animation(this.config.inEffect,a,"show"),this.config.onClick&&(n=this,t(a).on("click",function(i){return t(i.target).is(".amaran-close")?void i.preventDefault():void n.config.onClick()})),this.config.sticky!==!0&&this.hideDiv(a)},centerCalculate:function(t,i){var n,e,o;e=i.find(".amaran").length,o=i.height(),n=(t.height()-o)/2,i.find(".amaran:first-child").animate({"margin-top":n},200)},animation:function(t,i,n){return"fadeIn"===t||"fadeOut"===t?this.fade(i,n):"show"===t?this.cssanimate(i,n):this.slide(t,i,n)},fade:function(t,i){var n;return n=this,"show"===i?this.config.cssanimationIn?t.addClass("animated "+this.config.cssanimationIn).show():t.fadeIn():this.config.cssanimationOut?(t.addClass("animated "+this.config.cssanimationOut),t.css({"min-height":0,height:t.outerHeight()}),void t.animate({opacity:0},function(){t.animate({height:0},function(){n.removeIt(t)})})):(t.css({"min-height":0,height:t.outerHeight()}),void t.animate({opacity:0},function(){t.animate({height:0},function(){n.removeIt(t)})}))},removeIt:function(i){var n,e;clearTimeout(this.timeout),i.remove(),e=t(this.config.wrapper+"."+this.config.position.split(" ")[0]+"."+this.config.position.split(" ")[1]),n=e.find(".amaran-wrapper-inner"),"center"===this.config.position.split(" ")[0]&&this.centerCalculate(e,n),this.config.afterEnd()},getWidth:function(t){var i,n;return i=t.clone().hide().appendTo("body"),n=i.outerWidth()+i.outerWidth()/2,i.remove(),n},getInfo:function(i){var n,e;return n=i.offset(),e=t(this.config.wrapper).offset(),{t:n.top,l:n.left,h:i.height(),w:i.outerWidth(),wT:e.top,wL:e.left,wH:t(this.config.wrapper).outerHeight(),wW:t(this.config.wrapper).outerWidth()}},getPosition:function(n,e){var o,a,s;return o=this.getInfo(n),a=this.config.position.split(" ")[1],s={slideTop:{start:{top:-(o.wT+o.wH+2*o.h)},move:{top:0},hide:{top:-(o.t+2*o.h)},height:o.h},slideBottom:{start:{top:t(i).height()-o.wH+2*o.h},move:{top:0},hide:{top:t(i).height()-o.wH+2*o.h},height:o.h},slideLeft:{start:{left:"left"===a?1.5*-o.w:-t(i).width()},move:{left:0},hide:{left:"left"===a?1.5*-o.w:-t(i).width()},height:o.h},slideRight:{start:{left:"right"===a?1.5*o.w:t(i).width()},move:{left:0},hide:{left:"right"===a?1.5*o.w:t(i).width()},height:o.h}},s[e]?s[e]:0},slide:function(t,i,n){var e,o;return o=this.getPosition(i,t),"show"!==n?(e=this,i.animate(o.hide,function(){i.css({"min-height":0,height:o.height},function(){i.html(" ")})}).animate({height:0},function(){return e.removeIt(i)})):void i.show().css(o.start).animate(o.move)},close:function(){var i;return i=this,t("[data-amaran-close]").on("click",function(){i.animation(i.config.outEffect,t(this).closest("div.amaran"),"hide")}),!this.config.closeOnClick&&this.config.closeButton?void i.animation(i.config.outEffect,t(this).parent("div.amaran"),"hide"):void(this.config.closeOnClick&&t(".amaran").on("click",function(){i.animation(i.config.outEffect,t(this),"hide")}))},hideDiv:function(t){var i;i=this,i.timeout=setTimeout(function(){i.animation(i.config.outEffect,t,"hide")},i.config.delay)}},e={defaultTheme:function(t){var i;return i="","undefined"!=typeof t.color&&(i=t.color),"
"+t.message+"
"},awesomeTheme:function(t){return'
'+t.title+"
"+t.message+''+t.info+"
"},userTheme:function(t){return'
'+t.user+""+t.message+"
"},colorfulTheme:function(t){var i,n;return"undefined"!=typeof t.color&&(n=t.color),"undefined"!=typeof t.bgcolor&&(i=t.bgcolor),"
"+t.message+"
"},tumblrTheme:function(t){return'
'+t.title+'
'+t.message+"
"}},t.amaran=function(t){var i;return i=new n(t)},t.amaran.close=function(){return t(".amaran-wrapper").remove(),!1}}(jQuery,window,document)}).call(this);
function cuerponoti(mensaje,color){
$(function(){
$.amaran({
content:{
bgcolor :color,
color :'#ffffff',
message :mensaje
},
position :'top right',
'inEffect' :'slideTop',
'outEffect' :'slideTop',
theme :'colorful'
});
});
}
function cuerponoti_persistente(mensaje,color){
$(function(){
$.amaran({
content:{
bgcolor :color,
color :'#ffffff',
message :mensaje
},
position :'top right',
'inEffect' :'slideTop',
'outEffect' :'slideTop',
theme :'colorful',
closeButton : false,
'sticky' : true
});
});
}
var verde = "rgba(66, 211, 109, 0.8)"; //sucess
var rojo = "rgba(211, 86, 66, 0.8)"; //error
var naranja = "rgba(211, 182, 66, 0.8)"; //advertence
switch(idnotificacion){
case 'success':
var mensaje = mensaje;
var color = verde;
cuerponoti(mensaje, color);
break;
case 'warning':
var mensaje = mensaje;
var color = naranja;
cuerponoti(mensaje, color);
break;
case 'error':
var mensaje = mensaje;
var color = rojo;
cuerponoti(mensaje, color);
break;
}
}