Commit a158d73301becd763f29485a8ae56524a70f32a8

Authored by Anchit Jindal
Exists in master

Merge branch 'master' of git.viithiisys.com:viithiisys/acufuel

app/partials/analytics/analytics.controller.js
1 'use strict'; 1 'use strict';
2 angular.module('acufuel') 2 angular.module('acufuel')
3 .controller('analyticsController', ['$scope','analyticsService',function($scope, analyticsService) { 3 .controller('analyticsController', ['$scope','analyticsService',function($scope,analyticsService) {
4 4
5 $(document).ready(function(){ 5 $(document).ready(function(){
6 $(function(){ 6 $(function(){
7 new jvm.MultiMap({ 7 /*map = new jvm.MultiMap({
8 container: $('#map'), 8 container: $('#map'),
9 maxLevel: 1, 9 maxLevel: 1,
10 main: { 10 main: {
11 map: 'us_lcc', 11 map: 'us_lcc',
12 backgroundColor: '#ffce99', 12 backgroundColor: '#ffce99',
13 }, 13 },
14 mapUrlByCode: function(code, multiMap){ 14 mapUrlByCode: function(code, multiMap){
15 console.log('dddd---',code);
16 console.log('----------',map.getRegionName(code));
17 getRegionPap(label);
15 return '/js/us-counties/jquery-jvectormap-data-'+ 18 return '/js/us-counties/jquery-jvectormap-data-'+
16 code.toLowerCase()+'-'+ 19 code.toLowerCase()+'-'+
17 multiMap.defaultProjection+'-en.js'; 20 multiMap.defaultProjection+'-en.js';
18 } 21 },
22 onRegionClick:function(event, code) {
23 //console.log('----------',map.getRegionName(code));
24 var name = (code);
25 alert(name);
26 }
27 });*/
28
29 jQuery('#map').vectorMap({
30 map: 'us_lcc',
31 backgroundColor: '#ffce99',
32 color: '#dfdfdd',
33 hoverOpacity: 0,
34 selectedColor: '#5f8b98',
35 hoverColor: '#5f8b98',
36 enableZoom: true,
37 showTooltip: true,
38 scaleColors: ['#dfdfdd'],
39 //values: sample_data
40 onRegionClick: function (event, code) {
41 var map = $('#map').vectorMap('get', 'mapObject');
42 var name = map.getRegionName(code);
43 getRegionPap(name);
44 },
45 normalizeFunction: 'polynomial'
19 }); 46 });
47
20 }); 48 });
21 }) 49 })
22 50
51 function getRegionPap(code){
52 $scope.showLoader = true;
53 analyticsService.getRPP(code).then(function(result) {
54 $scope.rppData = result;
55 $scope.showLoader = false;
56 $('#popup1').css('display', 'block');
57
58 })
59
60 }
61 $scope.cancelStatus = function() {
62 $('#popup1').css('display', 'none');
63
64 }
65
23 66
24 $scope.drf = {}; 67 $scope.drf = {};
25 $scope.hfp = {}; 68 $scope.hfp = {};
26 $scope.cs = {}; 69 $scope.cs = {};
27 $scope.mfsValues = []; 70 $scope.mfsValues = [];
28 $scope.msfarray=[]; 71 $scope.msfarray=[];
29 $scope.getMFS = function(){ 72 $scope.getMFS = function(){
30 //var makeId = makeId; 73 //var makeId = makeId;
31 analyticsService.getMFS().then(function(result) { 74 analyticsService.getMFS().then(function(result) {
32 $scope.mfsValues = result; 75 $scope.mfsValues = result;
33 76
34 //console.log("msf length",$scope.mfsValues.length); 77 //console.log("msf length",$scope.mfsValues.length);
35 //console.log("mfs data kd--- ",$scope.mfsValues) 78 //console.log("mfs data kd--- ",$scope.mfsValues)
36 79
37 //console.log("==msf data key==",$scope.mfsValues[0].key); 80 //console.log("==msf data key==",$scope.mfsValues[0].key);
38 // console.log("==msf data values==",$scope.mfsValues[0].values); 81 // console.log("==msf data values==",$scope.mfsValues[0].values);
39 // console.log("==x===",$scope.mfsValues[0].values[0].x); 82 // console.log("==x===",$scope.mfsValues[0].values[0].x);
40 //console.log("==y===",$scope.mfsValues[0].values[0].y); 83 //console.log("==y===",$scope.mfsValues[0].values[0].y);
41 // console.log("==x===",$scope.mfsValues[0].values[1].x); 84 // console.log("==x===",$scope.mfsValues[0].values[1].x);
42 // console.log("==y===",$scope.mfsValues[0].values[1].y); 85 // console.log("==y===",$scope.mfsValues[0].values[1].y);
43 /* $scope.optionsmfs = { 86 /* $scope.optionsmfs = {
44 chart: { 87 chart: {
45 type: 'discreteBarChart', 88 type: 'discreteBarChart',
46 height: 450, 89 height: 450,
47 margin : { 90 margin : {
48 top: 20, 91 top: 20,
49 right: 20, 92 right: 20,
50 bottom: 60, 93 bottom: 60,
51 left: 55, 94 left: 55,
52 }, 95 },
53 x: function(d){ return d.label; }, 96 x: function(d){ return d.label; },
54 y: function(d){ return d.value; }, 97 y: function(d){ return d.value; },
55 showValues: false, 98 showValues: false,
56 valueFormat: function(d){ 99 valueFormat: function(d){
57 return d3.format(',.4f')(d); 100 return d3.format(',.4f')(d);
58 }, 101 },
59 transitionDuration: 500, 102 transitionDuration: 500,
60 xAxis: { 103 xAxis: {
61 axisLabel: 'X Axis' 104 axisLabel: 'X Axis'
62 }, 105 },
63 yAxis: { 106 yAxis: {
64 axisLabel: 'Y Axis', 107 axisLabel: 'Y Axis',
65 axisLabelDistance: 30 108 axisLabelDistance: 30
66 } 109 }
67 } 110 }
68 }; 111 };
69 112
70 $scope.datamfs = [{ 113 $scope.datamfs = [{
71 key: "Cumulative Return", 114 key: "Cumulative Return",
72 values: $scope.mfsValues 115 values: $scope.mfsValues
73 }] */ 116 }] */
74 117
75 $scope.optionsmfs = { 118 $scope.optionsmfs = {
76 chart: { 119 chart: {
77 type: 'multiBarChart', 120 type: 'multiBarChart',
78 height: 450, 121 height: 450,
79 margin : { 122 margin : {
80 top: 20, 123 top: 20,
81 right: 20, 124 right: 20,
82 bottom: 45, 125 bottom: 45,
83 left: 45 126 left: 45
84 }, 127 },
85 clipEdge: true, 128 clipEdge: true,
86 //staggerLabels: true, 129 //staggerLabels: true,
87 duration: 500, 130 duration: 500,
88 stacked: true, 131 stacked: true,
89 color: ["#FEDFC3","#990000","#000099","#009900"], 132 color: ["#FEDFC3","#990000","#000099","#009900"],
90 xAxis: { 133 xAxis: {
91 axisLabel: 'Months', 134 axisLabel: 'Months',
92 showMaxMin: false, 135 showMaxMin: false,
93 }, 136 },
94 yAxis: { 137 yAxis: {
95 axisLabel: 'Y Axis', 138 axisLabel: 'Y Axis',
96 axisLabelDistance: -20, 139 axisLabelDistance: -20,
97 tickFormat: function(d){ 140 tickFormat: function(d){
98 return d3.format(',.1f')(d); 141 return d3.format(',.1f')(d);
99 } 142 }
100 } 143 }
101 } 144 }
102 }; 145 };
103 146
104 147
105 //console.log("==length 1==",$scope.mfsValues); 148 //console.log("==length 1==",$scope.mfsValues);
106 149
107 for (var i = 0; i < $scope.mfsValues.length; i++) { 150 for (var i = 0; i < $scope.mfsValues.length; i++) {
108 for(var j=0;j<$scope.mfsValues[i].values.length;j++){ 151 for(var j=0;j<$scope.mfsValues[i].values.length;j++){
109 152
110 $scope.msfarray.push({ 153 $scope.msfarray.push({
111 "key":$scope.mfsValues[i].key, 154 "key":$scope.mfsValues[i].key,
112 "values": [{ 155 "values": [{
113 "x":$scope.mfsValues[i].values[j].x, 156 "x":$scope.mfsValues[i].values[j].x,
114 "y":$scope.mfsValues[i].values[j].y 157 "y":$scope.mfsValues[i].values[j].y
115 }] 158 }]
116 }) 159 })
117 } 160 }
118 161
119 162
120 } 163 }
121 // console.log("new values===",$scope.msfarray); 164 // console.log("new values===",$scope.msfarray);
122 $scope.datamfs=$scope.msfarray; 165 $scope.datamfs=$scope.msfarray;
123 166
124 167
125 /*$scope.datamfs = [{ 168 /*$scope.datamfs = [{
126 "key": "Pending", 169 "key": "Pending",
127 "values": [{ 170 "values": [{
128 "x": "Jan", 171 "x": "Jan",
129 "y": 0.16284738584101344 172 "y": 0.16284738584101344
130 }, { 173 }, {
131 "x": "Feb", 174 "x": "Feb",
132 "y": 2.370283172738109 175 "y": 2.370283172738109
133 }, { 176 }, {
134 "x": "Mar", 177 "x": "Mar",
135 "y": 0.1631208266452718 178 "y": 0.1631208266452718
136 }, { 179 }, {
137 "x": "Apr", 180 "x": "Apr",
138 "y": 0.24609871793543797 181 "y": 0.24609871793543797
139 }, { 182 }, {
140 "x": "May", 183 "x": "May",
141 "y": 1.5096133160633776 184 "y": 1.5096133160633776
142 },{ 185 },{
143 "x": "Jun", 186 "x": "Jun",
144 "y": 0.16284738584101344 187 "y": 0.16284738584101344
145 }, { 188 }, {
146 "x": "Jul", 189 "x": "Jul",
147 "y": 2.370283172738109 190 "y": 2.370283172738109
148 }, { 191 }, {
149 "x": "Aug", 192 "x": "Aug",
150 "y": 0.1631208266452718 193 "y": 0.1631208266452718
151 }, { 194 }, {
152 "x": "Sep", 195 "x": "Sep",
153 "y": 0.24609871793543797 196 "y": 0.24609871793543797
154 }, { 197 }, {
155 "x": "Oct", 198 "x": "Oct",
156 "y": 1.5096133160633776 199 "y": 1.5096133160633776
157 }, { 200 }, {
158 "x": "Nov", 201 "x": "Nov",
159 "y": 0.24609871793543797 202 "y": 0.24609871793543797
160 }, { 203 }, {
161 "x": "Dec", 204 "x": "Dec",
162 "y": 1.5096133160633776 205 "y": 1.5096133160633776
163 }] 206 }]
164 }, { 207 }, {
165 "key": "Cancelled", 208 "key": "Cancelled",
166 "values": [{ 209 "values": [{
167 "x": "Jan", 210 "x": "Jan",
168 "y": 0.12566330679904006 211 "y": 0.12566330679904006
169 }, { 212 }, {
170 "x": "Feb", 213 "x": "Feb",
171 "y": 0.1321859413211272 214 "y": 0.1321859413211272
172 }, { 215 }, {
173 "x": "Mar", 216 "x": "Mar",
174 "y": 1.4798247902549135 217 "y": 1.4798247902549135
175 }, { 218 }, {
176 "x": "Apr", 219 "x": "Apr",
177 "y": 0.10870538273358979 220 "y": 0.10870538273358979
178 }, { 221 }, {
179 "x": "May", 222 "x": "May",
180 "y": 0.16155091711225184 223 "y": 0.16155091711225184
181 },{ 224 },{
182 "x": "Jun", 225 "x": "Jun",
183 "y": 0.16284738584101344 226 "y": 0.16284738584101344
184 }, { 227 }, {
185 "x": "Jul", 228 "x": "Jul",
186 "y": 2.370283172738109 229 "y": 2.370283172738109
187 }, { 230 }, {
188 "x": "Aug", 231 "x": "Aug",
189 "y": 0.1631208266452718 232 "y": 0.1631208266452718
190 }, { 233 }, {
191 "x": "Sep", 234 "x": "Sep",
192 "y": 0.24609871793543797 235 "y": 0.24609871793543797
193 }, { 236 }, {
194 "x": "Oct", 237 "x": "Oct",
195 "y": 1.5096133160633776 238 "y": 1.5096133160633776
196 }, { 239 }, {
197 "x": "Nov", 240 "x": "Nov",
198 "y": 0.24609871793543797 241 "y": 0.24609871793543797
199 }, { 242 }, {
200 "x": "Dec", 243 "x": "Dec",
201 "y": 1.5096133160633776 244 "y": 1.5096133160633776
202 }] 245 }]
203 },{ 246 },{
204 "key": "Invoiced", 247 "key": "Invoiced",
205 "values": [{ 248 "values": [{
206 "x": "Jan", 249 "x": "Jan",
207 "y": 0.16284738584101344 250 "y": 0.16284738584101344
208 }, { 251 }, {
209 "x": "Feb", 252 "x": "Feb",
210 "y": 2.370283172738109 253 "y": 2.370283172738109
211 }, { 254 }, {
212 "x": "Mar", 255 "x": "Mar",
213 "y": 0.1631208266452718 256 "y": 0.1631208266452718
214 }, { 257 }, {
215 "x": "Apr", 258 "x": "Apr",
216 "y": 0.24609871793543797 259 "y": 0.24609871793543797
217 }, { 260 }, {
218 "x": "May", 261 "x": "May",
219 "y": 1.5096133160633776 262 "y": 1.5096133160633776
220 },{ 263 },{
221 "x": "Jun", 264 "x": "Jun",
222 "y": 0.16284738584101344 265 "y": 0.16284738584101344
223 }, { 266 }, {
224 "x": "Jul", 267 "x": "Jul",
225 "y": 2.370283172738109 268 "y": 2.370283172738109
226 }, { 269 }, {
227 "x": "Aug", 270 "x": "Aug",
228 "y": 0.1631208266452718 271 "y": 0.1631208266452718
229 }, { 272 }, {
230 "x": "Sep", 273 "x": "Sep",
231 "y": 0.24609871793543797 274 "y": 0.24609871793543797
232 }, { 275 }, {
233 "x": "Oct", 276 "x": "Oct",
234 "y": 1.5096133160633776 277 "y": 1.5096133160633776
235 }, { 278 }, {
236 "x": "Nov", 279 "x": "Nov",
237 "y": 0.24609871793543797 280 "y": 0.24609871793543797
238 }, { 281 }, {
239 "x": "Dec", 282 "x": "Dec",
240 "y": 1.5096133160633776 283 "y": 1.5096133160633776
241 }] 284 }]
242 }, { 285 }, {
243 "key": "Paid", 286 "key": "Paid",
244 "values": [{ 287 "values": [{
245 "x": "Jan", 288 "x": "Jan",
246 "y": 0.12566330679904006 289 "y": 0.12566330679904006
247 }, { 290 }, {
248 "x": "Feb", 291 "x": "Feb",
249 "y": 0.1321859413211272 292 "y": 0.1321859413211272
250 }, { 293 }, {
251 "x": "Mar", 294 "x": "Mar",
252 "y": 1.4798247902549135 295 "y": 1.4798247902549135
253 }, { 296 }, {
254 "x": "Apr", 297 "x": "Apr",
255 "y": 0.10870538273358979 298 "y": 0.10870538273358979
256 }, { 299 }, {
257 "x": "May", 300 "x": "May",
258 "y": 0.16155091711225184 301 "y": 0.16155091711225184
259 },{ 302 },{
260 "x": "Jun", 303 "x": "Jun",
261 "y": 0.16284738584101344 304 "y": 0.16284738584101344
262 }, { 305 }, {
263 "x": "Jul", 306 "x": "Jul",
264 "y": 2.370283172738109 307 "y": 2.370283172738109
265 }, { 308 }, {
266 "x": "Aug", 309 "x": "Aug",
267 "y": 0.1631208266452718 310 "y": 0.1631208266452718
268 }, { 311 }, {
269 "x": "Sep", 312 "x": "Sep",
270 "y": 0.24609871793543797 313 "y": 0.24609871793543797
271 }, { 314 }, {
272 "x": "Oct", 315 "x": "Oct",
273 "y": 1.5096133160633776 316 "y": 1.5096133160633776
274 }, { 317 }, {
275 "x": "Nov", 318 "x": "Nov",
276 "y": 0.24609871793543797 319 "y": 0.24609871793543797
277 }, { 320 }, {
278 "x": "Dec", 321 "x": "Dec",
279 "y": 1.5096133160633776 322 "y": 1.5096133160633776
280 }] 323 }]
281 }] 324 }]
282 */ 325 */
283 }) 326 })
284 } 327 }
285 328
286 329
287 330
288 331
289 $scope.getMFS(); 332 $scope.getMFS();
290 $scope.csValues = []; 333 $scope.csValues = [];
291 $scope.getCS = function(){ 334 $scope.getCS = function(){
292 //var makeId = makeId; 335 //var makeId = makeId;
293 analyticsService.getCS().then(function(result) { 336 analyticsService.getCS().then(function(result) {
337 //console.log("==cs values==",result)
294 $scope.csValues = result; 338 $scope.csValues = result;
295 //console.log("cs data kd --- ",$scope.csValues) 339 //console.log("cs data kd --- ",$scope.csValues)
296 $scope.optionscs = { 340 $scope.optionscs = {
297 chart: { 341 chart: {
298 type: 'pieChart', 342 type: 'pieChart',
299 height: 500, 343 height: 500,
300 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], 344 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
301 x: function(d){return d.key;}, 345 x: function(d){return d.key;},
302 y: function(d){return d.y;}, 346 y: function(d){return d.y;},
303 showLabels: false, 347 showLabels: false,
304 segmentShowStroke : false, 348 segmentShowStroke : false,
305 animationSteps : 20, 349 animationSteps : 20,
306 animationEasing : "linear", 350 animationEasing : "linear",
307 animateScale : true, 351 animateScale : true,
308 duration: 500, 352 duration: 500,
309 labelThreshold: 0.01, 353 labelThreshold: 0.01,
310 labelSunbeamLayout: true, 354 labelSunbeamLayout: true,
311 legend: { 355 legend: {
312 margin: { 356 margin: {
313 top: 5, 357 top: 5,
314 right: 35, 358 right: 35,
315 bottom: 5, 359 bottom: 5,
316 left: 0 360 left: 0
317 } 361 }
318 } 362 }
319 } 363 }
320 }; 364 };
321 $scope.datacs = $scope.csValues; 365 $scope.datacs = $scope.csValues;
322 }) 366 })
323 } 367 }
324 368
325 $scope.getCS(); 369 $scope.getCS();
370
371 /*Historic Fuel Price */
326 $scope.optionshfp = { 372 $scope.optionshfp = {
327 chart: { 373 chart: {
328 type: 'cumulativeLineChart', 374 type: 'cumulativeLineChart',
329 height: 450, 375 height: 450,
330 margin : { 376 margin : {
331 top: 20, 377 top: 20,
332 right: 20, 378 right: 20,
333 bottom: 50, 379 bottom: 50,
334 left: 65 380 left: 65
335 }, 381 },
336 x: function(d){ return d[0]; }, 382 x: function(d){ return d[0]; },
337 y: function(d){ return d[1]/100; }, 383 y: function(d){ return d[1]/100; },
338 average: function(d) { return d.mean/100; }, 384 average: function(d) { return d.mean/100; },
339 385
340 color: ["#FEDFC3"], 386 color: ["#FEDFC3"],
341 duration: 300, 387 duration: 300,
342 useInteractiveGuideline: true, 388 useInteractiveGuideline: true,
343 clipVoronoi: false, 389 clipVoronoi: false,
344 390
345 xAxis: { 391 xAxis: {
346 axisLabel: 'X Axis', 392 axisLabel: 'X Axis',
347 tickFormat: function(d) { 393 tickFormat: function(d) {
348 return d3.time.format('%m/%d/%y')(new Date(d)) 394 return d3.time.format('%m/%d/%y')(new Date(d))
349 }, 395 },
350 showMaxMin: false, 396 showMaxMin: false,
351 staggerLabels: true 397 staggerLabels: true
352 }, 398 },
353 399
354 yAxis: { 400 yAxis: {
355 axisLabel: 'Y Axis', 401 axisLabel: 'Y Axis',
356 tickFormat: function(d){ 402 tickFormat: function(d){
357 return d3.format(',.1%')(d); 403 return d3.format(',.1%')(d);
358 }, 404 },
359 axisLabelDistance: 0 405 axisLabelDistance: 0
360 } 406 }
361 } 407 }
362 }; 408 };
363 409
364 $scope.datahfp = 410 $scope.datahfp =
365 [{ 411 [{
366 key: "Long", 412 key: "Long",
367 values: [ [ 1083297600000 , -2.974623048543] , [ 1085976000000 , -1.7740300785979] , [ 1088568000000 , 4.4681318138177] , [ 1091246400000 , 7.0242541001353] , [ 1093924800000 , 7.5709603667586] , [ 1096516800000 , 20.612245065736] , [ 1099195200000 , 21.698065237316] , [ 1101790800000 , 40.501189458018] , [ 1104469200000 , 50.464679413194] , [ 1107147600000 , 48.917421973355] , [ 1109566800000 , 63.750936549160] , [ 1112245200000 , 59.072499126460] , [ 1114833600000 , 43.373158880492] , [ 1117512000000 , 54.490918947556] , [ 1120104000000 , 56.661178852079] , [ 1122782400000 , 73.450103545496] , [ 1125460800000 , 71.714526354907] , [ 1128052800000 , 85.221664349607] , [ 1130734800000 , 77.769261392481] , [ 1133326800000 , 95.966528716500] , [ 1136005200000 , 107.59132116397] , [ 1138683600000 , 127.25740096723] , [ 1141102800000 , 122.13917498830] , [ 1143781200000 , 126.53657279774] , [ 1146369600000 , 132.39300992970] , [ 1149048000000 , 120.11238242904] , [ 1151640000000 , 118.41408917750] , [ 1154318400000 , 107.92918924621] , [ 1156996800000 , 110.28057249569] , [ 1159588800000 , 117.20485334692] , [ 1162270800000 , 141.33556756948] , [ 1164862800000 , 159.59452727893] , [ 1167541200000 , 167.09801853304] , [ 1170219600000 , 185.46849659215] , [ 1172638800000 , 184.82474099990] , [ 1175313600000 , 195.63155213887] , [ 1177905600000 , 207.40597044171] , [ 1180584000000 , 230.55966698196] , [ 1183176000000 , 239.55649035292] , [ 1185854400000 , 241.35915085208] , [ 1188532800000 , 239.89428956243] , [ 1191124800000 , 260.47781917715] , [ 1193803200000 , 276.39457482225] , [ 1196398800000 , 258.66530682672] , [ 1199077200000 , 250.98846121893] , [ 1201755600000 , 226.89902618127] , [ 1204261200000 , 227.29009273807] , [ 1206936000000 , 218.66476654350] , [ 1209528000000 , 232.46605902918] , [ 1212206400000 , 253.25667081117] , [ 1214798400000 , 235.82505363925] , [ 1217476800000 , 229.70112774254] , [ 1220155200000 , 225.18472705952] , [ 1222747200000 , 189.13661746552] , [ 1225425600000 , 149.46533007301] , [ 1228021200000 , 131.00340772114] , [ 1230699600000 , 135.18341728866] , [ 1233378000000 , 109.15296887173] , [ 1235797200000 , 84.614772549760] , [ 1238472000000 , 100.60810015326] , [ 1241064000000 , 141.50134895610] , [ 1243742400000 , 142.50405083675] , [ 1246334400000 , 139.81192372672] , [ 1249012800000 , 177.78205544583] , [ 1251691200000 , 194.73691933074] , [ 1254283200000 , 209.00838460225] , [ 1256961600000 , 198.19855877420] , [ 1259557200000 , 222.37102417812] , [ 1262235600000 , 234.24581081250] , [ 1264914000000 , 228.26087689346] , [ 1267333200000 , 248.81895126250] , [ 1270008000000 , 270.57301075186] , [ 1272600000000 , 292.64604322550] , [ 1275278400000 , 265.94088520518] , [ 1277870400000 , 237.82887467569] , [ 1280548800000 , 265.55973314204] , [ 1283227200000 , 248.30877330928] , [ 1285819200000 , 278.14870066912] , [ 1288497600000 , 292.69260960288] , [ 1291093200000 , 300.84263809599] , [ 1293771600000 , 326.17253914628] , [ 1296450000000 , 337.69335966505] , [ 1298869200000 , 339.73260965121] , [ 1301544000000 , 346.87865120765] , [ 1304136000000 , 347.92991526628] , [ 1306814400000 , 342.04627502669] , [ 1309406400000 , 333.45386231233] , [ 1312084800000 , 323.15034181243] , [ 1314763200000 , 295.66126882331] , [ 1317355200000 , 251.48014579253] , [ 1320033600000 , 295.15424257905] , [ 1322629200000 , 294.54766764397] , [ 1325307600000 , 295.72906119051] , [ 1327986000000 , 325.73351347613] , [ 1330491600000 , 340.16106061186] , [ 1333166400000 , 345.15514071490] , [ 1335758400000 , 337.10259395679] , [ 1338436800000 , 318.68216333837] , [ 1341028800000 , 317.03683945246] , [ 1343707200000 , 318.53549659997] , [ 1346385600000 , 332.85381464104] , [ 1348977600000 , 337.36534373477] , [ 1351656000000 , 350.27872156161] , [ 1354251600000 , 349.45128876100]] 413 values: [ [ 1083297600000 , -2.974623048543] , [ 1085976000000 , -1.7740300785979] , [ 1088568000000 , 4.4681318138177] , [ 1091246400000 , 7.0242541001353] , [ 1093924800000 , 7.5709603667586] , [ 1096516800000 , 20.612245065736] , [ 1099195200000 , 21.698065237316] , [ 1101790800000 , 40.501189458018] , [ 1104469200000 , 50.464679413194] , [ 1107147600000 , 48.917421973355] , [ 1109566800000 , 63.750936549160] , [ 1112245200000 , 59.072499126460] , [ 1114833600000 , 43.373158880492] , [ 1117512000000 , 54.490918947556] , [ 1120104000000 , 56.661178852079] , [ 1122782400000 , 73.450103545496] , [ 1125460800000 , 71.714526354907] , [ 1128052800000 , 85.221664349607] , [ 1130734800000 , 77.769261392481] , [ 1133326800000 , 95.966528716500] , [ 1136005200000 , 107.59132116397] , [ 1138683600000 , 127.25740096723] , [ 1141102800000 , 122.13917498830] , [ 1143781200000 , 126.53657279774] , [ 1146369600000 , 132.39300992970] , [ 1149048000000 , 120.11238242904] , [ 1151640000000 , 118.41408917750] , [ 1154318400000 , 107.92918924621] , [ 1156996800000 , 110.28057249569] , [ 1159588800000 , 117.20485334692] , [ 1162270800000 , 141.33556756948] , [ 1164862800000 , 159.59452727893] , [ 1167541200000 , 167.09801853304] , [ 1170219600000 , 185.46849659215] , [ 1172638800000 , 184.82474099990] , [ 1175313600000 , 195.63155213887] , [ 1177905600000 , 207.40597044171] , [ 1180584000000 , 230.55966698196] , [ 1183176000000 , 239.55649035292] , [ 1185854400000 , 241.35915085208] , [ 1188532800000 , 239.89428956243] , [ 1191124800000 , 260.47781917715] , [ 1193803200000 , 276.39457482225] , [ 1196398800000 , 258.66530682672] , [ 1199077200000 , 250.98846121893] , [ 1201755600000 , 226.89902618127] , [ 1204261200000 , 227.29009273807] , [ 1206936000000 , 218.66476654350] , [ 1209528000000 , 232.46605902918] , [ 1212206400000 , 253.25667081117] , [ 1214798400000 , 235.82505363925] , [ 1217476800000 , 229.70112774254] , [ 1220155200000 , 225.18472705952] , [ 1222747200000 , 189.13661746552] , [ 1225425600000 , 149.46533007301] , [ 1228021200000 , 131.00340772114] , [ 1230699600000 , 135.18341728866] , [ 1233378000000 , 109.15296887173] , [ 1235797200000 , 84.614772549760] , [ 1238472000000 , 100.60810015326] , [ 1241064000000 , 141.50134895610] , [ 1243742400000 , 142.50405083675] , [ 1246334400000 , 139.81192372672] , [ 1249012800000 , 177.78205544583] , [ 1251691200000 , 194.73691933074] , [ 1254283200000 , 209.00838460225] , [ 1256961600000 , 198.19855877420] , [ 1259557200000 , 222.37102417812] , [ 1262235600000 , 234.24581081250] , [ 1264914000000 , 228.26087689346] , [ 1267333200000 , 248.81895126250] , [ 1270008000000 , 270.57301075186] , [ 1272600000000 , 292.64604322550] , [ 1275278400000 , 265.94088520518] , [ 1277870400000 , 237.82887467569] , [ 1280548800000 , 265.55973314204] , [ 1283227200000 , 248.30877330928] , [ 1285819200000 , 278.14870066912] , [ 1288497600000 , 292.69260960288] , [ 1291093200000 , 300.84263809599] , [ 1293771600000 , 326.17253914628] , [ 1296450000000 , 337.69335966505] , [ 1298869200000 , 339.73260965121] , [ 1301544000000 , 346.87865120765] , [ 1304136000000 , 347.92991526628] , [ 1306814400000 , 342.04627502669] , [ 1309406400000 , 333.45386231233] , [ 1312084800000 , 323.15034181243] , [ 1314763200000 , 295.66126882331] , [ 1317355200000 , 251.48014579253] , [ 1320033600000 , 295.15424257905] , [ 1322629200000 , 294.54766764397] , [ 1325307600000 , 295.72906119051] , [ 1327986000000 , 325.73351347613] , [ 1330491600000 , 340.16106061186] , [ 1333166400000 , 345.15514071490] , [ 1335758400000 , 337.10259395679] , [ 1338436800000 , 318.68216333837] , [ 1341028800000 , 317.03683945246] , [ 1343707200000 , 318.53549659997] , [ 1346385600000 , 332.85381464104] , [ 1348977600000 , 337.36534373477] , [ 1351656000000 , 350.27872156161] , [ 1354251600000 , 349.45128876100]]
368 , 414 ,
369 mean: 250 415 mean: 250
370 }]; 416 }];
371 //console.log("--datahfp---",$scope.datahfp); 417 //console.log("--datahfp---",$scope.datahfp);
372 418
373 419
374 /*Date Range Filter for Monthly fuel Sales*/ 420 /*Date Range Filter for Monthly fuel Sales*/
375 $scope.submitDate = function(){ 421 $scope.submitDate = function(){
376 422
377 if ($scope.drf.fromDate === undefined) { 423 if ($scope.drf.fromDate === undefined) {
378 424
379 // console.log("==frmdate====",$scope.drf.fromDate); 425 // console.log("==frmdate====",$scope.drf.fromDate);
380 //console.log("==toDate====",$scope.drf.toDate); 426 //console.log("==toDate====",$scope.drf.toDate);
381 $scope.fillForm = true; 427 $scope.fillForm = true;
382 } 428 }
383 else if($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate ===''){ 429 else if($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate ===''){
384 $scope.fillForm = false; 430 $scope.fillForm = false;
385 var today= new Date(); 431 var today= new Date();
386 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); 432 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2);
387 //from date format 433 //from date format
388 $scope.dat1 = $scope.drf.fromDate; 434 $scope.dat1 = $scope.drf.fromDate;
389 $scope.fd1 = $scope.dat1.split("/").reverse(); 435 $scope.fd1 = $scope.dat1.split("/").reverse();
390 $scope.tmp = $scope.fd1[2]; 436 $scope.tmp = $scope.fd1[2];
391 $scope.fd1[2] = $scope.fd1[1]; 437 $scope.fd1[2] = $scope.fd1[1];
392 $scope.fd1[1] = $scope.tmp; 438 $scope.fd1[1] = $scope.tmp;
393 $scope.fd = $scope.fd1.join("-"); 439 $scope.fd = $scope.fd1.join("-");
394 // console.log("===fd====",$scope.fd); 440 // console.log("===fd====",$scope.fd);
395 //console.log("----td curr---",DefaultToDate); 441 //console.log("----td curr---",DefaultToDate);
396 analyticsService.getDRFChart($scope.fd,DefaultToDate).then(function(result) { 442 analyticsService.getDRFChart($scope.fd,DefaultToDate).then(function(result) {
397 //console.log("==date received==",$scope.fd); 443 //console.log("==date received==",$scope.fd);
398 //console.log("----to date receivedcurrent---",DefaultToDate) 444 //console.log("----to date receivedcurrent---",DefaultToDate)
399 $scope.datamfs = result; 445 $scope.datamfs = result;
400 }) 446 })
401 447
402 448
403 } else if($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined ){ 449 } else if($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined ){
404 $scope.fillForm = false; 450 $scope.fillForm = false;
405 //from date format 451 //from date format
406 $scope.dat1 = $scope.drf.fromDate; 452 $scope.dat1 = $scope.drf.fromDate;
407 $scope.fd1 = $scope.dat1.split("/").reverse(); 453 $scope.fd1 = $scope.dat1.split("/").reverse();
408 $scope.tmp = $scope.fd1[2]; 454 $scope.tmp = $scope.fd1[2];
409 $scope.fd1[2] = $scope.fd1[1]; 455 $scope.fd1[2] = $scope.fd1[1];
410 $scope.fd1[1] = $scope.tmp; 456 $scope.fd1[1] = $scope.tmp;
411 $scope.fd = $scope.fd1.join("-"); 457 $scope.fd = $scope.fd1.join("-");
412 //to date format 458 //to date format
413 $scope.dat2 = $scope.drf.toDate; 459 $scope.dat2 = $scope.drf.toDate;
414 $scope.td1 = $scope.dat2.split("/").reverse(); 460 $scope.td1 = $scope.dat2.split("/").reverse();
415 $scope.tmp1 = $scope.td1[2]; 461 $scope.tmp1 = $scope.td1[2];
416 $scope.td1[2] = $scope.td1[1]; 462 $scope.td1[2] = $scope.td1[1];
417 $scope.td1[1] = $scope.tmp1; 463 $scope.td1[1] = $scope.tmp1;
418 $scope.td = $scope.td1.join("-"); 464 $scope.td = $scope.td1.join("-");
419 465
420 analyticsService.getDRFChart($scope.fd,$scope.td).then(function(result) { 466 analyticsService.getDRFChart($scope.fd,$scope.td).then(function(result) {
421 // console.log("==date received==",$scope.fd); 467 // console.log("==date received==",$scope.fd);
422 //console.log("----to date received---",$scope.td) 468 //console.log("----to date received---",$scope.td)
423 $scope.datamfs = result; 469 $scope.datamfs = result;
424 }) 470 })
425 471
426 }else 472 }else
427 { 473 {
428 $scope.fillForm = true; 474 $scope.fillForm = true;
429 } 475 }
430 476
431 477
432 } 478 }
433 479
434 /*Date Range Filter for Historic fuel Price*/ 480 /*Date Range Filter for Historic fuel Price*/
435 $scope.submitDateHfp = function(){ 481 $scope.submitDateHfp = function(){
436 482
437 if ($scope.hfp.fromDate === undefined) { 483 if ($scope.hfp.fromDate === undefined) {
438 484
439 // console.log("==frmdate====",$scope.drf.fromDate); 485 // console.log("==frmdate====",$scope.drf.fromDate);
440 //console.log("==toDate====",$scope.drf.toDate); 486 //console.log("==toDate====",$scope.drf.toDate);
441 $scope.fillForm = true; 487 $scope.fillForm = true;
442 } 488 }
443 else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate ===''){ 489 else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate ===''){
444 $scope.fillForm = false; 490 $scope.fillForm = false;
445 var today= new Date(); 491 var today= new Date();
446 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); 492 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2);
447 //from date format 493 //from date format
448 $scope.dat1 = $scope.hfp.fromDate; 494 $scope.dat1 = $scope.hfp.fromDate;
449 $scope.fd1 = $scope.dat1.split("/").reverse(); 495 $scope.fd1 = $scope.dat1.split("/").reverse();
450 $scope.tmp = $scope.fd1[2]; 496 $scope.tmp = $scope.fd1[2];
451 $scope.fd1[2] = $scope.fd1[1]; 497 $scope.fd1[2] = $scope.fd1[1];
452 $scope.fd1[1] = $scope.tmp; 498 $scope.fd1[1] = $scope.tmp;
453 $scope.fd = $scope.fd1.join("-"); 499 $scope.fd = $scope.fd1.join("-");
454 // console.log("===fd====",$scope.fd); 500 // console.log("===fd====",$scope.fd);
455 //console.log("----td curr---",DefaultToDate); 501 //console.log("----td curr---",DefaultToDate);
456 analyticsService.getDRFHfpChart($scope.fd,DefaultToDate).then(function(result) { 502 analyticsService.getDRFHfpChart($scope.fd,DefaultToDate).then(function(result) {
457 //console.log("==date received==",$scope.fd); 503 //console.log("==date received==",$scope.fd);
458 //console.log("----to date receivedcurrent---",DefaultToDate) 504 //console.log("----to date receivedcurrent---",DefaultToDate)
459 $scope.datahfp = result; 505 $scope.datahfp = result;
460 }) 506 })
461 507
462 508
463 } else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined ){ 509 } else if($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined ){
464 $scope.fillForm = false; 510 $scope.fillForm = false;
465 //from date format 511 //from date format
466 $scope.dat1 = $scope.hfp.fromDate; 512 $scope.dat1 = $scope.hfp.fromDate;
467 $scope.fd1 = $scope.dat1.split("/").reverse(); 513 $scope.fd1 = $scope.dat1.split("/").reverse();
468 $scope.tmp = $scope.fd1[2]; 514 $scope.tmp = $scope.fd1[2];
469 $scope.fd1[2] = $scope.fd1[1]; 515 $scope.fd1[2] = $scope.fd1[1];
470 $scope.fd1[1] = $scope.tmp; 516 $scope.fd1[1] = $scope.tmp;
471 $scope.fd = $scope.fd1.join("-"); 517 $scope.fd = $scope.fd1.join("-");
472 //to date format 518 //to date format
473 $scope.dat2 = $scope.hfp.toDate; 519 $scope.dat2 = $scope.hfp.toDate;
474 $scope.td1 = $scope.dat2.split("/").reverse(); 520 $scope.td1 = $scope.dat2.split("/").reverse();
475 $scope.tmp1 = $scope.td1[2]; 521 $scope.tmp1 = $scope.td1[2];
476 $scope.td1[2] = $scope.td1[1]; 522 $scope.td1[2] = $scope.td1[1];
477 $scope.td1[1] = $scope.tmp1; 523 $scope.td1[1] = $scope.tmp1;
478 $scope.td = $scope.td1.join("-"); 524 $scope.td = $scope.td1.join("-");
479 525
480 analyticsService.getDRFHfpChart($scope.fd,$scope.td).then(function(result) { 526 analyticsService.getDRFHfpChart($scope.fd,$scope.td).then(function(result) {
481 // console.log("==date received==",$scope.fd); 527 // console.log("==date received==",$scope.fd);
482 //console.log("----to date received---",$scope.td) 528 //console.log("----to date received---",$scope.td)
483 $scope.datahfp = result; 529 $scope.datahfp = result;
484 }) 530 })
485 531
486 }else 532 }else
487 { 533 {
488 $scope.fillForm = true; 534 $scope.fillForm = true;
489 } 535 }
490 536
491 537
492 } 538 }
493 539
494 /*Date Range Filter for Customer Sources*/ 540 /*Date Range Filter for Customer Sources*/
495 $scope.submitDateCs = function(){ 541 $scope.submitDateCs = function(){
496
497 if ($scope.cs.fromDate === undefined) { 542 if ($scope.cs.fromDate === undefined) {
498 543
499 // console.log("==frmdate====",$scope.drf.fromDate);
500 //console.log("==toDate====",$scope.drf.toDate);
501 $scope.fillForm = true; 544 $scope.fillForm = true;
502 } 545 }
503 else if($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate ===''){ 546 else if($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate ===''){
504 $scope.fillForm = false; 547 $scope.fillForm = false;
505 var today= new Date(); 548 var today= new Date();
506 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2); 549 var DefaultToDate= today.getFullYear()+'-'+("0" + (today.getMonth() + 1)).slice(-2)+'-'+("0" + today.getDate()).slice(-2);
507 //from date format 550 //from date format
508 $scope.dat1 = $scope.cs.fromDate; 551 $scope.dat1 = $scope.cs.fromDate;
509 $scope.fd1 = $scope.dat1.split("/").reverse(); 552 $scope.fd1 = $scope.dat1.split("/").reverse();
510 $scope.tmp = $scope.fd1[2]; 553 $scope.tmp = $scope.fd1[2];
511 $scope.fd1[2] = $scope.fd1[1]; 554 $scope.fd1[2] = $scope.fd1[1];
512 $scope.fd1[1] = $scope.tmp; 555 $scope.fd1[1] = $scope.tmp;
513 $scope.fd = $scope.fd1.join("-"); 556 $scope.fd = $scope.fd1.join("-");
514 // console.log("===fd====",$scope.fd);
515 //console.log("----td curr---",DefaultToDate);
516 analyticsService.getDRFCSChart($scope.fd,DefaultToDate).then(function(result) { 557 analyticsService.getDRFCSChart($scope.fd,DefaultToDate).then(function(result) {
517 //console.log("==date received==",$scope.fd); 558 $scope.csValues = result;
518 //console.log("----to date receivedcurrent---",DefaultToDate) 559 $scope.optionscs = {
519 $scope.datacs = result; 560 chart: {
561 type: 'pieChart',
562 height: 500,
563 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
564 x: function(d){return d.key;},
565 y: function(d){return d.y;},
566 showLabels: false,
567 segmentShowStroke : false,
568 animationSteps : 20,
569 animationEasing : "linear",
570 animateScale : true,
571 duration: 500,
572 labelThreshold: 0.01,
573 labelSunbeamLayout: true,
574 legend: {
575 margin: {
576 top: 5,
577 right: 35,
578 bottom: 5,
579 left: 0
580 }
581 }
582 }
583 };
584 $scope.datacs = $scope.csValues;
520 }) 585 })
521 586
522 587
523 } else if($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined ){ 588 } else if($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined ){
524 $scope.fillForm = false; 589 $scope.fillForm = false;
525 //from date format 590 //from date format
526 $scope.dat1 = $scope.cs.fromDate; 591 $scope.dat1 = $scope.cs.fromDate;
527 $scope.fd1 = $scope.dat1.split("/").reverse(); 592 $scope.fd1 = $scope.dat1.split("/").reverse();
528 $scope.tmp = $scope.fd1[2]; 593 $scope.tmp = $scope.fd1[2];
529 $scope.fd1[2] = $scope.fd1[1]; 594 $scope.fd1[2] = $scope.fd1[1];
530 $scope.fd1[1] = $scope.tmp; 595 $scope.fd1[1] = $scope.tmp;
531 $scope.fd = $scope.fd1.join("-"); 596 $scope.fd = $scope.fd1.join("-");
532 //to date format 597 //to date format
533 $scope.dat2 = $scope.cs.toDate; 598 $scope.dat2 = $scope.cs.toDate;
534 $scope.td1 = $scope.dat2.split("/").reverse(); 599 $scope.td1 = $scope.dat2.split("/").reverse();
535 $scope.tmp1 = $scope.td1[2]; 600 $scope.tmp1 = $scope.td1[2];
536 $scope.td1[2] = $scope.td1[1]; 601 $scope.td1[2] = $scope.td1[1];
537 $scope.td1[1] = $scope.tmp1; 602 $scope.td1[1] = $scope.tmp1;
538 $scope.td = $scope.td1.join("-"); 603 $scope.td = $scope.td1.join("-");
539 604
540 analyticsService.getDRFCSChart($scope.fd,$scope.td).then(function(result) { 605 analyticsService.getDRFCSChart($scope.fd,$scope.td).then(function(result) {
541 // console.log("==date received==",$scope.fd); 606 $scope.csValues = result;
542 //console.log("----to date received---",$scope.td) 607 $scope.optionscs = {
543 $scope.datacs = result; 608 chart: {
609 type: 'pieChart',
610 height: 500,
611 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
612 x: function(d){return d.key;},
613 y: function(d){return d.y;},
614 showLabels: false,
615 segmentShowStroke : false,
616 animationSteps : 20,
617 animationEasing : "linear",
618 animateScale : true,
619 duration: 500,
620 labelThreshold: 0.01,
621 labelSunbeamLayout: true,
622 legend: {
623 margin: {
624 top: 5,
625 right: 35,
626 bottom: 5,
627 left: 0
628 }
629 }
630 }
631 };
632 $scope.datacs = $scope.csValues;
544 }) 633 })
545 634
546 }else 635 }else
547 { 636 {
548 $scope.fillForm = true; 637 $scope.fillForm = true;
549 } 638 }
550 639
551 640
552 } 641 }
553 642
554 643
app/partials/analytics/analytics.html
1 <style> 1 <style>
2 .chart-holder { 2 .chart-holder {
3 height: 325px; 3 height: 325px;
4 } 4 }
5 .cirque-stats { 5 .cirque-stats {
6 text-align: center; 6 text-align: center;
7 } 7 }
8 .cirque-stats .cirque-container { 8 .cirque-stats .cirque-container {
9 margin-top: 1.5em; 9 margin-top: 1.5em;
10 margin-bottom: 1.5em; 10 margin-bottom: 1.5em;
11 margin-right: 2em; 11 margin-right: 2em;
12 margin-left: 2em; 12 margin-left: 2em;
13 } 13 }
14 .subnavbar .mainnav > li:nth-child(3) > a{ 14 .subnavbar .mainnav > li:nth-child(3) > a{
15 color: #ff9900; 15 color: #ff9900;
16 } 16 }
17 .table { 17 .table {
18 border-collapse: separate; 18 border-collapse: separate;
19 padding: 0px; 19 padding: 0px;
20 20
21 } 21 }
22 22
23 23
24 24
25 25
26 </style> 26 </style>
27 <div class="main"> 27 <div class="main">
28 <div style="padding: 0 3%; margin-left: 15px;"> 28 <div style="padding: 0 3%; margin-left: 15px;">
29 <div class="row"> 29 <div class="row">
30 <div class="col-md-6"> 30 <div class="col-md-6">
31 <div class="customInputWrap"> 31 <div class="customInputWrap">
32 <div style="margin-left: 0px;"> 32 <div style="margin-left: 0px;">
33 <label>Date Range Filter</label> 33 <label>Date Range Filter</label>
34 <form name="myForm"> 34 <form name="myForm">
35 <input type="text" ng-model="drf.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/> 35 <input type="text" ng-model="drf.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/>
36 <input type="text" ng-model="drf.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;"> 36 <input type="text" ng-model="drf.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;">
37 <button class="btn btn-primary" ng-disabled="myForm.$invalid" ng-click="submitDate()" style="float: left; display: none;">Apply</button> 37 <button class="btn btn-primary" ng-disabled="myForm.$invalid" ng-click="submitDate()" style="float: left; display: none;">Apply</button>
38 <button class="btn btn-primary" ng-click="submitDate()" style="float: left;">Apply</button> 38 <button class="btn btn-primary" ng-click="submitDate()" style="float: left;">Apply</button>
39 <div class="clearfix"></div> 39 <div class="clearfix"></div>
40 </form> 40 </form>
41 </div> 41 </div>
42 <div class="clearfix"></div> 42 <div class="clearfix"></div>
43 </div> 43 </div>
44 <div class="widget stacked"> 44 <div class="widget stacked">
45 <div class="widget-header"> 45 <div class="widget-header">
46 <i class="icon-bar-chart"></i> 46 <i class="icon-bar-chart"></i>
47 <h3>Monthly Fuel Sales</h3> 47 <h3>Monthly Fuel Sales</h3>
48 </div> 48 </div>
49 <!-- /widget-header --> 49 <!-- /widget-header -->
50 <div class="widget-content"> 50 <div class="widget-content">
51 <nvd3 options="optionsmfs" data="datamfs"></nvd3> 51 <nvd3 options="optionsmfs" data="datamfs"></nvd3>
52 <!-- /bar-chart --> 52 <!-- /bar-chart -->
53 </div> 53 </div>
54 <!-- /widget-content --> 54 <!-- /widget-content -->
55 </div> 55 </div>
56 <!-- /widget --> 56 <!-- /widget -->
57 </div> 57 </div>
58 <!-- /.span6 --> 58 <!-- /.span6 -->
59 <div class="col-md-6"> 59 <div class="col-md-6">
60 <div class="customInputWrap"> 60 <div class="customInputWrap">
61 <div style="margin-left: 0px;"> 61 <div style="margin-left: 0px;">
62 <label>Date Range Filter</label> 62 <label>Date Range Filter</label>
63 <form name="myForm1"> 63 <form name="myForm1">
64 <input type="text" ng-model="hfp.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/> 64 <input type="text" ng-model="hfp.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/>
65 <input type="text" ng-model="hfp.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;"> 65 <input type="text" ng-model="hfp.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;">
66 <button class="btn btn-primary" ng-disabled="myForm1.$invalid" ng-click="submitDateHfp()" style="float: left; display: none;">Apply</button> 66 <button class="btn btn-primary" ng-disabled="myForm1.$invalid" ng-click="submitDateHfp()" style="float: left; display: none;">Apply</button>
67 <button class="btn btn-primary" ng-click="submitDateHfp()" style="float: left;">Apply</button> 67 <button class="btn btn-primary" ng-click="submitDateHfp()" style="float: left;">Apply</button>
68 <div class="clearfix"></div> 68 <div class="clearfix"></div>
69 </form> 69 </form>
70 </div> 70 </div>
71 <div class="clearfix"></div> 71 <div class="clearfix"></div>
72 </div> 72 </div>
73 <div class="widget stacked"> 73 <div class="widget stacked">
74 <div class="widget-header"> 74 <div class="widget-header">
75 <i class="icon-bar-chart"></i> 75 <i class="icon-bar-chart"></i>
76 <h3>Historic Fuel Pricing</h3> 76 <h3>Historic Fuel Pricing</h3>
77 </div> 77 </div>
78 <!-- /widget-header --> 78 <!-- /widget-header -->
79 <div class="widget-content"> 79 <div class="widget-content">
80 <nvd3 options="optionshfp" data="datahfp"></nvd3> 80 <nvd3 options="optionshfp" data="datahfp"></nvd3>
81 <!-- /pie-chart --> 81 <!-- /pie-chart -->
82 </div> 82 </div>
83 <!-- /widget-content --> 83 <!-- /widget-content -->
84 </div> 84 </div>
85 <!-- /widget --> 85 <!-- /widget -->
86 </div> 86 </div>
87 <!-- /span6 --> 87 <!-- /span6 -->
88 </div> 88 </div>
89 <div class="row"></div> 89 <div class="row"></div>
90 <div class="row"> 90 <div class="row">
91 <div class="col-md-6"> 91 <div class="col-md-6">
92 <div class="customInputWrap"> 92 <div class="customInputWrap">
93 <div style="margin-left: 0px;"> 93 <div style="margin-left: 0px;">
94 <label>Date Range Filter</label> 94 <label>Date Range Filter</label>
95 <form name="myForm2"> 95 <form name="myForm2">
96 <input type="text" ng-model="cs.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/> 96 <input type="text" ng-model="cs.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/>
97 <input type="text" ng-model="cs.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;"> 97 <input type="text" ng-model="cs.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;">
98 <button class="btn btn-primary" ng-disabled="myForm2.$invalid" ng-click="submitDateCs()" style="float: left; display: none;">Apply</button> 98 <button class="btn btn-primary" ng-disabled="myForm2.$invalid" ng-click="submitDateCs()" style="float: left; display: none;">Apply</button>
99 <button class="btn btn-primary" ng-click="submitDateCs()" style="float: left;">Apply</button> 99 <button class="btn btn-primary" ng-click="submitDateCs()" style="float: left;">Apply</button>
100 <div class="clearfix"></div> 100 <div class="clearfix"></div>
101 </form> 101 </form>
102 </div> 102 </div>
103 <div class="clearfix"></div> 103 <div class="clearfix"></div>
104 </div> 104 </div>
105 <div class="widget stacked"> 105 <div class="widget stacked">
106 <div class="widget-header"> 106 <div class="widget-header">
107 <i class="icon-bar-chart"></i> 107 <i class="icon-bar-chart"></i>
108 <h3>Customer Sources</h3> 108 <h3>Customer Sources</h3>
109 </div> 109 </div>
110 <!-- /widget-header --> 110 <!-- /widget-header -->
111 <div class="widget-content"> 111 <div class="widget-content">
112 <div style="margin-left: -15px;"> 112 <div style="margin-left: -15px;">
113 <nvd3 options="optionscs" class="custom-graph" data="datacs"></nvd3> 113 <nvd3 options="optionscs" class="custom-graph" data="datacs"></nvd3>
114 </div> 114 </div>
115 <!-- /pie-chart --> 115 <!-- /pie-chart -->
116 </div> 116 </div>
117 <!-- /widget-content --> 117 <!-- /widget-content -->
118 </div> 118 </div>
119 <!-- /widget --> 119 <!-- /widget -->
120 </div> 120 </div>
121 <!-- /span6 --> 121 <!-- /span6 -->
122 <div class="col-md-6"> 122 <div class="col-md-6">
123 <div class="customInputWrap"> 123 <div class="customInputWrap">
124 <div style="margin-top: 75px"> 124 <div style="margin-top: 75px">
125 <!-- <label>Date Range Filter</label> 125 <!-- <label>Date Range Filter</label>
126 <form name="myForm3"> 126 <form name="myForm3">
127 <input type="text" ng-model="rpp.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/> 127 <input type="text" ng-model="rpp.fromDate" datepicker class="form-control" placeholder="From Date" required ng-required="true" style="width: 120px; float: left; margin-right: 15px;"/>
128 <input type="text" ng-model="rpp.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;"> 128 <input type="text" ng-model="rpp.toDate" datepicker class="form-control" placeholder="To Date" style="width: 120px; float: left; margin-right: 15px;">
129 <button class="btn btn-primary" ng-disabled="myForm3.$invalid" ng-click="submitDateRpp()" style="float: left; display: none;">Apply</button> 129 <button class="btn btn-primary" ng-disabled="myForm3.$invalid" ng-click="submitDateRpp()" style="float: left; display: none;">Apply</button>
130 <button class="btn btn-primary" ng-click="submitDateRpp()" style="float: left;">Apply</button> 130 <button class="btn btn-primary" ng-click="submitDateRpp()" style="float: left;">Apply</button>
131 <div class="clearfix"></div> 131 <div class="clearfix"></div>
132 </form> --> 132 </form> -->
133 </div> 133 </div>
134 <div class="clearfix"></div> 134 <div class="clearfix"></div>
135 </div> 135 </div>
136 <div class="widget stacked"> 136 <div class="widget stacked">
137 <div class="widget-header"> 137 <div class="widget-header">
138 <i class="icon-bar-chart"></i> 138 <i class="icon-bar-chart"></i>
139 <h3>Regional PAP Pricing</h3> 139 <h3>Regional PAP Pricing</h3>
140 </div> 140 </div>
141 <!-- /widget-header --> 141 <!-- /widget-header -->
142 <div class="widget-content"> 142 <div class="widget-content">
143 <div id="map" style="width: 100%; height: 325px;"></div> 143 <div id="map" style="width: 100%; height: 325px;"></div>
144 </div> 144 </div>
145 <!-- /widget-content --> 145 <!-- /widget-content -->
146 </div> 146 </div>
147 <!-- /widget --> 147 <!-- /widget -->
148 </div> 148 </div>
149 <!-- /.span6 --> 149 <!-- /.span6 -->
150 </div> 150 </div>
151 </div> 151 </div>
152 <!-- /container --> 152 <!-- /container -->
153 </div> 153 </div>
154 <!-- /main --> 154 <!-- /main -->
155 <div class="customConfirmPopBackdrop" id="popup1">
156 <div class="customModalInner" style="max-width: 400px;">
157 <div class="customModelBody" style="border-radius: 5px 5px 0 0;max-height: 200px;overflow: hidden;overflow-y: auto;"">
158 <table border="1">
159
160 <tr>
161 <th style="padding: 5px">Region</th>
162 <th style="padding: 5px">Average PAP</th>
163 </tr>
164 <tr ng-repeat="data in rppData">
165 <td style="padding: 5px">
166 {{data.region}}
167 </td>
168 <td style="padding: 5px">
169 {{data.averagePAP | number :4 }}
170 </td>
171 </tr>
172 </table>
173 </div>
174 <div class="customModelFooter text-right" style="border-top: 0px !important">
175 <button class="btn btn-primary" style="padding: 4px 0; width: 80px;" ng-click="cancelStatus()">Close</button>
176 </div>
177 </div>
178 </div>
179 <div class="myLoader" ng-show="showLoader">
180 <img src="../img/hourglass.gif" width="50px;">
181 </div>
182
155 183
156 184
app/partials/analytics/analytics.service.js
1 (function(){ 1 (function(){
2 'use strict'; 2 'use strict';
3 angular.module('acufuel') 3 angular.module('acufuel')
4 .service('analyticsService', ['$q', '$http', 'BASE_URL',analyticsService]); 4 .service('analyticsService', ['$q', '$http', 'BASE_URL',analyticsService]);
5 5
6 function analyticsService($q, $http, BASE_URL) { 6 function analyticsService($q, $http, BASE_URL) {
7 var temp = {}; 7 var temp = {};
8 8
9 9
10 this.getMFS = function(){ 10 this.getMFS = function(){
11 var deferred = $q.defer(); 11 var deferred = $q.defer();
12 $http({ 12 $http({
13 method : 'GET', 13 method : 'GET',
14 // url : BASE_URL.url +'/fuelOrder/export/mfs' 14 // url : BASE_URL.url +'/fuelOrder/export/mfs'
15 url : BASE_URL.url + '/fuelOrder/analytics' 15 url : BASE_URL.url + '/fuelOrder/analytics'
16 }) 16 })
17 .then(function (result){ 17 .then(function (result){
18 deferred.resolve(result.data); 18 deferred.resolve(result.data);
19 },function (result){ 19 },function (result){
20 console.log(result) 20 console.log(result)
21 deferred.resolve(result.data); 21 deferred.resolve(result.data);
22 }) 22 })
23 return deferred.promise; 23 return deferred.promise;
24 } 24 }
25 25
26 26
27 27
28 this.getCS = function(){ 28 this.getCS = function(){
29 var deferred = $q.defer(); 29 var deferred = $q.defer();
30 $http({ 30 $http({
31 method : 'GET', 31 method : 'GET',
32 url : BASE_URL.url +'/user/sources' 32 url : BASE_URL.url +'/user/sources'
33 }) 33 })
34 .then(function (result){ 34 .then(function (result){
35 deferred.resolve(result.data); 35 deferred.resolve(result.data);
36 },function (result){ 36 },function (result){
37 console.log(result) 37 console.log(result)
38 deferred.resolve(result.data); 38 deferred.resolve(result.data);
39 }) 39 })
40 return deferred.promise; 40 return deferred.promise;
41 } 41 }
42 42
43 this.getRPP = function(code){
44 var deferred = $q.defer();
45 $http({
46 method : 'GET',
47 url : BASE_URL.url +'/fuelerlinx/getAircrafts/'+code
48 })
49 .then(function (result){
50 deferred.resolve(result.data);
51 },function (result){
52 console.log(result)
53 deferred.resolve(result.data);
54 })
55 return deferred.promise;
56 }
57
58
43 /*---date filter for Monthly fuel sales chart - dates are sending to the api */ 59 /*---date filter for Monthly fuel sales chart - dates are sending to the api */
44 this.getDRFChart = function(fd,td){ 60 this.getDRFChart = function(fd,td){
45 var deferred = $q.defer(); 61 var deferred = $q.defer();
46 $http({ 62 $http({
47 method : 'GET', 63 method : 'GET',
48 url : BASE_URL.url + '/fuelOrder/filterchart?fromDate='+fd+'&toDate='+td+'' 64 url : BASE_URL.url + '/fuelOrder/filterchart?fromDate='+fd+'&toDate='+td+''
49 }) 65 })
50 .then(function (result){ 66 .then(function (result){
51 deferred.resolve(result.data); 67 deferred.resolve(result.data);
52 },function (result){ 68 },function (result){
53 console.log(result) 69 console.log(result)
54 deferred.resolve(result.data); 70 deferred.resolve(result.data);
55 }) 71 })
56 return deferred.promise; 72 return deferred.promise;
57 } 73 }
58 74
59 /*---date filter for Historic Fuel price --- DRF--Date Range Filter */ 75 /*---date filter for Historic Fuel price --- DRF--Date Range Filter */
60 this.getDRFHfpChart = function(fd,td){ 76 this.getDRFHfpChart = function(fd,td){
61 var deferred = $q.defer(); 77 var deferred = $q.defer();
62 $http({ 78 $http({
63 method : 'GET', 79 method : 'GET',
64 url : BASE_URL.url + '/fuelOrder/hfp/filterchart?fromDate='+fd+'&toDate='+td+'' 80 url : BASE_URL.url + '/fuelOrder/hfp/filterchart?fromDate='+fd+'&toDate='+td+''
65 }) 81 })
66 .then(function (result){ 82 .then(function (result){
67 deferred.resolve(result.data); 83 deferred.resolve(result.data);
68 },function (result){ 84 },function (result){
69 console.log(result) 85 console.log(result)
70 deferred.resolve(result.data); 86 deferred.resolve(result.data);
71 }) 87 })
72 return deferred.promise; 88 return deferred.promise;
73 } 89 }
74 90
75 /*---date filter for Customer Sources --- DRF--Date Range Filter */ 91 /*---date filter for Customer Sources --- DRF--Date Range Filter */
76 this.getDRFCSChart = function(fd,td){ 92 this.getDRFCSChart = function(fd,td){
77 var deferred = $q.defer(); 93 var deferred = $q.defer();
78 $http({ 94 $http({
79 method : 'GET', 95 method : 'GET',
80 url : BASE_URL.url + '/fuelOrder/cs/filterchart?fromDate='+fd+'&toDate='+td+'' 96 url : BASE_URL.url + '/user/cs/filterchart?fromDate='+fd+'&toDate='+td+''
81 }) 97 })
82 .then(function (result){ 98 .then(function (result){
83 deferred.resolve(result.data); 99 deferred.resolve(result.data);
84 },function (result){ 100 },function (result){
85 console.log(result) 101 console.log(result)
86 deferred.resolve(result.data); 102 deferred.resolve(result.data);
87 }) 103 })
88 return deferred.promise; 104 return deferred.promise;
89 } 105 }
90 106
91 } 107 }
92 108
93 })(); 109 })();