From 0f34b879815e734bcc3d4d4f5c96e82c8f5ae921 Mon Sep 17 00:00:00 2001 From: anchit Date: Mon, 22 Oct 2018 17:18:47 +0530 Subject: [PATCH] desing and implementation for fulerlinx fboinsights preffered --- app/partials/analytics/analytics.controller.js | 947 +++++++++++---------- app/partials/analytics/analytics.service.js | 32 +- app/partials/customers/customers.html | 2 +- app/partials/viewCompany/viewCompany.controller.js | 2 + app/partials/viewCompany/viewCompany.html | 68 +- 5 files changed, 576 insertions(+), 475 deletions(-) diff --git a/app/partials/analytics/analytics.controller.js b/app/partials/analytics/analytics.controller.js index 9957a57..1154e93 100644 --- a/app/partials/analytics/analytics.controller.js +++ b/app/partials/analytics/analytics.controller.js @@ -3,289 +3,321 @@ angular.module('acufuel') .controller('analyticsController', ['$scope', 'analyticsService', function($scope, analyticsService) { - // Sand Signika Overview without drill down -KD - /* $scope.getAllRegionalPap = function() { - $scope.flag=true; - $scope.stateList = [{region:'Alabama',code:'AL'},{region:'Alaska',code:'AK'},{region:'Arizona',code:'AZ'},{region:'Arkansas',code:'AR'}, - {region:'California',code:'CA' },{region:'Colorado',code:'CO'},{region:'Connecticut',code:'CT'},{region:'Delaware',code:'DE'}, - {region:'Florida' ,code:'FL'},{region:'Georgia' ,code:'GA'},{region:'Hawaii' ,code:'HI'},{region:'Idaho' ,code:'ID'}, - {region:'Illinois',code:'IL'},{region:'Indiana' ,code:'IN'},{region:'Iowa' ,code:'IA'},{region:'Kansas' ,code:'KS'}, - {region:'Kentucky' ,code:'KY'},{region:'Louisiana' ,code:'LA'},{region:'Maine' ,code:'ME'},{region:'Maryland' ,code:'MD'}, - {region:'Massachusetts' ,code:'MA'},{region:'Michigan' ,code:'MI'},{region:'Minnesota' ,code:'MN'}, - {region:'Mississippi' ,code:'MS'},{region:'Missouri' ,code:'MO'},{region:'Montana',code:'MT'},{region:'Nebraska' ,code:'NE'}, - {region:'Nevada' ,code:'NV'},{region:'New Hampshire' ,code:'NH'},{region:'New Jersey' ,code:'NJ'},{region:'New Mexico' ,code:'NM'}, - {region:'New York' ,code:'NY'},{region:'North Carolina' ,code:'NC'},{region:'North Dakota' ,code:'ND'},{region:'Ohio' ,code:'OH'}, - {region:'Oklahoma' ,code:'OK'},{region:'Oregon' ,code:'OR'},{region:'Pennsylvania',code:'PA'},{region:'Rhode Island' ,code:'RI'}, - {region:'South Carolina' ,code:'SC'},{region:'South Dakota' ,code:'SD'},{region:'Tennessee' ,code:'TN'},{region:'Texas' ,code:'TX'}, - {region:'Utah' ,code:'UT'},{region:'Vermont' ,code:'VT'},{region:'Virginia' ,code:'VA'},{region:'Washington' ,code:'WA'}, - {region:'West Virginia' ,code:'WV'},{region:'Wisconsin' ,code:'WI'},{region:'Wyoming',code:'WY'}] - - analyticsService.getAllRPP().then(function(result) { - for (var i = 0; i < $scope.stateList.length; i++) { - for (var j = 0; j Failed loading ' + e.point.name); - fail = setTimeout(function () { - chart.hideLoading(); - }, 1000); - } - }, 3000); - - // Show the spinner - chart.showLoading(''); // Font Awesome spinner - - // Load the drilldown map - $.getScript('https://code.highcharts.com/mapdata/' + mapKey + '.js', function () { + data[i].value = result[j].averagePAP.toFixed(2); - var region = e.point.name; - //called the get api region wise - analyticsService.getRPP(region).then(function(result) { + } + } - console.log("===region====",region,"====result====",result) - data = Highcharts.geojson(Highcharts.maps[mapKey]); + } - for (var i = 0; i < data.length; i++) { - for (var j = 0; j Failed loading ' + e.point.name); + fail = setTimeout(function() { + chart.hideLoading(); + }, 10000); + } + }, 3000); + + // Show the spinner + chart.showLoading(''); // Font Awesome spinner + + // Load the drilldown map + var region = e.point.name; + analyticsService.getRPP(region).then(function(result) { + $.getScript('https://code.highcharts.com/mapdata/' + mapKey + '.js', function() { + //called the get api region wise + data = Highcharts.geojson(Highcharts.maps[mapKey]); + for (var i = 0; i < data.length; i++) { + for (var j = 0; j < result.length; j++) { + + //delete the County word from api result to match with map data + result[j].region = result[j].region.replace("County", ""); + + if (data[i].name.trim() === result[j].region.trim()) { + data[i].value = result[j].averagePAP.toFixed(2); - - } - } - - } - }) - - // Set a non-random bogus value - - $.each(data, function (i) { - this.value = this.value; - }); - - // Hide loading and add series - chart.hideLoading(); - clearTimeout(fail); - chart.addSeriesAsDrilldown(e.point, { - name: e.point.name, - data: data, - dataLabels: { - enabled: true, - format: '{point.name}' - } - }); + + } + } + + } + // Set a non-random bogus value + $.each(data, function(i) { + this.value = this.value; + }); + // Hide loading and add series + chart.hideLoading(); + clearTimeout(fail); + chart.addSeriesAsDrilldown(e.point, { + name: e.point.name, + data: data, + dataLabels: { + enabled: true, + format: '{point.name}' + } + }); + }); + }) + } + + this.setTitle(null, { + text: e.point.name + }); + }, + drillup: function() { + this.setTitle(null, { + text: '' }); } - - this.setTitle(null, { text: e.point.name }); - }, - drillup: function () { - this.setTitle(null, { text: '' }); } - } - }, - - title: { - text: 'USA Map-Drilldown for Regional Pricing' - }, - - subtitle: { - text: '', - floating: true, - align: 'right', - y: 50, - style: { - fontSize: '16px' - } - }, - - /* legend: small ? {} : { - layout: 'vertical', - align: 'right', - verticalAlign: 'middle' - }, - - colorAxis: { - min: 0, - minColor: '#E6E7E8', - maxColor: '#005645' - },*/ - - mapNavigation: { - enabled: true, - buttonOptions: { - verticalAlign: 'bottom' - } - }, + }, - plotOptions: { - map: { - states: { - hover: { - color: '#EEDD66' - } + title: { + text: 'USA Map-Drilldown for Regional Pricing' + }, + + subtitle: { + text: '', + floating: true, + align: 'right', + y: 50, + style: { + fontSize: '16px' } - } - }, + }, + + /* legend: small ? {} : { + layout: 'vertical', + align: 'right', + verticalAlign: 'middle' + }, + + colorAxis: { + min: 0, + minColor: '#E6E7E8', + maxColor: '#005645' + },*/ - series: [{ - data: data, - name: 'USA', - dataLabels: { + mapNavigation: { enabled: true, - format: '{point.properties.postal-code}' - } - }, { - type: 'mapline', - data: separators, - color: 'silver', - enableMouseTracking: false, - animation: { - duration: 500 - } - }], + buttonOptions: { + verticalAlign: 'bottom' + } + }, - drilldown: { - activeDataLabelStyle: { - color: '#FFFFFF', - textDecoration: 'none', - textOutline: '1px #000000' + plotOptions: { + map: { + states: { + hover: { + color: '#EEDD66' + } + } + } }, - drillUpButton: { - relativeTo: 'spacingBox', - position: { - x: 0, - y: 60 + + series: [{ + data: data, + name: 'USA', + dataLabels: { + enabled: true, + format: '{point.properties.postal-code}' + } + }, { + type: 'mapline', + data: separators, + color: 'silver', + enableMouseTracking: false, + animation: { + duration: 500 + } + }], + + drilldown: { + activeDataLabelStyle: { + color: '#FFFFFF', + textDecoration: 'none', + textOutline: '1px #000000' + }, + drillUpButton: { + relativeTo: 'spacingBox', + position: { + x: 0, + y: 60 + } } } - } + }); + }) + } + + $scope.getAllRegionalPapDrilldown(); + + + /*$(document).ready(function() { + $(function() { + jQuery('#map').vectorMap({ + map: 'us_lcc', + backgroundColor: '#ffce99', + color: '#dfdfdd', + hoverOpacity: 0, + selectedColor: '#5f8b98', + hoverColor: '#5f8b98', + enableZoom: true, + showTooltip: true, + scaleColors: ['#dfdfdd'], + //values: sample_data + onRegionClick: function(event, code) { + var map = $('#map').vectorMap('get', 'mapObject'); + var name = map.getRegionName(code); + getRegionPap(name); + }, + normalizeFunction: 'polynomial' + }); }); }) - } - $scope.getAllRegionalPapDrilldown(); - + + function getRegionPap(code) { + $scope.showLoader = true; + analyticsService.getRPP(code).then(function(result) { + $scope.rppData = result; + $scope.showLoader = false; + $('#popup1').css('display', 'block'); + }) + }*/ + + $scope.cancelStatus = function() { $('#popup1').css('display', 'none'); } @@ -312,7 +344,6 @@ angular.module('acufuel') chart: { type: 'multiBarChart', height: 450, - reduceXTicks: false, margin: { top: 45, right: 20, @@ -323,8 +354,7 @@ angular.module('acufuel') //staggerLabels: true, duration: 500, stacked: false, - /*color: ["#FEDFC3", "#990000", "#000099", "#009900"],*/ - color: ["#A9A9A9", "#000099", "#990000", "#009900"], + color: ["#FEDFC3", "#990000", "#000099", "#009900"], xAxis: { axisLabel: 'Months', showMaxMin: false, @@ -336,7 +366,6 @@ angular.module('acufuel') return d3.format(',.1f')(d); } } - } }; $scope.datamfs = $scope.mfsValues; @@ -349,7 +378,6 @@ angular.module('acufuel') $scope.getCS = function() { //var makeId = makeId; analyticsService.getCS().then(function(result) { - //console.log("===customersupports===",result) $scope.csValues = result; $scope.optionscs = { chart: { @@ -387,203 +415,122 @@ angular.module('acufuel') $scope.getCS(); - $scope.hfpValuesOne = {}; - $scope.hfpValuesOne.key = "JET-A Full Service"; - $scope.hfpValuesOne.values = []; - - $scope.hfpValuesTwo = {}; - $scope.hfpValuesTwo.key = "100LL Full Service"; - $scope.hfpValuesTwo.values = []; - - $scope.hfpFinalData = []; - + $scope.hfpValues = []; $scope.getHfpChartData = function() { + //var makeId = makeId; analyticsService.gethfpChart().then(function(result) { - for(var i=0; i0){return d[0]}}) - //adjusting, 100% is 1.00, not 100 as it is in the data - .y(function(d) { return d[1]}) - .color(d3.scale.category10().range()) - .useInteractiveGuideline(true) - ; - - chart.xAxis - .tickFormat(function(d) { - return d3.time.format('%x')(new Date(d)) - }); - - chart.yAxis - .axisLabel("PaP / Retail Price") - .axisLabelDistance(-5) - .tickFormat(d3.format(',.2f')).showMaxMin(false); - - d3.select('#chart svg') - .datum($scope.hfpRangeData) - .transition().duration(500) - .call(chart) - ; - - nv.utils.windowResize(chart.update); - - return chart; + analyticsService.getDRFChart($scope.fd, DefaultToDate).then(function(result) { + $scope.datamfs = []; + $scope.datamfs = result; }) - - } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined) { + analyticsService.orderCostAndCountByDate($scope.fd, DefaultToDate).then(function(result) { + $scope.ordersCost = result.cost; + $scope.ordersCount = result.count; + }) + } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined) { $scope.fillForm = false; //from date format - $scope.dat1 = $scope.hfp.fromDate; + $scope.dat1 = $scope.drf.fromDate; $scope.fd1 = $scope.dat1.split("/").reverse(); $scope.tmp = $scope.fd1[2]; $scope.fd1[2] = $scope.fd1[1]; $scope.fd1[1] = $scope.tmp; $scope.fd = $scope.fd1.join("-"); - //to date format - $scope.dat2 = $scope.hfp.toDate; + $scope.dat2 = $scope.drf.toDate; $scope.td1 = $scope.dat2.split("/").reverse(); $scope.tmp1 = $scope.td1[2]; $scope.td1[2] = $scope.td1[1]; $scope.td1[1] = $scope.tmp1; - $scope.td = $scope.td1.join("-") + " " + '23:59:59'; - // console.log("===both dates==",$scope.td) - analyticsService.getDRFHfpChart($scope.fd, $scope.td).then(function(result) { - //console.log("===date range22===",result); - for(var i=0; i0){return d[0] }}) - //adjusting, 100% is 1.00, not 100 as it is in the data - .y(function(d) { return d[1]}) - .color(d3.scale.category10().range()) - .useInteractiveGuideline(true) - ; - - chart.xAxis - .tickFormat(function(d) { - return d3.time.format('%x')(new Date(d)) - }); - - chart.yAxis - .axisLabel("PaP / Retail Price") - .axisLabelDistance(-5) - .tickFormat(d3.format(',.2f')).showMaxMin(false); - - d3.select('#chart svg') - .datum($scope.hfpRangeData) - .transition().duration(500) - .call(chart) - ; - - nv.utils.windowResize(chart.update); - - return chart; + $scope.td = $scope.td1.join("-"); + + analyticsService.getDRFChart($scope.fd, $scope.td).then(function(result) { + $scope.datamfs = []; + $scope.datamfs = result; + }) + + analyticsService.orderCostAndCountByDate($scope.fd, $scope.td).then(function(result) { + $scope.ordersCost = result.cost; + $scope.ordersCount = result.count; }) } else { @@ -593,55 +540,152 @@ angular.module('acufuel') } - - /*Date Range Filter for Monthly fuel Sales*/ - $scope.submitDate = function() { - if ($scope.drf.fromDate === undefined) { + /*Date Range Filter for Historic fuel Price*/ + $scope.submitDateHfp = function() { + + if ($scope.hfp.fromDate === undefined) { + $scope.fillForm = true; - } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate === undefined || $scope.drf.toDate === '') { + } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate === undefined || $scope.hfp.toDate === '') { $scope.fillForm = false; var today = new Date(); var DefaultToDate = today.getFullYear() + '-' + ("0" + (today.getMonth() + 1)).slice(-2) + '-' + ("0" + today.getDate()).slice(-2); //from date format - $scope.dat1 = $scope.drf.fromDate; + $scope.dat1 = $scope.hfp.fromDate; $scope.fd1 = $scope.dat1.split("/").reverse(); $scope.tmp = $scope.fd1[2]; $scope.fd1[2] = $scope.fd1[1]; $scope.fd1[1] = $scope.tmp; $scope.fd = $scope.fd1.join("-"); - analyticsService.getDRFChart($scope.fd, DefaultToDate).then(function(result) { - $scope.datamfs = []; - $scope.datamfs = result; - }) - - analyticsService.orderCostAndCountByDate($scope.fd, DefaultToDate).then(function(result) { - $scope.ordersCost = result.cost; - $scope.ordersCount = result.count; + analyticsService.getDRFHfpChart($scope.fd, DefaultToDate).then(function(result) { + $scope.hfpValues = result; + $scope.optionshfp = { + chart: { + type: 'cumulativeLineChart', + height: 450, + margin: { + top: 40, + right: 20, + bottom: 50, + left: 65 + }, + x: function(d) { + return d[0]; + }, + y: function(d) { + return d[1] / 100; + }, + average: function(d) { + return d.mean / 100; + }, + + color: ["#FEDFC3"], + duration: 300, + useInteractiveGuideline: true, + clipVoronoi: false, + + xAxis: { + axisLabel: '', + + tickFormat: function(d) { + return d3.time.format('%d / %m / %y')(new Date(d)) + // return d3.time.format('%b \-%y')(new Date(d)) + }, + showMaxMin: false, + staggerLabels: true + }, + + yAxis: { + axisLabel: 'PaP/Retail Price', + + tickFormat: function(d) { + //return d3.format('')(d).toFixed(2); + return '$ ' + d.toFixed(2) + }, + axisLabelDistance: 5 + } + } + }; + $scope.datahfp = [{ + key: "Long", + values: $scope.hfpValues, + mean: 0 + }]; }) - } else if ($scope.drf.fromDate != undefined && $scope.drf.toDate != undefined) { + + + } else if ($scope.hfp.fromDate != undefined && $scope.hfp.toDate != undefined) { $scope.fillForm = false; //from date format - $scope.dat1 = $scope.drf.fromDate; + $scope.dat1 = $scope.hfp.fromDate; $scope.fd1 = $scope.dat1.split("/").reverse(); $scope.tmp = $scope.fd1[2]; $scope.fd1[2] = $scope.fd1[1]; $scope.fd1[1] = $scope.tmp; $scope.fd = $scope.fd1.join("-"); - $scope.dat2 = $scope.drf.toDate; + //to date format + $scope.dat2 = $scope.hfp.toDate; $scope.td1 = $scope.dat2.split("/").reverse(); $scope.tmp1 = $scope.td1[2]; $scope.td1[2] = $scope.td1[1]; $scope.td1[1] = $scope.tmp1; $scope.td = $scope.td1.join("-"); - analyticsService.getDRFChart($scope.fd, $scope.td).then(function(result) { - $scope.datamfs = []; - $scope.datamfs = result; - }) - - analyticsService.orderCostAndCountByDate($scope.fd, $scope.td).then(function(result) { - $scope.ordersCost = result.cost; - $scope.ordersCount = result.count; + analyticsService.getDRFHfpChart($scope.fd, $scope.td).then(function(result) { + console.log("===DRF HPF====", result) + $scope.hfpValues = result; + $scope.optionshfp = { + chart: { + type: 'cumulativeLineChart', + height: 450, + margin: { + top: 40, + right: 20, + bottom: 50, + left: 65 + }, + x: function(d) { + return d[0]; + }, + y: function(d) { + return d[1] / 100; + }, + average: function(d) { + return d.mean / 100; + }, + + color: ["#FEDFC3"], + duration: 300, + useInteractiveGuideline: true, + clipVoronoi: false, + + xAxis: { + axisLabel: '', + + tickFormat: function(d) { + return d3.time.format('%d / %m / %y')(new Date(d)) + //return d3.time.format('%b \-%y')(new Date(d)) + }, + showMaxMin: false, + staggerLabels: true + }, + + yAxis: { + axisLabel: 'PaP/Retail Price', + + tickFormat: function(d) { + //return d3.format('')(d).toFixed(2); + return '$ ' + d.toFixed(2) + }, + axisLabelDistance: 5 + } + } + }; + $scope.datahfp = [{ + key: "Long", + values: $scope.hfpValues, + mean: 0 + }]; }) } else { @@ -651,9 +695,6 @@ angular.module('acufuel') } - - - /*Date Range Filter for Customer Sources*/ $scope.submitDateCs = function() { if ($scope.cs.fromDate === undefined) { diff --git a/app/partials/analytics/analytics.service.js b/app/partials/analytics/analytics.service.js index 6189b98..ae902ef 100644 --- a/app/partials/analytics/analytics.service.js +++ b/app/partials/analytics/analytics.service.js @@ -56,26 +56,11 @@ } /* With region Code */ - /*this.getRPP = function(code){ - var deferred = $q.defer(); - $http({ - method : 'GET', - url : BASE_URL.url +'/fuelerlinx/getAircrafts/'+code - }) - .then(function (result){ - deferred.resolve(result.data); - },function (result){ - console.log(result) - deferred.resolve(result.data); - }) - return deferred.promise; - }*/ - this.getRPP = function(code){ var deferred = $q.defer(); $http({ method : 'GET', - url : BASE_URL.url +'/fuelerlinx/getCompleteRegionalPap/'+code + url : BASE_URL.url +'/fuelerlinx/getAircrafts/'+code }) .then(function (result){ deferred.resolve(result.data); @@ -85,6 +70,21 @@ }) return deferred.promise; } + + // this.getRPP = function(code){ + // var deferred = $q.defer(); + // $http({ + // method : 'GET', + // url : BASE_URL.url +'/fuelerlinx/getCompleteRegionalPap/'+code + // }) + // .then(function (result){ + // deferred.resolve(result.data); + // },function (result){ + // console.log(result) + // deferred.resolve(result.data); + // }) + // return deferred.promise; + // } /* without region code */ diff --git a/app/partials/customers/customers.html b/app/partials/customers/customers.html index 55c1de3..a3a298d 100644 --- a/app/partials/customers/customers.html +++ b/app/partials/customers/customers.html @@ -105,7 +105,7 @@
- {{row.companyName}} + {{row.companyName}} {{row.companyAircraftSize}} diff --git a/app/partials/viewCompany/viewCompany.controller.js b/app/partials/viewCompany/viewCompany.controller.js index 0847744..62ebd65 100644 --- a/app/partials/viewCompany/viewCompany.controller.js +++ b/app/partials/viewCompany/viewCompany.controller.js @@ -149,6 +149,7 @@ angular.module('acufuel') $scope.multipleMsg = false; $scope.companyData.masterMargin = ""; $scope.isGlobal = false; + $scope.fboPreffered = false; getCompanyDetail(); function getCompanyDetail() { @@ -157,6 +158,7 @@ angular.module('acufuel') console.log("===getCompanyDetail====",result) $scope.companyData = result; $scope.isGlobal = result.global; + $scope.fboPreffered = result.fboPreferred; if (result.global == true) { $scope.companyData.global = true; } diff --git a/app/partials/viewCompany/viewCompany.html b/app/partials/viewCompany/viewCompany.html index 90b429d..4123d9b 100644 --- a/app/partials/viewCompany/viewCompany.html +++ b/app/partials/viewCompany/viewCompany.html @@ -129,7 +129,7 @@
-

{{companyData.companyName}}

+

{{companyData.companyName}}

@@ -234,7 +234,7 @@

- {{companyData.companyName}}   + {{companyData.companyName}}  

@@ -270,6 +270,9 @@

+
+

FBOInsights Preffered

+
Tenant/Base Customer @@ -282,12 +285,13 @@
CAA Member
+

{{companyData.addressOne}}, - {{companyData.addressTwo}}
{{companyData.city}},
{{companyData.state}} {{companyData.zipcode}}
{{companyData.country}}
 

+ {{companyData.addressTwo}}
{{companyData.city}},
{{companyData.state}} {{companyData.zipcode}}
{{companyData.country}}
 

@@ -344,12 +348,12 @@

Aircraft List

- +
- +
@@ -403,6 +407,60 @@
Tail #
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
Tail #MakeModelFuel TypeMarginValueAll In
{{aircraft.tail}}{{aircraft.make}}{{aircraft.model}}{{aircraft.fuelType}} + + + + + + =${{aircraft.marginValue}} + + -${{aircraft.marginValue}} + + +${{aircraft.marginValue}} + + + + + + + + +
-- 2.0.0