class _Lang{
constructor(langs, prefix, locale){
this.langs = langs;
this.prefix = prefix;
this.locale = locale;
}
getPrefix(){
return this.prefix;
}
get(key) {
if (this.langs[key])
return this.langs[key];
if(localStorage.getItem("log_lang") == 1) console.log("LANG MISSING: " + key);
return key;
}
getAll() {
return this.langs;
}
}
const LANG = new _Lang(appConfig.jsLang, appConfig.jsLangPrefix, appConfig.jsLangLocale);
var BS = new (function () {
var icon = function (name, cls) {
return '';
}
var faicon = function (name, cls) {
return '';
}
return {
icon: icon,
faicon: faicon,
actions : function( lis ){
var buttons = '';
for ( var i in lis ){
buttons += lis[i] == 'divider' ? '
' : '' + lis[i] + '';
}
if( buttons ){
return ''
+ ''
+ ''
+ '
';
}
return '';
}
}
})
var USER = new (function () {
var can = function ( op, subop = null ){
if(appConfig.isAdmin){
return true;
}
var allowed = appConfig.allowed_ops,
route = op + (subop ? "/" + subop : "") ;
for ( var i in allowed){
if( allowed[i] == route){
return true;
}
}
return false;
}
return {
can : can
}
})();
var MESSAGES = (function(){
var def = {
placement: {
from: 'bottom',
align: 'left'
},
animate: {
enter: 'animated fadeIn',
exit: 'animated fadeOut'
},
offset: {
x: 20,
y: 20
},
delay: 6000,
allow_dismiss: true,
icon_type: 'class',
z_index: 1051,
template: '' + '
' + '
' + '
{1}' + '
{2}' + '
' + '
' + '
'
};
return{
add : function( config ){
$.notify(config, $.extend(false, def, config));
},
danger : function( msg, config ){
this.add( $.extend(false, { message : msg, type : 'danger' }, config))
},
success : function( msg, config ){
this.add( $.extend(false, { message : msg, type : 'success' }, config))
},
warning : function( msg, config ){
this.add( $.extend(false, { message : msg, type : 'warning' }, config))
},
info : function( msg, config ){
this.add( $.extend(false, { message : msg, type : 'info' }, config))
}
}
}())