From 731e27f5e156b051198e9c6ba86840d036eb8d90 Mon Sep 17 00:00:00 2001 From: "kuldeep.arora" Date: Wed, 29 Aug 2018 14:54:13 +0530 Subject: [PATCH] fuel order ui --- app/index.html | 7 + .../enterFuelOrder/enterFuelOrder.controller.js | 15 -- app/partials/fuelOrders/fuelOrders.controller.js | 153 ++++++++++++--------- app/partials/fuelOrders/fuelOrders.html | 23 +++- 4 files changed, 112 insertions(+), 86 deletions(-) diff --git a/app/index.html b/app/index.html index 70bbe3f..3728a30 100644 --- a/app/index.html +++ b/app/index.html @@ -239,5 +239,12 @@ + + + + + + + \ No newline at end of file diff --git a/app/partials/enterFuelOrder/enterFuelOrder.controller.js b/app/partials/enterFuelOrder/enterFuelOrder.controller.js index 3b3119d..e17d3a3 100644 --- a/app/partials/enterFuelOrder/enterFuelOrder.controller.js +++ b/app/partials/enterFuelOrder/enterFuelOrder.controller.js @@ -12,7 +12,6 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, enterFuelOrderService.getAllCompanies().then(function(result) { $scope.showLoader = false; $scope.companyList = result; - //console.log("---",result); }) $scope.order = {}; @@ -29,19 +28,13 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, $scope.selectedCompanyName = company; $scope.showLoader = true; - //console.log(--company---,$scope.selectedCompanyName); for (var i = 0; i < $scope.companyList.length; i++) { if ($scope.companyList[i].companyName == company) { - //console.log($scope.companyList[i].margin); - //console.log($scope.companyList[i].marginAVGAS); if($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS != null){ enterFuelOrderService.getFuelCost($scope.companyList[i].id).then(function(margins) { $scope.marginList = margins; - //console.log('$scope.marginList', $scope.marginList); }) } else if ($scope.companyList[i].margin != null && $scope.companyList[i].marginAVGAS == null) { - //console.log('--------------------',$scope.companyList[i].margin); - //console.log('--------------------',$scope.companyList[i].marginAVGAS); enterFuelOrderService.getATypeFuelPricing($scope.companyList[i].id).then(function(margins) { $scope.marginList = margins; }) @@ -53,14 +46,12 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, enterFuelOrderService.getPapFuelPricing($scope.companyList[i].id).then(function(margins) { $scope.marginList = margins; }) - //console.log('--------------------',$scope.companyList[i].margin); } $scope.selectedCompanyId = $scope.companyList[i].id; if ($scope.selectedCompanyId != '') { enterFuelOrderService.getAircraft($scope.selectedCompanyId).then(function(aircraft) { $scope.aircraftList = aircraft; - //console.log("aircraft",$scope.aircraftList); }) } if($scope.companyList[i].margin == null) { @@ -76,7 +67,6 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, $scope.tierList = tiers; $scope.showLoader = false; $scope.selectedTier = $scope.tierList[0]; - //console.log("--tier--",$scope.tierList) }) }else{ $scope.showLoader = false; @@ -89,7 +79,6 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, $scope.tiervalue=function(){ $scope.order.tierBreak=$scope.selectedTier.minTierBreak+'-'+$scope.selectedTier.maxTierBreak; - //console.log('tier value', $scope.order.tierBreak); } @@ -115,7 +104,6 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, $scope.order.upliftDate = $scope.order.upliftDate + ' ' + hours + ':' + min + ':' + sec; $scope.order.upliftDate = new Date($scope.order.upliftDate); $scope.order.upliftDate = $scope.order.upliftDate.getTime(); - // console.log("---date---",$scope.order.upliftDate) } /*if ($scope.order.departingDate != '') { $scope.order.departingDate = new Date($scope.order.departingDate); @@ -134,10 +122,7 @@ function enterFuelOrderController($scope, $rootScope, $uibModal, $filter, $http, $scope.order.make = aircraftObj.make; $scope.order.model = aircraftObj.model; $scope.dispatchOrder.fuelOrderList.push($scope.order); - //console.log('$scope.order', $scope.dispatchOrder); enterFuelOrderService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { - //console.log("--final data--",$scope.dispatchOrder) - //console.log('result', result); $scope.showLoader = false; $scope.order = {}; toastr.success('Fuel Order Dispatched Successfully', { diff --git a/app/partials/fuelOrders/fuelOrders.controller.js b/app/partials/fuelOrders/fuelOrders.controller.js index 208811a..965f5b0 100644 --- a/app/partials/fuelOrders/fuelOrders.controller.js +++ b/app/partials/fuelOrders/fuelOrders.controller.js @@ -42,7 +42,6 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT function getAllCompanies(){ fuelOrdersService.getAllCompanies().then(function(result) { - // console.log('log', result); $scope.companyList = result; for (var i = 0; i < $scope.companyList.length; i++) { if ($scope.companyList[i].companyContact != null) { @@ -82,7 +81,6 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT var myselect = document.getElementById('colorfulSelectbox'), colour = myselect.options[myselect.selectedIndex].className; myselect.style.background = colour; - // console.log('colour', myselect); myselect.blur(); } @@ -110,7 +108,6 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT $scope.getOrders = function() { fuelOrdersService.getOrders().then(function(result) { - //console.log("==kd===",result); $scope.orderdata = result; for(var i=0 ; i < $scope.orderdata.length ; i++){ $scope.orderdata[i].upliftDateS = new Date($scope.orderdata[i].upliftDate); @@ -120,6 +117,17 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT var departingStr = "" + ($scope.orderdata[i].departingDateS.getMonth() + 1) + "/" + $scope.orderdata[i].departingDateS.getDate() + "/" + $scope.orderdata[i].departingDateS.getFullYear(); $scope.orderdata[i].upliftDateString = str; $scope.orderdata[i].departingDateString = departingStr; + //not working in input type Time + /*if ($scope.orderdata[i].etaTime != null) { + var now = new Date(); + + var hr = $scope.orderdata[i].etaTime.slice(0, 2); + var mm = $scope.orderdata[i].etaTime.slice(3, 5); + now.setHours(hr); + now.setMinutes(mm); + $scope.orderdata[i].etaTime = now; + console.log("===eta====", now, hr, mm); + }*/ } @@ -281,27 +289,29 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT $scope.order.departingDate = $scope.order.departingDate.getTime(); } var obj =JSON.parse($scope.order.priceQuote); - $scope.order.priceQuote = obj.papMargin; - + //$scope.order.priceQuote = obj.papMargin; + $scope.order.priceQuote = obj.papTotal; $scope.fuelData = {}; - $scope.fuelData.aircraftName = $scope.order.aircraftName - $scope.fuelData.companyName = $scope.order.companyName - $scope.fuelData.departingDate = $scope.order.departingDate - $scope.fuelData.fboCost = $scope.order.fboCost - $scope.fuelData.id = $scope.order.id - $scope.fuelData.invoiced = $scope.order.invoiced - $scope.fuelData.priceQuote = $scope.order.priceQuote - $scope.fuelData.volume = $scope.order.volume - $scope.fuelData.source = $scope.order.source - $scope.fuelData.status = $scope.order.status - $scope.fuelData.tierBreak = $scope.order.tierBreak - $scope.fuelData.total = $scope.order.total - $scope.fuelData.upliftDate = $scope.order.upliftDate + $scope.fuelData.aircraftName = $scope.order.aircraftName; + $scope.fuelData.companyName = $scope.order.companyName; + $scope.fuelData.departingDate = $scope.order.departingDate; + $scope.fuelData.fboCost = $scope.order.fboCost; + $scope.fuelData.id = $scope.order.id; + $scope.fuelData.invoiced = $scope.order.invoiced; + $scope.fuelData.priceQuote = $scope.order.priceQuote; + $scope.fuelData.productName = obj.productName; + $scope.fuelData.volume = $scope.order.volume; + $scope.fuelData.source = $scope.order.source; + $scope.fuelData.status = $scope.order.status; + $scope.fuelData.tierBreak = $scope.order.tierBreak; + $scope.fuelData.total = $scope.order.total; + $scope.fuelData.upliftDate = $scope.order.upliftDate; $scope.fuelData.companyId = $scope.selectedCompanyId; $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); + //console.log("=====$scope.fueldata======",$scope.fuelData) fuelOrdersService.dispathFuelOrder($scope.dispatchOrder).then(function(result) { $scope.showLoader = false; $scope.order = {}; @@ -351,48 +361,58 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT $scope.fuelData = {}; $scope.updateData = function() { if($scope.editdata.etaTime != null && $scope.editdata.etdTime != null){ - $scope.showLoader = true; - - $scope.fuelData.aircraftName = $scope.editdata.aircraftName; - $scope.fuelData.companyName = $scope.editdata.companyName; - $scope.fuelData.fboCost = $scope.editdata.fboCost; - $scope.fuelData.id = $scope.editdata.id; - $scope.fuelData.invoiced = $scope.editdata.invoiced; - $scope.fuelData.priceQuote = $scope.editdata.priceQuote; - $scope.fuelData.volume = $scope.editdata.requestedVolume; - $scope.fuelData.source = $scope.editdata.source; - $scope.fuelData.status = $scope.editdata.status; - $scope.fuelData.tierBreak = $scope.editdata.tierBreak; - $scope.fuelData.total = $scope.editdata.total; - - $scope.editdata.upliftDateString = new Date($scope.editdata.upliftDateString); - $scope.editdata.upliftDateString = $scope.editdata.upliftDateString.getTime(); - - $scope.editdata.departingDateString = new Date($scope.editdata.departingDateString); - $scope.editdata.departingDateString = $scope.editdata.departingDateString.getTime(); - - $scope.fuelData.upliftDate = $scope.editdata.upliftDateString; - $scope.fuelData.departingDate = $scope.editdata.departingDateString; - $scope.fuelData.productName = $scope.editdata.productName; - $scope.fuelData.etaTime = $scope.editdata.etaTime; - $scope.fuelData.etdTime = $scope.editdata.etdTime; - $scope.fuelData.certificateType = $scope.editdata.certificateType; - - - $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); - // console.log("====fueldata===",$scope.dispatchOrder); - //Disable below api code for temporary - fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) { - // console.log('result', result); - $scope.showLoader = false; - $scope.editdata = {}; - $('#demo-modal-5').css('display', ''); - $scope.getOrders(); - toastr.success('Fuel Order Updated Successfully', { - closeButton: true + if($scope.editdata.fuelOn != null || $scope.editdata.fuelOn != undefined) { + $scope.showLoader = true; + $scope.fuelData.aircraftName = $scope.editdata.aircraftName; + $scope.fuelData.companyName = $scope.editdata.companyName; + $scope.fuelData.fboCost = $scope.editdata.fboCost; + $scope.fuelData.id = $scope.editdata.id; + $scope.fuelData.invoiced = $scope.editdata.invoiced; + $scope.fuelData.priceQuote = $scope.editdata.priceQuote; + $scope.fuelData.volume = $scope.editdata.requestedVolume; + $scope.fuelData.source = $scope.editdata.source; + $scope.fuelData.status = $scope.editdata.status; + $scope.fuelData.tierBreak = $scope.editdata.tierBreak; + $scope.fuelData.total = $scope.editdata.total; + + $scope.editdata.upliftDateString = new Date($scope.editdata.upliftDateString); + $scope.editdata.upliftDateString = $scope.editdata.upliftDateString.getTime(); + + $scope.editdata.departingDateString = new Date($scope.editdata.departingDateString); + $scope.editdata.departingDateString = $scope.editdata.departingDateString.getTime(); + + $scope.fuelData.upliftDate = $scope.editdata.upliftDateString; + $scope.fuelData.departingDate = $scope.editdata.departingDateString; + $scope.fuelData.productName = $scope.editdata.productName; + /*$scope.fuelData.etaTime = $scope.editdata.etaTime.toLocaleTimeString(); + $scope.fuelData.etdTime = $scope.editdata.etdTime.toLocaleTimeString();*/ + $scope.fuelData.etaTime = $scope.editdata.etaTime; + $scope.fuelData.etdTime = $scope.editdata.etdTime; + $scope.fuelData.certificateType = $scope.editdata.certificateType; + $scope.fuelData.fuelOn = $scope.editdata.fuelOn; + + $scope.dispatchOrder.fuelOrderList.push($scope.fuelData); + // console.log("====fueldata===",$scope.dispatchOrder); + fuelOrdersService.updateFuelOrder($scope.dispatchOrder).then(function(result) { + // console.log('result', result); + $scope.showLoader = false; + $scope.editdata = {}; + $('#demo-modal-5').css('display', ''); + $scope.getOrders(); + toastr.success('Fuel Order Updated Successfully', { + closeButton: true + }) }) - }) - + + + } else{ + { + toastr.error('Please select fuelOn.', { + closeButton: true + }) + } + } + }else { toastr.error('Please select Arrival Time and Departure time both.', { @@ -624,7 +644,6 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT $scope.checkJetWithTail = function(tail, index){ - //console.log("tail==============",tail, index) ViewCompanyService.checkJetType(tail).then(function(result) { if(result.jetA == "true"){ $scope.jetShow[index] = false; @@ -640,19 +659,19 @@ function fuelOrdersController($scope, $rootScope, $uibModal, $filter, $http, NgT $scope.etdTimeList =[]; $scope.sourceList = [{source:"Direct Jet-A"},{source:"Direct AVGAS 100LL"}]; - $scope.etaTimeList = [{time:"12:00 AM","id":1},{time:"12:30 AM","id":2},{time:"01:00 AM","id":3},{time:"01:30 AM","id":4},{time:"02:00 AM","id":5},{time:"02:30 AM","id":6},{time:"03:00 AM","id":7},{time:"03:30 AM","id":8}, - {time:"04:00 AM","id":9},{time:"04:30 AM","id":10},{time:"05:00 AM","id":11},{time:"05:30 AM","id":12},{time:"06:00 AM","id":13},{time:"06:30 AM","id":14},{time:"07:00 AM","id":15},{time:"07:30 AM","id":16}, - {time:"08:00 AM","id":17},{time:"08:30 AM","id":18},{time:"09:00 AM","id":19},{time:"09:30 AM","id":20},{time:"10:00 AM","id":21},{time:"10:30 AM","id":22},{time:"11:00 AM","id":23},{time:"11:30 AM","id":24}, - {time:"12:00 PM","id":25},{time:"12:30 PM","id":26},{time:"01:00 PM","id":27},{time:"01:30 PM","id":28},{time:"02:00 PM","id":29},{time:"02:30 PM","id":30},{time:"03:00 PM","id":31},{time:"03:30 PM","id":32}, - {time:"04:00 PM","id":33},{time:"04:30 PM","id":34},{time:"05:00 PM","id":35},{time:"05:30 PM","id":36},{time:"06:00 PM","id":37},{time:"06:30 PM","id":38},{time:"07:00 PM","id":39},{time:"07:30 PM","id":40}, - {time:"08:00 PM","id":41},{time:"08:30 PM","id":42},{time:"9:00 PM","id":43},{time:"09:30 PM","id":44},{time:"10:00 PM","id":45},{time:"10:30 PM","id":46},{time:"11:00 PM","id":47},{time:"11:30 PM","id":48},] + $scope.etaTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"}, + {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"}, + {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"}, + {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"}, + {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"}, + {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},]; $scope.etdTimeList = [{time:"12:00 AM"},{time:"12:30 AM"},{time:"01:00 AM"},{time:"01:30 AM"},{time:"02:00 AM"},{time:"02:30 AM"},{time:"03:00 AM"},{time:"03:30 AM"}, {time:"04:00 AM"},{time:"04:30 AM"},{time:"05:00 AM"},{time:"05:30 AM"},{time:"06:00 AM"},{time:"06:30 AM"},{time:"07:00 AM"},{time:"07:30 AM"}, {time:"08:00 AM"},{time:"08:30 AM"},{time:"09:00 AM"},{time:"09:30 AM"},{time:"10:00 AM"},{time:"10:30 AM"},{time:"11:00 AM"},{time:"11:30 AM"}, {time:"12:00 PM"},{time:"12:30 PM"},{time:"01:00 PM"},{time:"01:30 PM"},{time:"02:00 PM"},{time:"02:30 PM"},{time:"03:00 PM"},{time:"03:30 PM"}, {time:"04:00 PM"},{time:"04:30 PM"},{time:"05:00 PM"},{time:"05:30 PM"},{time:"06:00 PM"},{time:"06:30 PM"},{time:"07:00 PM"},{time:"07:30 PM"}, - {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},] + {time:"08:00 PM"},{time:"08:30 PM"},{time:"9:00 PM"},{time:"09:30 PM"},{time:"10:00 PM"},{time:"10:30 PM"},{time:"11:00 PM"},{time:"11:30 PM"},]; $scope.data = {}; diff --git a/app/partials/fuelOrders/fuelOrders.html b/app/partials/fuelOrders/fuelOrders.html index 6a23bdd..5ba0d26 100644 --- a/app/partials/fuelOrders/fuelOrders.html +++ b/app/partials/fuelOrders/fuelOrders.html @@ -633,9 +633,15 @@
- + + + +
@@ -750,6 +756,8 @@ + +
@@ -780,6 +788,7 @@ +
@@ -788,7 +797,13 @@
-
Arrival +
+
@@ -860,7 +875,7 @@
- + -- 2.0.0