Commit fcb9c5ee6a3ae047897a4bbab04cb0c1ced3e2d5

Authored by Kuldeep Arora
1 parent 633bbda7a4
Exists in master

monthly fuel chart- month diplay

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 5
6 // Sand Signika Overview without drill down -KD 6 // Sand Signika Overview without drill down -KD
7 /* $scope.getAllRegionalPap = function() { 7 /* $scope.getAllRegionalPap = function() {
8 $scope.flag=true; 8 $scope.flag=true;
9 $scope.stateList = [{region:'Alabama',code:'AL'},{region:'Alaska',code:'AK'},{region:'Arizona',code:'AZ'},{region:'Arkansas',code:'AR'}, 9 $scope.stateList = [{region:'Alabama',code:'AL'},{region:'Alaska',code:'AK'},{region:'Arizona',code:'AZ'},{region:'Arkansas',code:'AR'},
10 {region:'California',code:'CA' },{region:'Colorado',code:'CO'},{region:'Connecticut',code:'CT'},{region:'Delaware',code:'DE'}, 10 {region:'California',code:'CA' },{region:'Colorado',code:'CO'},{region:'Connecticut',code:'CT'},{region:'Delaware',code:'DE'},
11 {region:'Florida' ,code:'FL'},{region:'Georgia' ,code:'GA'},{region:'Hawaii' ,code:'HI'},{region:'Idaho' ,code:'ID'}, 11 {region:'Florida' ,code:'FL'},{region:'Georgia' ,code:'GA'},{region:'Hawaii' ,code:'HI'},{region:'Idaho' ,code:'ID'},
12 {region:'Illinois',code:'IL'},{region:'Indiana' ,code:'IN'},{region:'Iowa' ,code:'IA'},{region:'Kansas' ,code:'KS'}, 12 {region:'Illinois',code:'IL'},{region:'Indiana' ,code:'IN'},{region:'Iowa' ,code:'IA'},{region:'Kansas' ,code:'KS'},
13 {region:'Kentucky' ,code:'KY'},{region:'Louisiana' ,code:'LA'},{region:'Maine' ,code:'ME'},{region:'Maryland' ,code:'MD'}, 13 {region:'Kentucky' ,code:'KY'},{region:'Louisiana' ,code:'LA'},{region:'Maine' ,code:'ME'},{region:'Maryland' ,code:'MD'},
14 {region:'Massachusetts' ,code:'MA'},{region:'Michigan' ,code:'MI'},{region:'Minnesota' ,code:'MN'}, 14 {region:'Massachusetts' ,code:'MA'},{region:'Michigan' ,code:'MI'},{region:'Minnesota' ,code:'MN'},
15 {region:'Mississippi' ,code:'MS'},{region:'Missouri' ,code:'MO'},{region:'Montana',code:'MT'},{region:'Nebraska' ,code:'NE'}, 15 {region:'Mississippi' ,code:'MS'},{region:'Missouri' ,code:'MO'},{region:'Montana',code:'MT'},{region:'Nebraska' ,code:'NE'},
16 {region:'Nevada' ,code:'NV'},{region:'New Hampshire' ,code:'NH'},{region:'New Jersey' ,code:'NJ'},{region:'New Mexico' ,code:'NM'}, 16 {region:'Nevada' ,code:'NV'},{region:'New Hampshire' ,code:'NH'},{region:'New Jersey' ,code:'NJ'},{region:'New Mexico' ,code:'NM'},
17 {region:'New York' ,code:'NY'},{region:'North Carolina' ,code:'NC'},{region:'North Dakota' ,code:'ND'},{region:'Ohio' ,code:'OH'}, 17 {region:'New York' ,code:'NY'},{region:'North Carolina' ,code:'NC'},{region:'North Dakota' ,code:'ND'},{region:'Ohio' ,code:'OH'},
18 {region:'Oklahoma' ,code:'OK'},{region:'Oregon' ,code:'OR'},{region:'Pennsylvania',code:'PA'},{region:'Rhode Island' ,code:'RI'}, 18 {region:'Oklahoma' ,code:'OK'},{region:'Oregon' ,code:'OR'},{region:'Pennsylvania',code:'PA'},{region:'Rhode Island' ,code:'RI'},
19 {region:'South Carolina' ,code:'SC'},{region:'South Dakota' ,code:'SD'},{region:'Tennessee' ,code:'TN'},{region:'Texas' ,code:'TX'}, 19 {region:'South Carolina' ,code:'SC'},{region:'South Dakota' ,code:'SD'},{region:'Tennessee' ,code:'TN'},{region:'Texas' ,code:'TX'},
20 {region:'Utah' ,code:'UT'},{region:'Vermont' ,code:'VT'},{region:'Virginia' ,code:'VA'},{region:'Washington' ,code:'WA'}, 20 {region:'Utah' ,code:'UT'},{region:'Vermont' ,code:'VT'},{region:'Virginia' ,code:'VA'},{region:'Washington' ,code:'WA'},
21 {region:'West Virginia' ,code:'WV'},{region:'Wisconsin' ,code:'WI'},{region:'Wyoming',code:'WY'}] 21 {region:'West Virginia' ,code:'WV'},{region:'Wisconsin' ,code:'WI'},{region:'Wyoming',code:'WY'}]
22 22
23 analyticsService.getAllRPP().then(function(result) { 23 analyticsService.getAllRPP().then(function(result) {
24 for (var i = 0; i < $scope.stateList.length; i++) { 24 for (var i = 0; i < $scope.stateList.length; i++) {
25 for (var j = 0; j<result.length; j++){ 25 for (var j = 0; j<result.length; j++){
26 if ($scope.stateList[i].region === result[j].region) { 26 if ($scope.stateList[i].region === result[j].region) {
27 result[j].code = $scope.stateList[i].code; 27 result[j].code = $scope.stateList[i].code;
28 result[j].averagePAP = result[j].averagePAP.toFixed(2); 28 result[j].averagePAP = result[j].averagePAP.toFixed(2);
29 } 29 }
30 } 30 }
31 } 31 }
32 $scope.flag=false; 32 $scope.flag=false;
33 // Instantiate the map 33 // Instantiate the map
34 Highcharts.mapChart('regional-pap', { 34 Highcharts.mapChart('regional-pap', {
35 35
36 chart: { 36 chart: {
37 map: 'countries/us/us-all', 37 map: 'countries/us/us-all',
38 borderWidth: 1, 38 borderWidth: 1,
39 }, 39 },
40 40
41 title: { 41 title: {
42 text: 'Regional PAP' 42 text: 'Regional PAP'
43 }, 43 },
44 44
45 exporting: { 45 exporting: {
46 sourceWidth: 600, 46 sourceWidth: 600,
47 sourceHeight: 500 47 sourceHeight: 500
48 }, 48 },
49 49
50 legend: { 50 legend: {
51 layout: 'vertical', 51 layout: 'vertical',
52 borderWidth: 0, 52 borderWidth: 0,
53 backgroundColor: 'rgba(255,255,255,0.85)', 53 backgroundColor: 'rgba(255,255,255,0.85)',
54 floating: true, 54 floating: true,
55 width:'12px', 55 width:'12px',
56 height:'200px', 56 height:'200px',
57 verticalAlign: 'bottom', 57 verticalAlign: 'bottom',
58 y: 0, 58 y: 0,
59 x: -230, 59 x: -230,
60 }, 60 },
61 61
62 mapNavigation: { 62 mapNavigation: {
63 enabled: true 63 enabled: true
64 }, 64 },
65 65
66 colorAxis: { 66 colorAxis: {
67 min: 1, 67 min: 1,
68 type: 'logarithmic', 68 type: 'logarithmic',
69 minColor: '#2b908f', 69 minColor: '#2b908f',
70 maxColor: '#000022', 70 maxColor: '#000022',
71 stops: [ 71 stops: [
72 [0, '#EFEFFF'], 72 [0, '#EFEFFF'],
73 [5, '#f45b5b'], 73 [5, '#f45b5b'],
74 [10, 'rgb(117,0,0)'] 74 [10, 'rgb(117,0,0)']
75 ] 75 ]
76 }, 76 },
77 77
78 series: [{ 78 series: [{
79 animation: { 79 animation: {
80 duration: 1000 80 duration: 1000
81 }, 81 },
82 data: result, 82 data: result,
83 joinBy: ['postal-code', 'code'], 83 joinBy: ['postal-code', 'code'],
84 dataLabels: { 84 dataLabels: {
85 enabled: true, 85 enabled: true,
86 color: '#FFFFFF', 86 color: '#FFFFFF',
87 format: '{point.code}' 87 format: '{point.code}'
88 }, 88 },
89 name: 'Data' , 89 name: 'Data' ,
90 tooltip: { 90 tooltip: {
91 pointFormat: '{point.region} : {point.averagePAP}' 91 pointFormat: '{point.region} : {point.averagePAP}'
92 }, 92 },
93 }] 93 }]
94 }); 94 });
95 }) 95 })
96 } 96 }
97 97
98 $scope.getAllRegionalPap();*/ 98 $scope.getAllRegionalPap();*/
99 99
100 100
101 //Implemented drill down chart and Now used this on 07 Sep 2018 -KD 101 //Implemented drill down chart and Now used this on 07 Sep 2018 -KD
102 102
103 /* 103 /*
104 TODO: 104 TODO:
105 - Check data labels after drilling. Label rank? New positions? 105 - Check data labels after drilling. Label rank? New positions?
106 */ 106 */
107 $scope.getAllRegionalPapDrilldown = function() { 107 $scope.getAllRegionalPapDrilldown = function() {
108 $scope.flag=true;//for spinner 108 $scope.flag=true;//for spinner
109 var data = Highcharts.geojson(Highcharts.maps['countries/us/us-all']); 109 var data = Highcharts.geojson(Highcharts.maps['countries/us/us-all']);
110 var separators = Highcharts.geojson(Highcharts.maps['countries/us/us-all'], 'mapline'); 110 var separators = Highcharts.geojson(Highcharts.maps['countries/us/us-all'], 'mapline');
111 // Some responsiveness 111 // Some responsiveness
112 //var small = $('#container').width() < 400; 112 //var small = $('#container').width() < 400;
113 113
114 analyticsService.getAllRPP().then(function(result) { 114 analyticsService.getAllRPP().then(function(result) {
115 for (var i = 0; i < data.length; i++) { 115 for (var i = 0; i < data.length; i++) {
116 for (var j = 0; j<result.length; j++){ 116 for (var j = 0; j<result.length; j++){
117 if (data[i].name === result[j].region) { 117 if (data[i].name === result[j].region) {
118 118
119 data[i].value = result[j].averagePAP.toFixed(2); 119 data[i].value = result[j].averagePAP.toFixed(2);
120 120
121 } 121 }
122 } 122 }
123 123
124 } 124 }
125 125
126 $.each(data, function (i) { 126 $.each(data, function (i) {
127 this.drilldown = this.properties['hc-key']; 127 this.drilldown = this.properties['hc-key'];
128 this.value = this.value; 128 this.value = this.value;
129 }); 129 });
130 130
131 $scope.flag=false; 131 $scope.flag=false;
132 // Instantiate the map 132 // Instantiate the map
133 Highcharts.mapChart('container', { 133 Highcharts.mapChart('container', {
134 chart: { 134 chart: {
135 events: { 135 events: {
136 drilldown: function (e) { 136 drilldown: function (e) {
137 if (!e.seriesOptions) { 137 if (!e.seriesOptions) {
138 var chart = this, 138 var chart = this,
139 mapKey = 'countries/us/' + e.point.drilldown + '-all', 139 mapKey = 'countries/us/' + e.point.drilldown + '-all',
140 140
141 // Handle error, the timeout is cleared on success 141 // Handle error, the timeout is cleared on success
142 fail = setTimeout(function () { 142 fail = setTimeout(function () {
143 if (!Highcharts.maps[mapKey]) { 143 if (!Highcharts.maps[mapKey]) {
144 chart.showLoading('<i class="icon-frown"></i> Failed loading ' + e.point.name); 144 chart.showLoading('<i class="icon-frown"></i> Failed loading ' + e.point.name);
145 fail = setTimeout(function () { 145 fail = setTimeout(function () {
146 chart.hideLoading(); 146 chart.hideLoading();
147 }, 1000); 147 }, 1000);
148 } 148 }
149 }, 3000); 149 }, 3000);
150 150
151 // Show the spinner 151 // Show the spinner
152 chart.showLoading('<i class="icon-spinner icon-spin icon-3x"></i>'); // Font Awesome spinner 152 chart.showLoading('<i class="icon-spinner icon-spin icon-3x"></i>'); // Font Awesome spinner
153 153
154 // Load the drilldown map 154 // Load the drilldown map
155 $.getScript('https://code.highcharts.com/mapdata/' + mapKey + '.js', function () { 155 $.getScript('https://code.highcharts.com/mapdata/' + mapKey + '.js', function () {
156 156
157 var region = e.point.name; 157 var region = e.point.name;
158 //called the get api region wise 158 //called the get api region wise
159 analyticsService.getRPP(region).then(function(result) { 159 analyticsService.getRPP(region).then(function(result) {
160 160
161 data = Highcharts.geojson(Highcharts.maps[mapKey]); 161 data = Highcharts.geojson(Highcharts.maps[mapKey]);
162 162
163 for (var i = 0; i < data.length; i++) { 163 for (var i = 0; i < data.length; i++) {
164 for (var j = 0; j<result.length; j++){ 164 for (var j = 0; j<result.length; j++){
165 165
166 //delete the County word from api result to match with map data 166 //delete the County word from api result to match with map data
167 result[j].region = result[j].region.replace("County",""); 167 result[j].region = result[j].region.replace("County","");
168 168
169 if (data[i].name.trim() === result[j].region.trim()) { 169 if (data[i].name.trim() === result[j].region.trim()) {
170 170
171 data[i].value = result[j].averagePAP.toFixed(2); 171 data[i].value = result[j].averagePAP.toFixed(2);
172 172
173 } 173 }
174 } 174 }
175 175
176 } 176 }
177 }) 177 })
178 178
179 // Set a non-random bogus value 179 // Set a non-random bogus value
180 180
181 $.each(data, function (i) { 181 $.each(data, function (i) {
182 this.value = this.value; 182 this.value = this.value;
183 }); 183 });
184 184
185 // Hide loading and add series 185 // Hide loading and add series
186 chart.hideLoading(); 186 chart.hideLoading();
187 clearTimeout(fail); 187 clearTimeout(fail);
188 chart.addSeriesAsDrilldown(e.point, { 188 chart.addSeriesAsDrilldown(e.point, {
189 name: e.point.name, 189 name: e.point.name,
190 data: data, 190 data: data,
191 dataLabels: { 191 dataLabels: {
192 enabled: true, 192 enabled: true,
193 format: '{point.name}' 193 format: '{point.name}'
194 } 194 }
195 }); 195 });
196 }); 196 });
197 } 197 }
198 198
199 this.setTitle(null, { text: e.point.name }); 199 this.setTitle(null, { text: e.point.name });
200 }, 200 },
201 drillup: function () { 201 drillup: function () {
202 this.setTitle(null, { text: '' }); 202 this.setTitle(null, { text: '' });
203 } 203 }
204 } 204 }
205 }, 205 },
206 206
207 title: { 207 title: {
208 text: 'USA Map-Drilldown for Regional Pricing' 208 text: 'USA Map-Drilldown for Regional Pricing'
209 }, 209 },
210 210
211 subtitle: { 211 subtitle: {
212 text: '', 212 text: '',
213 floating: true, 213 floating: true,
214 align: 'right', 214 align: 'right',
215 y: 50, 215 y: 50,
216 style: { 216 style: {
217 fontSize: '16px' 217 fontSize: '16px'
218 } 218 }
219 }, 219 },
220 220
221 /* legend: small ? {} : { 221 /* legend: small ? {} : {
222 layout: 'vertical', 222 layout: 'vertical',
223 align: 'right', 223 align: 'right',
224 verticalAlign: 'middle' 224 verticalAlign: 'middle'
225 }, 225 },
226 226
227 colorAxis: { 227 colorAxis: {
228 min: 0, 228 min: 0,
229 minColor: '#E6E7E8', 229 minColor: '#E6E7E8',
230 maxColor: '#005645' 230 maxColor: '#005645'
231 },*/ 231 },*/
232 232
233 mapNavigation: { 233 mapNavigation: {
234 enabled: true, 234 enabled: true,
235 buttonOptions: { 235 buttonOptions: {
236 verticalAlign: 'bottom' 236 verticalAlign: 'bottom'
237 } 237 }
238 }, 238 },
239 239
240 plotOptions: { 240 plotOptions: {
241 map: { 241 map: {
242 states: { 242 states: {
243 hover: { 243 hover: {
244 color: '#EEDD66' 244 color: '#EEDD66'
245 } 245 }
246 } 246 }
247 } 247 }
248 }, 248 },
249 249
250 series: [{ 250 series: [{
251 data: data, 251 data: data,
252 name: 'USA', 252 name: 'USA',
253 dataLabels: { 253 dataLabels: {
254 enabled: true, 254 enabled: true,
255 format: '{point.properties.postal-code}' 255 format: '{point.properties.postal-code}'
256 } 256 }
257 }, { 257 }, {
258 type: 'mapline', 258 type: 'mapline',
259 data: separators, 259 data: separators,
260 color: 'silver', 260 color: 'silver',
261 enableMouseTracking: false, 261 enableMouseTracking: false,
262 animation: { 262 animation: {
263 duration: 500 263 duration: 500
264 } 264 }
265 }], 265 }],
266 266
267 drilldown: { 267 drilldown: {
268 activeDataLabelStyle: { 268 activeDataLabelStyle: {
269 color: '#FFFFFF', 269 color: '#FFFFFF',
270 textDecoration: 'none', 270 textDecoration: 'none',
271 textOutline: '1px #000000' 271 textOutline: '1px #000000'
272 }, 272 },
273 drillUpButton: { 273 drillUpButton: {
274 relativeTo: 'spacingBox', 274 relativeTo: 'spacingBox',
275 position: { 275 position: {
276 x: 0, 276 x: 0,
277 y: 60 277 y: 60
278 } 278 }
279 } 279 }
280 } 280 }
281 }); 281 });
282 }) 282 })
283 } 283 }
284 284
285 $scope.getAllRegionalPapDrilldown(); 285 $scope.getAllRegionalPapDrilldown();
286 286
287 287
288 /*$(document).ready(function() { 288 /*$(document).ready(function() {
289 $(function() { 289 $(function() {
290 jQuery('#map').vectorMap({ 290 jQuery('#map').vectorMap({
291 map: 'us_lcc', 291 map: 'us_lcc',
292 backgroundColor: '#ffce99', 292 backgroundColor: '#ffce99',
293 color: '#dfdfdd', 293 color: '#dfdfdd',
294 hoverOpacity: 0, 294 hoverOpacity: 0,
295 selectedColor: '#5f8b98', 295 selectedColor: '#5f8b98',
296 hoverColor: '#5f8b98', 296 hoverColor: '#5f8b98',
297 enableZoom: true, 297 enableZoom: true,
298 showTooltip: true, 298 showTooltip: true,
299 scaleColors: ['#dfdfdd'], 299 scaleColors: ['#dfdfdd'],
300 //values: sample_data 300 //values: sample_data
301 onRegionClick: function(event, code) { 301 onRegionClick: function(event, code) {
302 var map = $('#map').vectorMap('get', 'mapObject'); 302 var map = $('#map').vectorMap('get', 'mapObject');
303 var name = map.getRegionName(code); 303 var name = map.getRegionName(code);
304 getRegionPap(name); 304 getRegionPap(name);
305 }, 305 },
306 normalizeFunction: 'polynomial' 306 normalizeFunction: 'polynomial'
307 }); 307 });
308 }); 308 });
309 }) 309 })
310 310
311 311
312 312
313 function getRegionPap(code) { 313 function getRegionPap(code) {
314 $scope.showLoader = true; 314 $scope.showLoader = true;
315 analyticsService.getRPP(code).then(function(result) { 315 analyticsService.getRPP(code).then(function(result) {
316 $scope.rppData = result; 316 $scope.rppData = result;
317 $scope.showLoader = false; 317 $scope.showLoader = false;
318 $('#popup1').css('display', 'block'); 318 $('#popup1').css('display', 'block');
319 }) 319 })
320 }*/ 320 }*/
321 321
322 322
323 $scope.cancelStatus = function() { 323 $scope.cancelStatus = function() {
324 $('#popup1').css('display', 'none'); 324 $('#popup1').css('display', 'none');
325 } 325 }
326 $scope.ordersCost = 0; 326 $scope.ordersCost = 0;
327 $scope.ordersCount = 0; 327 $scope.ordersCount = 0;
328 328
329 $scope.orderCostAndCount = function() { 329 $scope.orderCostAndCount = function() {
330 analyticsService.orderCostAndCount().then(function(result) { 330 analyticsService.orderCostAndCount().then(function(result) {
331 $scope.ordersCost = result.cost; 331 $scope.ordersCost = result.cost;
332 $scope.ordersCount = result.count; 332 $scope.ordersCount = result.count;
333 }) 333 })
334 } 334 }
335 335
336 $scope.drf = {}; 336 $scope.drf = {};
337 $scope.hfp = {}; 337 $scope.hfp = {};
338 $scope.cs = {}; 338 $scope.cs = {};
339 $scope.mfsValues = []; 339 $scope.mfsValues = [];
340 $scope.msfarray = []; 340 $scope.msfarray = [];
341 $scope.getMFS = function() { 341 $scope.getMFS = function() {
342 //var makeId = makeId; 342 //var makeId = makeId;
343 analyticsService.getMFS().then(function(result) { 343 analyticsService.getMFS().then(function(result) {
344 $scope.mfsValues = result; 344 $scope.mfsValues = result;
345 $scope.optionsmfs = { 345 $scope.optionsmfs = {
346 chart: { 346 chart: {
347 type: 'multiBarChart', 347 type: 'multiBarChart',
348 height: 450, 348 height: 450,
349 reduceXTicks: false,
349 margin: { 350 margin: {
350 top: 45, 351 top: 45,
351 right: 20, 352 right: 20,
352 bottom: 45, 353 bottom: 45,
353 left: 45 354 left: 45
354 }, 355 },
355 clipEdge: true, 356 clipEdge: true,
356 //staggerLabels: true, 357 //staggerLabels: true,
357 duration: 500, 358 duration: 500,
358 stacked: false, 359 stacked: false,
359 /*color: ["#FEDFC3", "#990000", "#000099", "#009900"],*/ 360 /*color: ["#FEDFC3", "#990000", "#000099", "#009900"],*/
360 color: ["#A9A9A9", "#000099", "#990000", "#009900"], 361 color: ["#A9A9A9", "#000099", "#990000", "#009900"],
361 xAxis: { 362 xAxis: {
362 axisLabel: 'Months', 363 axisLabel: 'Months',
363 showMaxMin: false, 364 showMaxMin: false,
364 }, 365 },
365 yAxis: { 366 yAxis: {
366 axisLabel: 'Orders', 367 axisLabel: 'Orders',
367 axisLabelDistance: -20, 368 axisLabelDistance: -20,
368 tickFormat: function(d) { 369 tickFormat: function(d) {
369 return d3.format(',.1f')(d); 370 return d3.format(',.1f')(d);
370 } 371 }
371 } 372 }
373
372 } 374 }
373 }; 375 };
374 $scope.datamfs = $scope.mfsValues; 376 $scope.datamfs = $scope.mfsValues;
375 }) 377 })
376 } 378 }
377 379
378 $scope.orderCostAndCount(); 380 $scope.orderCostAndCount();
379 $scope.getMFS(); 381 $scope.getMFS();
380 $scope.csValues = []; 382 $scope.csValues = [];
381 $scope.getCS = function() { 383 $scope.getCS = function() {
382 //var makeId = makeId; 384 //var makeId = makeId;
383 analyticsService.getCS().then(function(result) { 385 analyticsService.getCS().then(function(result) {
384 $scope.csValues = result; 386 $scope.csValues = result;
385 $scope.optionscs = { 387 $scope.optionscs = {
386 chart: { 388 chart: {
387 type: 'pieChart', 389 type: 'pieChart',
388 height: 500, 390 height: 500,
389 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], 391 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
390 x: function(d) { 392 x: function(d) {
391 return d.key; 393 return d.key;
392 }, 394 },
393 y: function(d) { 395 y: function(d) {
394 return d.y; 396 return d.y;
395 }, 397 },
396 showLabels: false, 398 showLabels: false,
397 segmentShowStroke: false, 399 segmentShowStroke: false,
398 animationSteps: 20, 400 animationSteps: 20,
399 animationEasing: "linear", 401 animationEasing: "linear",
400 animateScale: true, 402 animateScale: true,
401 duration: 500, 403 duration: 500,
402 labelThreshold: 0.01, 404 labelThreshold: 0.01,
403 labelSunbeamLayout: true, 405 labelSunbeamLayout: true,
404 legend: { 406 legend: {
405 margin: { 407 margin: {
406 top: 5, 408 top: 5,
407 right: 35, 409 right: 35,
408 bottom: 5, 410 bottom: 5,
409 left: 0 411 left: 0
410 } 412 }
411 } 413 }
412 } 414 }
413 }; 415 };
414 $scope.datacs = $scope.csValues; 416 $scope.datacs = $scope.csValues;
415 }) 417 })
416 } 418 }
417 419
418 $scope.getCS(); 420 $scope.getCS();
419 421
420 422
421 $scope.hfpValues = []; 423 $scope.hfpValues = [];
422 $scope.getHfpChartData = function() { 424 $scope.getHfpChartData = function() {
423 //var makeId = makeId; 425 //var makeId = makeId;
424 analyticsService.gethfpChart().then(function(result) { 426 analyticsService.gethfpChart().then(function(result) {
425 $scope.hfpValues = result; 427 $scope.hfpValues = result;
426 //console.log('---kd result--',$scope.hfpValues); 428 //console.log('---kd result--',$scope.hfpValues);
427 429
428 /*Historic Fuel Price */ 430 /*Historic Fuel Price */
429 431
430 $scope.optionshfp = { 432 $scope.optionshfp = {
431 chart: { 433 chart: {
432 type: 'cumulativeLineChart', 434 type: 'cumulativeLineChart',
433 height: 450, 435 height: 450,
434 margin: { 436 margin: {
435 top: 40, 437 top: 40,
436 right: 20, 438 right: 20,
437 bottom: 50, 439 bottom: 50,
438 left: 65 440 left: 65
439 }, 441 },
440 x: function(d) { 442 x: function(d) {
441 return d[0]; 443 return d[0];
442 }, 444 },
443 y: function(d) { 445 y: function(d) {
444 return d[1] / 100 ; 446 return d[1] / 100 ;
445 }, 447 },
446 average: function(d) { 448 average: function(d) {
447 return d.mean / 100; 449 return d.mean / 100;
448 }, 450 },
449 451
450 color: ["#FEDFC3"], 452 color: ["#FEDFC3"],
451 duration: 300, 453 duration: 300,
452 useInteractiveGuideline: true, 454 useInteractiveGuideline: true,
453 clipVoronoi: false, 455 clipVoronoi: false,
454 456
455 xAxis: { 457 xAxis: {
456 axisLabel: '', 458 axisLabel: '',
457 459
458 tickFormat: function(d) { 460 tickFormat: function(d) {
459 return d3.time.format('%m/%d/%y')(new Date(d)) 461 return d3.time.format('%m/%d/%y')(new Date(d))
460 //return d3.time.format('%b \-%y')(new Date(d)) 462 //return d3.time.format('%b \-%y')(new Date(d))
461 }, 463 },
462 showMaxMin: false, 464 showMaxMin: false,
463 staggerLabels: true 465 staggerLabels: true
464 }, 466 },
465 467
466 yAxis: { 468 yAxis: {
467 axisLabel: 'PaP/Retail Price', 469 axisLabel: 'PaP/Retail Price',
468 470
469 tickFormat: function(d) { 471 tickFormat: function(d) {
470 //return d3.format('')(d).toFixed(2); 472 //return d3.format('')(d).toFixed(2);
471 return '$ '+d.toFixed(2) 473 return '$ '+d.toFixed(2)
472 }, 474 },
473 axisLabelDistance: 5 475 axisLabelDistance: 5
474 } 476 }
475 } 477 }
476 }; 478 };
477 $scope.datahfp = [{ 479 $scope.datahfp = [{
478 key: "Long", 480 key: "Long",
479 values: $scope.hfpValues, 481 values: $scope.hfpValues,
480 mean: 0 482 mean: 0
481 }]; 483 }];
482 484
483 }) 485 })
484 } 486 }
485 487
486 $scope.getHfpChartData(); 488 $scope.getHfpChartData();
487 489
488 490
489 /*Date Range Filter for Monthly fuel Sales*/ 491 /*Date Range Filter for Monthly fuel Sales*/
490 $scope.submitDate = function() { 492 $scope.submitDate = function() {
491 if ($scope.drf.fromDate === undefined) { 493 if ($scope.drf.fromDate === undefined) {
492 $scope.fillForm = true; 494 $scope.fillForm = true;
493 } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate === '') { 495 } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate === '') {
494 $scope.fillForm = false; 496 $scope.fillForm = false;
495 var today = new Date(); 497 var today = new Date();
496 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2); 498 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
497 //from date format 499 //from date format
498 $scope.dat1 = $scope.drf.fromDate; 500 $scope.dat1 = $scope.drf.fromDate;
499 $scope.fd1 = $scope.dat1.split("/").reverse(); 501 $scope.fd1 = $scope.dat1.split("/").reverse();
500 $scope.tmp = $scope.fd1[2]; 502 $scope.tmp = $scope.fd1[2];
501 $scope.fd1[2] = $scope.fd1[1]; 503 $scope.fd1[2] = $scope.fd1[1];
502 $scope.fd1[1] = $scope.tmp; 504 $scope.fd1[1] = $scope.tmp;
503 $scope.fd = $scope.fd1.join("-"); 505 $scope.fd = $scope.fd1.join("-");
504 analyticsService.getDRFChart($scope.fd, DefaultToDate).then(function(result) { 506 analyticsService.getDRFChart($scope.fd, DefaultToDate).then(function(result) {
505 $scope.datamfs = []; 507 $scope.datamfs = [];
506 $scope.datamfs = result; 508 $scope.datamfs = result;
507 }) 509 })
508 510
509 analyticsService.orderCostAndCountByDate($scope.fd, DefaultToDate).then(function(result) { 511 analyticsService.orderCostAndCountByDate($scope.fd, DefaultToDate).then(function(result) {
510 $scope.ordersCost = result.cost; 512 $scope.ordersCost = result.cost;
511 $scope.ordersCount = result.count; 513 $scope.ordersCount = result.count;
512 }) 514 })
513 } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined) { 515 } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined) {
514 $scope.fillForm = false; 516 $scope.fillForm = false;
515 //from date format 517 //from date format
516 $scope.dat1 = $scope.drf.fromDate; 518 $scope.dat1 = $scope.drf.fromDate;
517 $scope.fd1 = $scope.dat1.split("/").reverse(); 519 $scope.fd1 = $scope.dat1.split("/").reverse();
518 $scope.tmp = $scope.fd1[2]; 520 $scope.tmp = $scope.fd1[2];
519 $scope.fd1[2] = $scope.fd1[1]; 521 $scope.fd1[2] = $scope.fd1[1];
520 $scope.fd1[1] = $scope.tmp; 522 $scope.fd1[1] = $scope.tmp;
521 $scope.fd = $scope.fd1.join("-"); 523 $scope.fd = $scope.fd1.join("-");
522 $scope.dat2 = $scope.drf.toDate; 524 $scope.dat2 = $scope.drf.toDate;
523 $scope.td1 = $scope.dat2.split("/").reverse(); 525 $scope.td1 = $scope.dat2.split("/").reverse();
524 $scope.tmp1 = $scope.td1[2]; 526 $scope.tmp1 = $scope.td1[2];
525 $scope.td1[2] = $scope.td1[1]; 527 $scope.td1[2] = $scope.td1[1];
526 $scope.td1[1] = $scope.tmp1; 528 $scope.td1[1] = $scope.tmp1;
527 $scope.td = $scope.td1.join("-"); 529 $scope.td = $scope.td1.join("-");
528 530
529 analyticsService.getDRFChart($scope.fd, $scope.td).then(function(result) { 531 analyticsService.getDRFChart($scope.fd, $scope.td).then(function(result) {
530 $scope.datamfs = []; 532 $scope.datamfs = [];
531 $scope.datamfs = result; 533 $scope.datamfs = result;
532 }) 534 })
533 535
534 analyticsService.orderCostAndCountByDate($scope.fd, $scope.td).then(function(result) { 536 analyticsService.orderCostAndCountByDate($scope.fd, $scope.td).then(function(result) {
535 $scope.ordersCost = result.cost; 537 $scope.ordersCost = result.cost;
536 $scope.ordersCount = result.count; 538 $scope.ordersCount = result.count;
537 }) 539 })
538 540
539 } else { 541 } else {
540 $scope.fillForm = true; 542 $scope.fillForm = true;
541 } 543 }
542 544
543 545
544 } 546 }
545 547
546 /*Date Range Filter for Historic fuel Price*/ 548 /*Date Range Filter for Historic fuel Price*/
547 $scope.submitDateHfp = function() { 549 $scope.submitDateHfp = function() {
548 550
549 if ($scope.hfp.fromDate === undefined) { 551 if ($scope.hfp.fromDate === undefined) {
550 552
551 $scope.fillForm = true; 553 $scope.fillForm = true;
552 } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate === '') { 554 } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate === '') {
553 $scope.fillForm = false; 555 $scope.fillForm = false;
554 var today = new Date(); 556 var today = new Date();
555 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2); 557 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
556 //from date format 558 //from date format
557 $scope.dat1 = $scope.hfp.fromDate; 559 $scope.dat1 = $scope.hfp.fromDate;
558 $scope.fd1 = $scope.dat1.split("/").reverse(); 560 $scope.fd1 = $scope.dat1.split("/").reverse();
559 $scope.tmp = $scope.fd1[2]; 561 $scope.tmp = $scope.fd1[2];
560 $scope.fd1[2] = $scope.fd1[1]; 562 $scope.fd1[2] = $scope.fd1[1];
561 $scope.fd1[1] = $scope.tmp; 563 $scope.fd1[1] = $scope.tmp;
562 $scope.fd = $scope.fd1.join("-"); 564 $scope.fd = $scope.fd1.join("-");
563 analyticsService.getDRFHfpChart($scope.fd, DefaultToDate).then(function(result) { 565 analyticsService.getDRFHfpChart($scope.fd, DefaultToDate).then(function(result) {
564 $scope.hfpValues = result; 566 $scope.hfpValues = result;
565 $scope.optionshfp = { 567 $scope.optionshfp = {
566 chart: { 568 chart: {
567 type: 'cumulativeLineChart', 569 type: 'cumulativeLineChart',
568 height: 450, 570 height: 450,
569 margin: { 571 margin: {
570 top: 40, 572 top: 40,
571 right: 20, 573 right: 20,
572 bottom: 50, 574 bottom: 50,
573 left: 65 575 left: 65
574 }, 576 },
575 x: function(d) { 577 x: function(d) {
576 return d[0]; 578 return d[0];
577 }, 579 },
578 y: function(d) { 580 y: function(d) {
579 return d[1] / 100; 581 return d[1] / 100;
580 }, 582 },
581 average: function(d) { 583 average: function(d) {
582 return d.mean / 100; 584 return d.mean / 100;
583 }, 585 },
584 586
585 color: ["#FEDFC3"], 587 color: ["#FEDFC3"],
586 duration: 300, 588 duration: 300,
587 useInteractiveGuideline: true, 589 useInteractiveGuideline: true,
588 clipVoronoi: false, 590 clipVoronoi: false,
589 591
590 xAxis: { 592 xAxis: {
591 axisLabel: '', 593 axisLabel: '',
592 594
593 tickFormat: function(d) { 595 tickFormat: function(d) {
594 return d3.time.format('%d / %m / %y')(new Date(d)) 596 return d3.time.format('%d / %m / %y')(new Date(d))
595 // return d3.time.format('%b \-%y')(new Date(d)) 597 // return d3.time.format('%b \-%y')(new Date(d))
596 }, 598 },
597 showMaxMin: false, 599 showMaxMin: false,
598 staggerLabels: true 600 staggerLabels: true
599 }, 601 },
600 602
601 yAxis: { 603 yAxis: {
602 axisLabel: 'PaP/Retail Price', 604 axisLabel: 'PaP/Retail Price',
603 605
604 tickFormat: function(d) { 606 tickFormat: function(d) {
605 //return d3.format('')(d).toFixed(2); 607 //return d3.format('')(d).toFixed(2);
606 return '$ '+d.toFixed(2) 608 return '$ '+d.toFixed(2)
607 }, 609 },
608 axisLabelDistance: 5 610 axisLabelDistance: 5
609 } 611 }
610 } 612 }
611 }; 613 };
612 $scope.datahfp = [{ 614 $scope.datahfp = [{
613 key: "Long", 615 key: "Long",
614 values: $scope.hfpValues, 616 values: $scope.hfpValues,
615 mean: 0 617 mean: 0
616 }]; 618 }];
617 }) 619 })
618 620
619 621
620 } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined) { 622 } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined) {
621 $scope.fillForm = false; 623 $scope.fillForm = false;
622 //from date format 624 //from date format
623 $scope.dat1 = $scope.hfp.fromDate; 625 $scope.dat1 = $scope.hfp.fromDate;
624 $scope.fd1 = $scope.dat1.split("/").reverse(); 626 $scope.fd1 = $scope.dat1.split("/").reverse();
625 $scope.tmp = $scope.fd1[2]; 627 $scope.tmp = $scope.fd1[2];
626 $scope.fd1[2] = $scope.fd1[1]; 628 $scope.fd1[2] = $scope.fd1[1];
627 $scope.fd1[1] = $scope.tmp; 629 $scope.fd1[1] = $scope.tmp;
628 $scope.fd = $scope.fd1.join("-"); 630 $scope.fd = $scope.fd1.join("-");
629 //to date format 631 //to date format
630 $scope.dat2 = $scope.hfp.toDate; 632 $scope.dat2 = $scope.hfp.toDate;
631 $scope.td1 = $scope.dat2.split("/").reverse(); 633 $scope.td1 = $scope.dat2.split("/").reverse();
632 $scope.tmp1 = $scope.td1[2]; 634 $scope.tmp1 = $scope.td1[2];
633 $scope.td1[2] = $scope.td1[1]; 635 $scope.td1[2] = $scope.td1[1];
634 $scope.td1[1] = $scope.tmp1; 636 $scope.td1[1] = $scope.tmp1;
635 $scope.td = $scope.td1.join("-"); 637 $scope.td = $scope.td1.join("-");
636 638
637 analyticsService.getDRFHfpChart($scope.fd, $scope.td).then(function(result) { 639 analyticsService.getDRFHfpChart($scope.fd, $scope.td).then(function(result) {
638 $scope.hfpValues = result; 640 $scope.hfpValues = result;
639 $scope.optionshfp = { 641 $scope.optionshfp = {
640 chart: { 642 chart: {
641 type: 'cumulativeLineChart', 643 type: 'cumulativeLineChart',
642 height: 450, 644 height: 450,
643 margin: { 645 margin: {
644 top: 40, 646 top: 40,
645 right: 20, 647 right: 20,
646 bottom: 50, 648 bottom: 50,
647 left: 65 649 left: 65
648 }, 650 },
649 x: function(d) { 651 x: function(d) {
650 return d[0]; 652 return d[0];
651 }, 653 },
652 y: function(d) { 654 y: function(d) {
653 return d[1] / 100 ; 655 return d[1] / 100 ;
654 }, 656 },
655 average: function(d) { 657 average: function(d) {
656 return d.mean / 100; 658 return d.mean / 100;
657 }, 659 },
658 660
659 color: ["#FEDFC3"], 661 color: ["#FEDFC3"],
660 duration: 300, 662 duration: 300,
661 useInteractiveGuideline: true, 663 useInteractiveGuideline: true,
662 clipVoronoi: false, 664 clipVoronoi: false,
663 665
664 xAxis: { 666 xAxis: {
665 axisLabel: '', 667 axisLabel: '',
666 668
667 tickFormat: function(d) { 669 tickFormat: function(d) {
668 return d3.time.format('%d / %m / %y')(new Date(d)) 670 return d3.time.format('%d / %m / %y')(new Date(d))
669 //return d3.time.format('%b \-%y')(new Date(d)) 671 //return d3.time.format('%b \-%y')(new Date(d))
670 }, 672 },
671 showMaxMin: false, 673 showMaxMin: false,
672 staggerLabels: true 674 staggerLabels: true
673 }, 675 },
674 676
675 yAxis: { 677 yAxis: {
676 axisLabel: 'PaP/Retail Price', 678 axisLabel: 'PaP/Retail Price',
677 679
678 tickFormat: function(d) { 680 tickFormat: function(d) {
679 //return d3.format('')(d).toFixed(2); 681 //return d3.format('')(d).toFixed(2);
680 return '$ '+d.toFixed(2) 682 return '$ '+d.toFixed(2)
681 }, 683 },
682 axisLabelDistance: 5 684 axisLabelDistance: 5
683 } 685 }
684 } 686 }
685 }; 687 };
686 $scope.datahfp = [{ 688 $scope.datahfp = [{
687 key: "Long", 689 key: "Long",
688 values:$scope.hfpValues, 690 values:$scope.hfpValues,
689 mean: 0 691 mean: 0
690 }]; 692 }];
691 }) 693 })
692 694
693 } else { 695 } else {
694 $scope.fillForm = true; 696 $scope.fillForm = true;
695 } 697 }
696 698
697 699
698 } 700 }
699 701
700 /*Date Range Filter for Customer Sources*/ 702 /*Date Range Filter for Customer Sources*/
701 $scope.submitDateCs = function() { 703 $scope.submitDateCs = function() {
702 if ($scope.cs.fromDate === undefined) { 704 if ($scope.cs.fromDate === undefined) {
703 705
704 $scope.fillForm = true; 706 $scope.fillForm = true;
705 } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate === '') { 707 } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate === '') {
706 $scope.fillForm = false; 708 $scope.fillForm = false;
707 var today = new Date(); 709 var today = new Date();
708 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2); 710 var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2);
709 //from date format 711 //from date format
710 $scope.dat1 = $scope.cs.fromDate; 712 $scope.dat1 = $scope.cs.fromDate;
711 $scope.fd1 = $scope.dat1.split("/").reverse(); 713 $scope.fd1 = $scope.dat1.split("/").reverse();
712 $scope.tmp = $scope.fd1[2]; 714 $scope.tmp = $scope.fd1[2];
713 $scope.fd1[2] = $scope.fd1[1]; 715 $scope.fd1[2] = $scope.fd1[1];
714 $scope.fd1[1] = $scope.tmp; 716 $scope.fd1[1] = $scope.tmp;
715 $scope.fd = $scope.fd1.join("-"); 717 $scope.fd = $scope.fd1.join("-");
716 analyticsService.getDRFCSChart($scope.fd, DefaultToDate).then(function(result) { 718 analyticsService.getDRFCSChart($scope.fd, DefaultToDate).then(function(result) {
717 $scope.csValues = result; 719 $scope.csValues = result;
718 $scope.optionscs = { 720 $scope.optionscs = {
719 chart: { 721 chart: {
720 type: 'pieChart', 722 type: 'pieChart',
721 height: 500, 723 height: 500,
722 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], 724 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
723 x: function(d) { 725 x: function(d) {
724 return d.key; 726 return d.key;
725 }, 727 },
726 y: function(d) { 728 y: function(d) {
727 return d.y; 729 return d.y;
728 }, 730 },
729 showLabels: false, 731 showLabels: false,
730 segmentShowStroke: false, 732 segmentShowStroke: false,
731 animationSteps: 20, 733 animationSteps: 20,
732 animationEasing: "linear", 734 animationEasing: "linear",
733 animateScale: true, 735 animateScale: true,
734 duration: 500, 736 duration: 500,
735 labelThreshold: 0.01, 737 labelThreshold: 0.01,
736 labelSunbeamLayout: true, 738 labelSunbeamLayout: true,
737 legend: { 739 legend: {
738 margin: { 740 margin: {
739 top: 5, 741 top: 5,
740 right: 35, 742 right: 35,
741 bottom: 5, 743 bottom: 5,
742 left: 0 744 left: 0
743 } 745 }
744 } 746 }
745 } 747 }
746 }; 748 };
747 $scope.datacs = $scope.csValues; 749 $scope.datacs = $scope.csValues;
748 }) 750 })
749 751
750 752
751 } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined) { 753 } else if ($scope.cs.fromDate != undefined && $scope.cs.toDate != undefined) {
752 $scope.fillForm = false; 754 $scope.fillForm = false;
753 //from date format 755 //from date format
754 $scope.dat1 = $scope.cs.fromDate; 756 $scope.dat1 = $scope.cs.fromDate;
755 $scope.fd1 = $scope.dat1.split("/").reverse(); 757 $scope.fd1 = $scope.dat1.split("/").reverse();
756 $scope.tmp = $scope.fd1[2]; 758 $scope.tmp = $scope.fd1[2];
757 $scope.fd1[2] = $scope.fd1[1]; 759 $scope.fd1[2] = $scope.fd1[1];
758 $scope.fd1[1] = $scope.tmp; 760 $scope.fd1[1] = $scope.tmp;
759 $scope.fd = $scope.fd1.join("-"); 761 $scope.fd = $scope.fd1.join("-");
760 //to date format 762 //to date format
761 $scope.dat2 = $scope.cs.toDate; 763 $scope.dat2 = $scope.cs.toDate;
762 $scope.td1 = $scope.dat2.split("/").reverse(); 764 $scope.td1 = $scope.dat2.split("/").reverse();
763 $scope.tmp1 = $scope.td1[2]; 765 $scope.tmp1 = $scope.td1[2];
764 $scope.td1[2] = $scope.td1[1]; 766 $scope.td1[2] = $scope.td1[1];
765 $scope.td1[1] = $scope.tmp1; 767 $scope.td1[1] = $scope.tmp1;
766 $scope.td = $scope.td1.join("-"); 768 $scope.td = $scope.td1.join("-");
767 769
768 analyticsService.getDRFCSChart($scope.fd, $scope.td).then(function(result) { 770 analyticsService.getDRFCSChart($scope.fd, $scope.td).then(function(result) {
769 $scope.csValues = result; 771 $scope.csValues = result;
770 $scope.optionscs = { 772 $scope.optionscs = {
771 chart: { 773 chart: {
772 type: 'pieChart', 774 type: 'pieChart',
773 height: 500, 775 height: 500,
774 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"], 776 // color: ["#FEDFC3","#D89700","#FFE8B3","FFD980","#FF7F0E","#fff2e6","#ffcc99","#ffa64d","#ff8c1a","#B37D00","#f5f5f0","#e0e0d1","#ccccb3","#adad85","#999966","#7a7a52"],
775 x: function(d) { 777 x: function(d) {
776 return d.key; 778 return d.key;
777 }, 779 },
778 y: function(d) { 780 y: function(d) {
779 return d.y; 781 return d.y;
780 }, 782 },
781 showLabels: false, 783 showLabels: false,
782 segmentShowStroke: false, 784 segmentShowStroke: false,
783 animationSteps: 20, 785 animationSteps: 20,
784 animationEasing: "linear", 786 animationEasing: "linear",
785 animateScale: true, 787 animateScale: true,
786 duration: 500, 788 duration: 500,
787 labelThreshold: 0.01, 789 labelThreshold: 0.01,
788 labelSunbeamLayout: true, 790 labelSunbeamLayout: true,
789 legend: { 791 legend: {
790 margin: { 792 margin: {
791 top: 5, 793 top: 5,
792 right: 35, 794 right: 35,
793 bottom: 5, 795 bottom: 5,
794 left: 0 796 left: 0
795 } 797 }
796 } 798 }
797 } 799 }
798 }; 800 };
799 $scope.datacs = $scope.csValues; 801 $scope.datacs = $scope.csValues;
800 }) 802 })
801 803
802 } else { 804 } else {
803 $scope.fillForm = true; 805 $scope.fillForm = true;
804 } 806 }
805 807
806 808
807 } 809 }
808 810
809 811
810 }]); 812 }]);
app/partials/dashboard/dashboard.controller.js
1 (function() { 1 (function() {
2 'use strict' 2 'use strict'
3 3
4 angular.module('acufuel') 4 angular.module('acufuel')
5 .controller('dashboardController', [ '$scope', '$filter', '$rootScope', '$state', 'dashboardService','updateFuelManagerService', 'analyticsService', dashboardController]); 5 .controller('dashboardController', [ '$scope', '$filter', '$rootScope', '$state', 'dashboardService','updateFuelManagerService', 'analyticsService', dashboardController]);
6 6
7 function dashboardController($scope, $filter, $rootScope, $state, dashboardService,updateFuelManagerService,analyticsService) { 7 function dashboardController($scope, $filter, $rootScope, $state, dashboardService,updateFuelManagerService,analyticsService) {
8 8
9 $scope.getQuote = true; 9 $scope.getQuote = true;
10 $scope.showQuote = false; 10 $scope.showQuote = false;
11 $scope.getQuote = function () { 11 $scope.getQuote = function () {
12 $scope.getQuote = false; 12 $scope.getQuote = false;
13 $scope.showQuote = true; 13 $scope.showQuote = true;
14 } 14 }
15 15
16 $scope.logout = function () { 16 $scope.logout = function () {
17 localStorage.clear(); 17 localStorage.clear();
18 localStorage.removeItem("loginStatus"); 18 localStorage.removeItem("loginStatus");
19 $rootScope.path = false; 19 $rootScope.path = false;
20 $state.reload(); 20 $state.reload();
21 } 21 }
22 22
23 $scope.marginList = {}; 23 $scope.marginList = {};
24 dashboardService.getMargin().then(function(result) { 24 dashboardService.getMargin().then(function(result) {
25 $scope.marginList = result; 25 $scope.marginList = result;
26 // console.log("--kd Margin result--", result) 26 // console.log("--kd Margin result--", result)
27 }) 27 })
28 28
29 $scope.newFuelPricing = {}; 29 $scope.newFuelPricing = {};
30 dashboardService.getFuelPricingNew().then(function(result) { 30 dashboardService.getFuelPricingNew().then(function(result) {
31 $scope.newFuelPricing = result; 31 $scope.newFuelPricing = result;
32 // console.log("kd Fuel Pricing result", result) 32 // console.log("kd Fuel Pricing result", result)
33 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 33 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
34 if ($scope.newFuelPricing[i].fuelPricing != null) { 34 if ($scope.newFuelPricing[i].fuelPricing != null) {
35 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 35 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
36 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 36 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
37 var month = newTime.getUTCMonth() + 1; //months from 1-12 37 var month = newTime.getUTCMonth() + 1; //months from 1-12
38 var day = newTime.getUTCDate(); 38 var day = newTime.getUTCDate();
39 var year = newTime.getUTCFullYear(); 39 var year = newTime.getUTCFullYear();
40 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 40 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
41 } 41 }
42 } 42 }
43 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 43 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
44 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 44 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
45 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 45 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
46 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 46 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
47 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 47 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
48 var nextDay = newTime.getUTCDate(); 48 var nextDay = newTime.getUTCDate();
49 var nextYear = newTime.getUTCFullYear(); 49 var nextYear = newTime.getUTCFullYear();
50 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 50 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
51 } 51 }
52 } 52 }
53 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 53 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
54 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 54 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
55 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 55 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
56 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 56 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
57 var dday = newTime.getUTCDate(); 57 var dday = newTime.getUTCDate();
58 var dyear = newTime.getUTCFullYear(); 58 var dyear = newTime.getUTCFullYear();
59 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 59 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
60 } 60 }
61 } 61 }
62 } 62 }
63 var str =""+ $scope.newFuelPricing[i].name 63 var str =""+ $scope.newFuelPricing[i].name
64 if(str.startsWith("J")){ 64 if(str.startsWith("J")){
65 $scope.newFuelPricing[i].jeta = true; 65 $scope.newFuelPricing[i].jeta = true;
66 var str1 = str.substring(0,5) 66 var str1 = str.substring(0,5)
67 var str2 = str.substring(6, str.length) 67 var str2 = str.substring(6, str.length)
68 $scope.newFuelPricing[i].name = str1 68 $scope.newFuelPricing[i].name = str1
69 $scope.newFuelPricing[i].namejetrest = str2 69 $scope.newFuelPricing[i].namejetrest = str2
70 70
71 71
72 }else if(str.startsWith("100")){ 72 }else if(str.startsWith("100")){
73 $scope.newFuelPricing[i].avgas = true; 73 $scope.newFuelPricing[i].avgas = true;
74 var str1 = str.substring(0,5) 74 var str1 = str.substring(0,5)
75 var str2 = str.substring(6, str.length) 75 var str2 = str.substring(6, str.length)
76 $scope.newFuelPricing[i].name = str1 76 $scope.newFuelPricing[i].name = str1
77 $scope.newFuelPricing[i].nameavgasrest = str2 77 $scope.newFuelPricing[i].nameavgasrest = str2
78 } 78 }
79 } 79 }
80 $scope.showLoader = false; 80 $scope.showLoader = false;
81 }) 81 })
82 82
83 83
84 $scope.updateFuelPricing = {}; 84 $scope.updateFuelPricing = {};
85 $scope.updateFuelPricing.fuelPricingList = []; 85 $scope.updateFuelPricing.fuelPricingList = [];
86 $scope.updateFuelPricing.userProfileId = $scope.userProfileId; 86 $scope.updateFuelPricing.userProfileId = $scope.userProfileId;
87 $scope.updateFuelPricingClick = function(){ 87 $scope.updateFuelPricingClick = function(){
88 $scope.showLoader = true; 88 $scope.showLoader = true;
89 89
90 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 90 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
91 if ($scope.newFuelPricing[i].fuelPricing != null) { 91 if ($scope.newFuelPricing[i].fuelPricing != null) {
92 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 92 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
93 if ($scope.newFuelPricing[i].fuelPricing.cost == null) { 93 if ($scope.newFuelPricing[i].fuelPricing.cost == null) {
94 $scope.newFuelPricing[i].fuelPricing.cost = ''; 94 $scope.newFuelPricing[i].fuelPricing.cost = '';
95 } 95 }
96 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) { 96 if ($scope.newFuelPricing[i].fuelPricing.papMargin == null) {
97 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 97 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
98 } 98 }
99 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) { 99 if ($scope.newFuelPricing[i].fuelPricing.papTotal == null) {
100 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 100 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
101 } 101 }
102 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) { 102 if ($scope.newFuelPricing[i].fuelPricing.expirationDate == null) {
103 $scope.newFuelPricing[i].fuelPricing.expirationDate = ''; 103 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';
104 }else{ 104 }else{
105 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 105 $scope.newFuelPricing[i].fuelPricing.expirationDate = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
106 // console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate); 106 // console.log('$scope.newFuelPricing[i].fuelPricing.expirationDate', $scope.newFuelPricing[i].fuelPricing.expirationDate);
107 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime(); 107 $scope.newFuelPricing[i].fuelPricing.expirationDate = $scope.newFuelPricing[i].fuelPricing.expirationDate.getTime();
108 } 108 }
109 109
110 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin); 110 $scope.newFuelPricing[i].fuelPricing.papTotal = parseFloat($scope.newFuelPricing[i].fuelPricing.cost) + parseFloat($scope.newFuelPricing[i].fuelPricing.papMargin);
111 $scope.updateFuelPricing.fuelPricingList.push({ 111 $scope.updateFuelPricing.fuelPricingList.push({
112 'cost': $scope.newFuelPricing[i].fuelPricing.cost, 112 'cost': $scope.newFuelPricing[i].fuelPricing.cost,
113 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin, 113 'papMargin': $scope.newFuelPricing[i].fuelPricing.papMargin,
114 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal, 114 'papTotal': $scope.newFuelPricing[i].fuelPricing.papTotal,
115 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate, 115 'expirationDate': $scope.newFuelPricing[i].fuelPricing.expirationDate,
116 'productId': $scope.newFuelPricing[i].id, 116 'productId': $scope.newFuelPricing[i].id,
117 'id': $scope.newFuelPricing[i].fuelPricing.id, 117 'id': $scope.newFuelPricing[i].fuelPricing.id,
118 }) 118 })
119 119
120 }else{ 120 }else{
121 /*$scope.newFuelPricing[i].fuelPricing.cost = ''; 121 /*$scope.newFuelPricing[i].fuelPricing.cost = '';
122 $scope.newFuelPricing[i].fuelPricing.papMargin = ''; 122 $scope.newFuelPricing[i].fuelPricing.papMargin = '';
123 $scope.newFuelPricing[i].fuelPricing.papTotal = ''; 123 $scope.newFuelPricing[i].fuelPricing.papTotal = '';
124 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/ 124 $scope.newFuelPricing[i].fuelPricing.expirationDate = '';*/
125 } 125 }
126 126
127 } 127 }
128 128
129 // console.log('result',$scope.marginList) 129 // console.log('result',$scope.marginList)
130 dashboardService.updateFuelPricing($scope.updateFuelPricing).then(function(result) { 130 dashboardService.updateFuelPricing($scope.updateFuelPricing).then(function(result) {
131 toastr.success('Successfully Updated', { 131 toastr.success('Successfully Updated', {
132 closeButton: true 132 closeButton: true
133 }) 133 })
134 dashboardService.getFuelPricingNew().then(function(result) { 134 dashboardService.getFuelPricingNew().then(function(result) {
135 $scope.newFuelPricing = result; 135 $scope.newFuelPricing = result;
136 for (var i = 0; i<$scope.newFuelPricing.length; i++) { 136 for (var i = 0; i<$scope.newFuelPricing.length; i++) {
137 if ($scope.newFuelPricing[i].fuelPricing != null) { 137 if ($scope.newFuelPricing[i].fuelPricing != null) {
138 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') { 138 if ($scope.newFuelPricing[i].fuelPricing.expirationDate != null && $scope.newFuelPricing[i].fuelPricing.expirationDate != '') {
139 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate); 139 var newTime = new Date($scope.newFuelPricing[i].fuelPricing.expirationDate);
140 var month = newTime.getUTCMonth() + 1; //months from 1-12 140 var month = newTime.getUTCMonth() + 1; //months from 1-12
141 var day = newTime.getUTCDate(); 141 var day = newTime.getUTCDate();
142 var year = newTime.getUTCFullYear(); 142 var year = newTime.getUTCFullYear();
143 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year; 143 $scope.newFuelPricing[i].fuelPricing.expirationDate = month+'/'+day+'/'+year;
144 } 144 }
145 } 145 }
146 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 146 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
147 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 147 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
148 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') { 148 if ($scope.newFuelPricing[i].futureFuelPricing.nextExpiration != null && $scope.newFuelPricing[i].futureFuelPricing.nextExpiration != '') {
149 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration); 149 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.nextExpiration);
150 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12 150 var nextMonth = newTime.getUTCMonth() + 1; //months from 1-12
151 var nextDay = newTime.getUTCDate(); 151 var nextDay = newTime.getUTCDate();
152 var nextYear = newTime.getUTCFullYear(); 152 var nextYear = newTime.getUTCFullYear();
153 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear; 153 $scope.newFuelPricing[i].futureFuelPricing.nextExpiration = nextMonth+'/'+nextDay+'/'+nextYear;
154 } 154 }
155 } 155 }
156 if ($scope.newFuelPricing[i].futureFuelPricing != null) { 156 if ($scope.newFuelPricing[i].futureFuelPricing != null) {
157 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') { 157 if ($scope.newFuelPricing[i].futureFuelPricing.deployDate != null && $scope.newFuelPricing[i].futureFuelPricing.deployDate != '') {
158 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate); 158 var newTime = new Date($scope.newFuelPricing[i].futureFuelPricing.deployDate);
159 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12 159 var dmonth = newTime.getUTCMonth() + 1; //months from 1-12
160 var dday = newTime.getUTCDate(); 160 var dday = newTime.getUTCDate();
161 var dyear = newTime.getUTCFullYear(); 161 var dyear = newTime.getUTCFullYear();
162 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear; 162 $scope.newFuelPricing[i].futureFuelPricing.deployDate = dmonth+'/'+dday+'/'+dyear;
163 } 163 }
164 } 164 }
165 } 165 }
166 } 166 }
167 $scope.showLoader = false; 167 $scope.showLoader = false;
168 }) 168 })
169 }) 169 })
170 170
171 } 171 }
172 172
173 173
174 174
175 // $scope.submitLogin = function() { 175 // $scope.submitLogin = function() {
176 // LoginService.setAuth(true); 176 // LoginService.setAuth(true);
177 // toastr.info("Login successfully"); 177 // toastr.info("Login successfully");
178 // $state.go('app.dashboard'); 178 // $state.go('app.dashboard');
179 // /*LoginService.login($scope.username, $scope.password).then(function(result){ 179 // /*LoginService.login($scope.username, $scope.password).then(function(result){
180 // if(typeof result == 'object') { 180 // if(typeof result == 'object') {
181 // LoginService.setAuth(true); 181 // LoginService.setAuth(true);
182 // $rootScope.path = true; 182 // $rootScope.path = true;
183 // var reqPwdChng = localStorage.getItem("requiredChangePwd"); 183 // var reqPwdChng = localStorage.getItem("requiredChangePwd");
184 // if (reqPwdChng && reqPwdChng == "Y") { 184 // if (reqPwdChng && reqPwdChng == "Y") {
185 // $state.go('resetPassword'); 185 // $state.go('resetPassword');
186 // } else { 186 // } else {
187 // $state.go('app.upload'); 187 // $state.go('app.upload');
188 // } 188 // }
189 // } else { 189 // } else {
190 // toastr.info("Error in login. Please check login name and password"); 190 // toastr.info("Error in login. Please check login name and password");
191 // } 191 // }
192 // })*/ 192 // })*/
193 // } 193 // }
194 194
195 $scope.completeOrderCount = ''; 195 $scope.completeOrderCount = '';
196 $scope.pendingOrderCount= ''; 196 $scope.pendingOrderCount= '';
197 197
198 dashboardService.getFuelordercount().then(function(result) { 198 dashboardService.getFuelordercount().then(function(result) {
199 if(result[0].label=='Completed' && result[1].label=='Pending'){ 199 if(result[0].label=='Completed' && result[1].label=='Pending'){
200 $scope.completeOrderCount=result[0].value; 200 $scope.completeOrderCount=result[0].value;
201 $scope.pendingOrderCount=result[1].value; 201 $scope.pendingOrderCount=result[1].value;
202 } 202 }
203 203
204 }) 204 })
205 205
206 $scope.sendEmail = {}; 206 $scope.sendEmail = {};
207 $scope.confirmMail = function(){ 207 $scope.confirmMail = function(){
208 if ($scope.sendEmail.pricing != '' && $scope.sendEmail.pricing != null && $scope.sendEmail.pricing != undefined) { 208 if ($scope.sendEmail.pricing != '' && $scope.sendEmail.pricing != null && $scope.sendEmail.pricing != undefined) {
209 $('#confirm1').css('display', 'block'); 209 $('#confirm1').css('display', 'block');
210 210
211 } 211 }
212 } 212 }
213 $scope.saveAndCloseConfirm = function(){ 213 $scope.saveAndCloseConfirm = function(){
214 $('#confirm1').css('display', 'none'); 214 $('#confirm1').css('display', 'none');
215 updateFuelManagerService.sendMailToGroupMargin($scope.sendEmail.pricing).then(function(result) { 215 updateFuelManagerService.sendMailToGroupMargin($scope.sendEmail.pricing).then(function(result) {
216 // console.log("--email---",$scope.sendEmail.pricing); 216 // console.log("--email---",$scope.sendEmail.pricing);
217 // console.lo("==result==",result) 217 // console.lo("==result==",result)
218 $scope.sendEmail = {}; 218 $scope.sendEmail = {};
219 if(result.error) { 219 if(result.error) {
220 toastr.error('' + result.error + '', { 220 toastr.error('' + result.error + '', {
221 closeButton: true 221 closeButton: true
222 }) 222 })
223 } else { 223 } else {
224 toastr.success(''+result.success+'', { 224 toastr.success(''+result.success+'', {
225 closeButton: true 225 closeButton: true
226 }) 226 })
227 } 227 }
228 }) 228 })
229 } 229 }
230 $scope.cancelAndCloseConfirm = function(){ 230 $scope.cancelAndCloseConfirm = function(){
231 $scope.sendEmail = {}; 231 $scope.sendEmail = {};
232 $scope.sendEmail.pricing = ''; 232 $scope.sendEmail.pricing = '';
233 $('#confirm1').css('display', 'none'); 233 $('#confirm1').css('display', 'none');
234 } 234 }
235 235
236 $scope.pendingMessageRecord=[]; 236 $scope.pendingMessageRecord=[];
237 dashboardService.getPendingMessage().then(function(result) { 237 dashboardService.getPendingMessage().then(function(result) {
238 // console.log("==message===",result) 238 // console.log("==message===",result)
239 $scope.pendingMessageRecord=result; 239 $scope.pendingMessageRecord=result;
240 }) 240 })
241 241
242 242
243 $scope.orderCostAndCount = function() { 243 $scope.orderCostAndCount = function() {
244 analyticsService.orderCostAndCount().then(function(result) { 244 analyticsService.orderCostAndCount().then(function(result) {
245 $scope.ordersCost = result.cost; 245 $scope.ordersCost = result.cost;
246 $scope.ordersCount = result.count; 246 $scope.ordersCount = result.count;
247 }) 247 })
248 } 248 }
249 249
250 $scope.drf = {}; 250 $scope.drf = {};
251 $scope.hfp = {}; 251 $scope.hfp = {};
252 $scope.cs = {}; 252 $scope.cs = {};
253 $scope.mfsValues = []; 253 $scope.mfsValues = [];
254 $scope.msfarray = []; 254 $scope.msfarray = [];
255 $scope.getMFS = function() { 255 $scope.getMFS = function() {
256 //var makeId = makeId; 256 //var makeId = makeId;
257 analyticsService.getMFS().then(function(result) { 257 analyticsService.getMFS().then(function(result) {
258 $scope.mfsValues = result; 258 $scope.mfsValues = result;
259 $scope.optionsmfs = { 259 $scope.optionsmfs = {
260 chart: { 260 chart: {
261 type: 'multiBarChart', 261 type: 'multiBarChart',
262 height: 450, 262 height: 450,
263 reduceXTicks: false,
263 margin: { 264 margin: {
264 top: 45, 265 top: 45,
265 right: 20, 266 right: 20,
266 bottom: 45, 267 bottom: 45,
267 left: 45 268 left: 45
268 }, 269 },
269 clipEdge: true, 270 clipEdge: true,
270 //staggerLabels: true, 271 //staggerLabels: true,
271 duration: 500, 272 duration: 500,
272 stacked: false, 273 stacked: false,
273 //color: ["#FEDFC3", "#990000", "#000099", "#009900"], 274 //color: ["#FEDFC3", "#990000", "#000099", "#009900"],
274 color: ["#A9A9A9", "#000099", "#990000", "#009900"], 275 color: ["#A9A9A9", "#000099", "#990000", "#009900"],
275 xAxis: { 276 xAxis: {
276 axisLabel: 'Months', 277 axisLabel: 'Months',
277 showMaxMin: false, 278 showMaxMin: false,
278 }, 279 },
279 yAxis: { 280 yAxis: {
280 axisLabel: 'Orders', 281 axisLabel: 'Orders',
281 axisLabelDistance: -20, 282 axisLabelDistance: -20,
282 tickFormat: function(d) { 283 tickFormat: function(d) {
283 return d3.format(',.1f')(d); 284 return d3.format(',.1f')(d);
284 } 285 }
285 } 286 }
286 } 287 }
287 }; 288 };
288 $scope.datamfs = $scope.mfsValues; 289 $scope.datamfs = $scope.mfsValues;
289 }) 290 })
290 } 291 }
291 292
292 $scope.orderCostAndCount(); 293 $scope.orderCostAndCount();
293 $scope.getMFS(); 294 $scope.getMFS();
294 295
295 } 296 }
296 })(); 297 })();
297 298