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 1 'use strict';
2 2 angular.module('acufuel')
3   - .controller('analyticsController', ['$scope','analyticsService',function($scope, analyticsService) {
  3 + .controller('analyticsController', ['$scope','analyticsService',function($scope,analyticsService) {
4 4  
5 5 $(document).ready(function(){
6 6 $(function(){
7   - new jvm.MultiMap({
  7 + /*map = new jvm.MultiMap({
8 8 container: $('#map'),
9 9 maxLevel: 1,
10 10 main: {
... ... @@ -12,14 +12,57 @@
12 12 backgroundColor: '#ffce99',
13 13 },
14 14 mapUrlByCode: function(code, multiMap){
  15 + console.log('dddd---',code);
  16 + console.log('----------',map.getRegionName(code));
  17 + getRegionPap(label);
15 18 return '/js/us-counties/jquery-jvectormap-data-'+
16 19 code.toLowerCase()+'-'+
17 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 67 $scope.drf = {};
25 68 $scope.hfp = {};
... ... @@ -291,6 +334,7 @@
291 334 $scope.getCS = function(){
292 335 //var makeId = makeId;
293 336 analyticsService.getCS().then(function(result) {
  337 + //console.log("==cs values==",result)
294 338 $scope.csValues = result;
295 339 //console.log("cs data kd --- ",$scope.csValues)
296 340 $scope.optionscs = {
... ... @@ -323,6 +367,8 @@
323 367 }
324 368  
325 369 $scope.getCS();
  370 +
  371 + /*Historic Fuel Price */
326 372 $scope.optionshfp = {
327 373 chart: {
328 374 type: 'cumulativeLineChart',
... ... @@ -493,11 +539,8 @@
493 539  
494 540 /*Date Range Filter for Customer Sources*/
495 541 $scope.submitDateCs = function(){
496   -
497 542 if ($scope.cs.fromDate === undefined) {
498 543  
499   - // console.log("==frmdate====",$scope.drf.fromDate);
500   - //console.log("==toDate====",$scope.drf.toDate);
501 544 $scope.fillForm = true;
502 545 }
503 546 else if($scope.cs.fromDate != undefined && $scope.cs.toDate === undefined || $scope.cs.toDate ===''){
... ... @@ -511,12 +554,34 @@
511 554 $scope.fd1[2] = $scope.fd1[1];
512 555 $scope.fd1[1] = $scope.tmp;
513 556 $scope.fd = $scope.fd1.join("-");
514   - // console.log("===fd====",$scope.fd);
515   - //console.log("----td curr---",DefaultToDate);
516 557 analyticsService.getDRFCSChart($scope.fd,DefaultToDate).then(function(result) {
517   - //console.log("==date received==",$scope.fd);
518   - //console.log("----to date receivedcurrent---",DefaultToDate)
519   - $scope.datacs = result;
  558 + $scope.csValues = result;
  559 + $scope.optionscs = {
  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  
... ... @@ -538,9 +603,33 @@
538 603 $scope.td = $scope.td1.join("-");
539 604  
540 605 analyticsService.getDRFCSChart($scope.fd,$scope.td).then(function(result) {
541   - // console.log("==date received==",$scope.fd);
542   - //console.log("----to date received---",$scope.td)
543   - $scope.datacs = result;
  606 + $scope.csValues = result;
  607 + $scope.optionscs = {
  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 635 }else
... ... @@ -553,16 +642,6 @@
553 642  
554 643  
555 644  
556   -
557   -
558   -
559   -
560   -
561   -
562   -
563   -
564   -
565   -
566 645 }]);
567 646  
568 647  
... ...
app/partials/analytics/analytics.html
... ... @@ -150,6 +150,34 @@
150 150 </div>
151 151 </div>
152 152 <!-- /container -->
153   - </div>
  153 + </div>
154 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  
... ...
app/partials/analytics/analytics.service.js
... ... @@ -40,6 +40,22 @@
40 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 59 /*---date filter for Monthly fuel sales chart - dates are sending to the api */
44 60 this.getDRFChart = function(fd,td){
45 61 var deferred = $q.defer();
... ... @@ -77,7 +93,7 @@
77 93 var deferred = $q.defer();
78 94 $http({
79 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 98 .then(function (result){
83 99 deferred.resolve(result.data);
... ...