(function(){varc,m,g;g=[function(t){return"groupBy=substr(uid,1)"},function(t){return"uid="+t+"*&groupBy=uid"},function(t){return"uid="+t}],m=function(t,e,n){returnconsole.log("overScheme => level",e,"over",n),1===e&&t.length>n?"uid="+t+"*&groupBy=substr(uid,"+(e+n+1)+")":null},c={actives:[{title:"markAsDone",icon:"check"}],done:[{title:"deleteNotification",icon:"trash"}],new:[{title:"save",icon:"save"}],home:[]},angular.module("llngNotificationsExplorer",["ui.tree","ui.bootstrap","llApp"]).controller("NotificationsExplorerCtrl",["$scope","$translator","$location","$q","$http","$uibModal",function(f,e,t,o,i,r){vard,n,a;returnf.links=links,f.menulinks=menulinks,f.staticPrefix=staticPrefix,f.scriptname=scriptname,f.formPrefix=formPrefix,f.availableLanguages=availableLanguages,f.waiting=!0,f.showM=!1,f.showT=!0,f.showForm=!1,f.data=[],f.form={},f.formPost={},f.currentScope=null,f.currentNotification=null,f.menu=c,f.translateP=e.translateP,f.translate=e.translate,f.translateTitle=function(t){returne.translateField(t,"title")},f.menuClick=function(t){if(t.popup)window.open(t.popup);elseswitch(t.action||(t.action=t.title),typeoft.action){case"function":t.action(f.currentNode,f);break;case"string":f[t.action]();break;default:console.log(typeoft.action)}returnf.showM=!1},f.markAsDone=function(){returnf.waiting=!0,i.put(scriptname+"notifications/"+f.type+"/"+f.currentNotification.uid+"_"+f.currentNotification.reference,{done:1}).then(function(t){returnf.currentNotification=null,f.currentScope.remove(),f.message={title:"notificationDeleted"},f.showModal("alert.html"),f.waiting=!1,f.init()},function(t){returnf.message={title:"notificationNotDeleted",message:t.statusText},f.showModal("alert.html"),f.waiting=!1,f.init()})},f.deleteNotification=function(){returnf.waiting=!0,i.delete(scriptname+"notifications/"+f.type+"/"+f.currentNotification.uid+"_"+f.currentNotification.reference+"_"+f.currentNotification.done).then(function(t){returnf.currentNotification=null,f.currentScope.remove(),f.message={title:"notificationPurged"},f.showModal("alert.html"),f.waiting=!1,f.init()},function(t){returnf.message={title:"notificationNotPurged",message:t.statusText},f.showModal("alert.html"),f.waiting=!1,f.init()})},f.stoggle=function(t){vare;return0===(e=t.$modelValue).nodes.length&&f.updateTree(e.value,e.nodes,e.level,e.over,e.query,e.count),t.toggle()},f.notifDate=function(t){returnnull!=t?(t.match(/(\d{4})-(\d{2})-(\d{2})/)&&(t=t.substr(0,4)+t.substr(5,2)+t.substr(8,2)),newDate(t.substr(0,4),t.substr(4,2)-1,t.substr(6,2)).toLocaleDateString()):""},f.getLanguage=function(t){returnf.lang=t,f.form.date?f.form.date=newDate:f.form="white",f.init(),f.showM=!1},f.$on("$locationChangeSuccess",function(t,e,n){vari;returni=e.match(/#!?\/(\w+)/),f.type=null!=i?i[1]:"actives","new"===f.type?f.displayCreateForm():(f.showForm=!1,f.init())}),d=0,f.updateTree=function(a,c,u,l,t,e){vars,n;if(f.waiting=!0,s=g[u](a,t),25<e&&(n=m(a,u,l))?(l++,s=n,u-=1):l=0,"done"!==f.type&&"actives"!==f.type||i.get(scriptname+"notifications/"+f.type+"?"+s).then(function(t){vare,n,i,o,r;if((e=t.data).result){for(n=0,i=(r=e.values).length;n<i;n++)o=r[n],d++,o.id="node"+d,u<g.length-1&&(o.nodes=[],o.level=u+1,o.query=s,o.over=l),c.push(o);""===a&&(f.total=e.total)}returnf.waiting=!1},function(t){returnf.waiting=!1}),console.log("Selection",f.type),f.activesStyle={color:"#777"},f.doneStyle={color:"#777"},f.newStyle={color:"#777"},"actives"===f.type&&(f.activesStyle={color:"#333"}),"done"===f.type)returnf.doneStyle={color:"#333"}},f.displayNotification=function(t){varn,e;returnf.waiting=!0,f.currentScope=t,e=(n=t.$modelValue).notification,"actives"===f.type&&(e=n.uid+"_"+n.reference),i.get(scriptname+"notifications/"+f.type+"/"+e).then(function(t){vare;if(f.currentNotification={uid:n.uid,reference:n.reference,condition:n.condition},"actives"===f.type){try{console.log("Try to parse a JSON formated notification..."),e=JSON.parse(t.data.notifications),f.currentNotification.text=e.text,f.currentNotification.title=e.title,f.currentNotification.subtitle=e.subti