(function(){var llapp,menu,scheme;scheme=[function(v){return"groupBy=substr(uid,1)"},function(v){return"uid="+v+"*&groupBy=uid"},function(v){return"uid="+v}];menu={actives:[{title:"markAsDone",icon:"eye-close"}],done:[{title:"deleteNotification",icon:"trash"}],new:[{title:"save",icon:"save"}],home:[]};llapp=angular.module("llngNotificationsExplorer",["ui.tree","ui.bootstrap","llApp"]);llapp.controller("NotificationsExplorerCtrl",["$scope","$translator","$location","$q","$http","$uibModal",function($scope,$translator,$location,$q,$http,$uibModal){var autoId,c,dateToString;$scope.links=links;$scope.menulinks=menulinks;$scope.staticPrefix=staticPrefix;$scope.scriptname=scriptname;$scope.formPrefix=formPrefix;$scope.availableLanguages=availableLanguages;$scope.waiting=true;$scope.showM=false;$scope.showT=true;$scope.showForm=false;$scope.data=[];$scope.form={};$scope.formPost={};$scope.currentScope=null;$scope.currentNotification=null;$scope.menu=menu;$scope.translateP=$translator.translateP;$scope.translate=$translator.translate;$scope.translateTitle=function(node){return $translator.translateField(node,"title")};$scope.menuClick=function(button){if(button.popup){window.open(button.popup)}else{button.action||(button.action=button.title);switch(typeof button.action){case"function":button.action($scope.currentNode,$scope);break;case"string":$scope[button.action]();break;default:console.log(typeof button.action)}}return $scope.showM=false};$scope.markAsDone=function(){$scope.waiting=true;return $http.put(scriptname+"notifications/"+$scope.type+"/"+$scope.currentNotification.uid+"_"+$scope.currentNotification.reference,{done:1}).then(function(response){$scope.currentNotification=null;$scope.currentScope.remove();$scope.message={title:"notificationDeleted"};$scope.showModal("alert.html");return $scope.waiting=false},function(response){$scope.message={title:"notificationNotDeleted",message:response.statusText};$scope.showModal("alert.html");return $scope.waiting=false})};$scope.deleteNotification=function(){$scope.waiting=true;return $http["delete"](scriptname+"notifications/"+$scope.type+"/"+$scope.currentNotification.uid+"_"+$scope.currentNotification.reference+"_"+$scope.currentNotification.done).then(function(response){$scope.currentNotification=null;$scope.currentScope.remove();$scope.message={title:"notificationPurged"};$scope.showModal("alert.html");return $scope.waiting=false},function(response){$scope.message={title:"notificationNotPurged",message:response.statusText};$scope.showModal("alert.html");return $scope.waiting=false})};$scope.stoggle=function(scope){var node;node=scope.$modelValue;if(node.nodes.length===0){$scope.updateTree(node.value,node.nodes,node.level,node.query);return scope.toggle()}};$scope.notifDate=function(s){var d;if(s!=null){if(s.match(/(\d{4})-(\d{2})-(\d{2})/)){s=s.substr(0,4)+s.substr(5,2)+s.substr(8,2)}d=new Date(s.substr(0,4),s.substr(4,2)-1,s.substr(6,2));return d.toLocaleDateString()}return""};$scope.getLanguage=function(lang){$scope.lang=lang;$scope.form="white";$scope.init();return $scope.showM=false};$scope.$on("$locationChangeSuccess",function(event,next,current){var n;n=next.match(/#!?\/(\w+)/);$scope.type=n!=null?n[1]:"actives";if($scope.type==="new"){return $scope.displayCreateForm()}else{$scope.showForm=false;return $scope.init()}});autoId=0;$scope.updateTree=function(value,node,level,currentQuery){var query;$scope.waiting=true;query=scheme[level](value,currentQuery);return $http.get(scriptname+"notifications/"+$scope.type+"?"+query).then(function(response){var data,i,len,n,ref;data=response.data;if(data.result){ref=data.values;for(i=0,len=ref.length;i