Parent: [0765ef] (diff)

Child: [bd5300] (diff)

Download this file

statisticsCtrl.js    39 lines (34 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*made by Miguel Rodrigues @ KBZ miguel.rodrigues@knowledgebiz.pt*/
console.log("Defining statisticsCtrl");
angular.module('mainApp')
.controller('statisticsCtrl', function($scope, $routeParams, $http, appService) {
$scope.appID = $routeParams.appid;
$scope.developerid = $routeParams.developerid;
$scope.data = false;
console.log("Running statisticsCtrl for developerid (" + $routeParams.developerid + ")");
appService.getRuleStatistics($routeParams.rulesid).then(function(response){
if(response.data.success){
if(response.data.data.length > 0){
console.log("getRuleStatistics response: " + JSON.stringify(response.data));
$scope.statistics = response.data.data;
$scope.totalNotifications = response.data.total.totalNotifications;
$scope.totalNotificationsApplyByRules = response.data.total.totalNotificationsApplyByRules;
$scope.averageValue = response.data.total.averageValue;
$scope.percentage = response.data.total.percentage;
}else{
$scope.data = true;
$scope.noData = "There is no recorded Data";
}
}
},function(err){
console.log("Resource doesn't exist");
$scope.error = err.data.data;
});
$scope.redirectAppManager = function () {
window.location = '/'+$routeParams.developerid
};
$scope.redirectRuleManager = function () {
window.location = '/'+$routeParams.developerid+"/"+$routeParams.appid+"/listrules"
};
console.log("Loading statisticsCtrl");
});