1var boss_user_module = angular.module('bossApp'); 2 3boss_user_module.factory('DashboardService', ['$http', '$q', 'CacheFactory','$rootScope', function($http, $q, CacheFactory,$rootScope) { 4 var _user = $rootScope.currentUser; 5 if (!CacheFactory.get('dashboardCache')) { 6 CacheFactory.createCache('dashboardCache'); 7 } 8 var dashboardCache = CacheFactory.get('dashboardCache'); 9 return { 10 getAllWidget: function() { 11 var deferred = $q.defer(); 12 13 req = { 14 method: 'GET', 15 async: true, 16 cache: true, 17 url: $rootScope.api_Path + 'dashboard/getAllWidget', 18 params: { 19 userId: _user.userId 20 } 21 } 22 $http(req).then(function(response) { 23 deferred.resolve(response.data); 24 }); 25 26 return deferred.promise; 27 }, 28 disableWidget: function(_widgetId) { 29 var deferred = $q.defer(); 30 req = { 31 method: 'GET', 32 url: $rootScope.api_Path + 'dashboard/disableWidget', 33 params: { 34 widgetId: _widgetId 35 } 36 } 37 $http(req).then(function(response) { 38 deferred.resolve(response.data); 39 }); 40 41 return deferred.promise; 42 }, 43 enableWidget: function(_widgetId) { 44 var deferred = $q.defer(); 45 req = { 46 method: 'GET', 47 url: $rootScope.api_Path + 'dashboard/enableWidget', 48 params: { 49 widgetId: _widgetId 50 } 51 } 52 $http(req).then(function(response) { 53 deferred.resolve(response.data); 54 }); 55 56 return deferred.promise; 57 }, 58 updateWidgetLocation: function(_list) { 59 var deferred = $q.defer(); 60 req = { 61 method: 'POST', 62 url: $rootScope.api_Path + 'dashboard/updateLocation', 63 data : _list 64 } 65 $http(req).then(function(response) { 66 deferred.resolve(response.data); 67 }); 68 69 return deferred.promise; 70 }, 71 getCashFlowPlot: function(_dateFrom, _dateTo) { 72 var deferred = $q.defer(); 73 if (dashboardCache.get("getCashFlowPlot")) { 74 deferred.resolve(dashboardCache.get("getCashFlowPlot")); 75 } else { 76 req = { 77 method: 'POST', 78 url: $rootScope.api_Path + 'dashboard/getCashFlowPlot', 79 params: { 80 entityId: _user.entityId, 81 dateFrom: _dateFrom, 82 dateTo: _dateTo 83 } 84 } 85 $http(req, { 86 cache: dashboardCache 87 }).then(function(response) { 88 dashboardCache.put("getCashFlowPlot", response.data); 89 deferred.resolve(response.data); 90 }); 91 } 92 return deferred.promise; 93 }, 94 getOneStepSmartSuggestion: function(_dateFrom, _dateTo) { 95 var deferred = $q.defer(); 96 if (dashboardCache.get("getOneStepSmartSuggestion")) { 97 deferred.resolve(dashboardCache.get("getOneStepSmartSuggestion")); 98 } else { 99 req = { 100 method: 'POST', 101 async: true, 102 cache: true, 103 url: $rootScope.api_Path + 'dashboard/getOneStepSmartSuggestion', 104 params: { 105 entityId: _user.entityId 106 } 107 } 108 $http(req, { 109 cache: dashboardCache 110 }).then(function(response) { 111 dashboardCache.put("getOneStepSmartSuggestion", response.data); 112 deferred.resolve(response.data); 113 }); 114 } 115 return deferred.promise; 116 }, 117 }; 118}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.