diff --git a/app/views/fbo-admin/dashboard.controller.js b/app/views/fbo-admin/dashboard.controller.js index 0b204d7..b275f38 100644 --- a/app/views/fbo-admin/dashboard.controller.js +++ b/app/views/fbo-admin/dashboard.controller.js @@ -59,7 +59,7 @@ }) $state.go('index.fboAdmin'); }, function (err) { - toastr.error('Error in registering', { + toastr.error('Error in registeration', { closeButton: true }) }); diff --git a/app/views/fbo-flight/flight.html b/app/views/fbo-flight/flight.html index da4d444..c4b2905 100644 --- a/app/views/fbo-flight/flight.html +++ b/app/views/fbo-flight/flight.html @@ -1,13 +1,79 @@ - -
-
- -
-
-
- - -
+ +
+
+ +
+
+
+ +
@@ -80,7 +146,7 @@
Aircraft List
-
+ -
+
+ +
diff --git a/app/views/fbo-flight/flightDept.controller.js b/app/views/fbo-flight/flightDept.controller.js index 64d97ce..85fba15 100644 --- a/app/views/fbo-flight/flightDept.controller.js +++ b/app/views/fbo-flight/flightDept.controller.js @@ -3,7 +3,7 @@ //Load controller angular.module('acuefuel') - .controller('FlightDeptController', function ($scope, $uibModal, FBOFlight) { + .controller('FlightDeptController', function ($scope, $uibModal, $state, FBOFlight) { $(document).ready(function(){ $('.fboflight').addClass('active'); }); @@ -11,6 +11,7 @@ $scope.user = {}; $scope.aircraft = {}; $scope.userData = function(){ + if($scope.user.email == undefined || $scope.user.email == null){ toastr.error('Please enter your email first', { closeButton: true @@ -33,12 +34,15 @@ $scope.registerId = result; $scope.data.accountId = $scope.registerId; $scope.aircraft.accountId = $scope.registerId; + if($scope.aircraft.accountId == $scope.registerId){ + $scope.saveCompanyData(); + } toastr.success('Created Successfully', { closeButton: true }) $state.go('index.flightDept'); }, function (err) { - toastr.error('Error in registering', { + toastr.error('Error in registeration', { closeButton: true }) }); @@ -68,81 +72,152 @@ getData(); function getData(){ - FBOFlight.getAircraftMake().then(function(result) { + FBOFlight.getAircraftMake().then(function(result) { $scope.aircraftMakeList = result; - $scope.aircraft.make = $scope.aircraftMakeList[0]; - FBOFlight.getModal($scope.aircraft.make).then(function(result) { - $scope.aircraftModalList = result; - $scope.aircraft.model = $scope.aircraftModalList[0]; - FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { - $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; - }) - }) - }) } - - $scope.getModal = function(){ - var makeId = $scope.aircraft.make; - FBOFlight.getModal(makeId).then(function(result) { - $scope.aircraftModalList = result; - $scope.aircraft.model = $scope.aircraftModalList[0]; - FBOFlight.getAircraftSize(makeId, $scope.aircraft.model).then(function(result) { - $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; - }) + $scope.aircraftDetails = [{ + 'tail':'', + 'make': '', + 'model': '', + 'sizeId' : '' + }]; + + $scope.addNew = function(){ + $scope.aircraftDetails.push({ + 'tail':'', + 'make': '', + 'model': '', + 'sizeId' : '' + }); + console.log($scope.aircraftDetails) + }; + + $scope.getModal = function(makeId, index){ + $scope.aircraft.make = makeId; + //var makeId = makeId; + FBOFlight.getModal($scope.aircraft.make).then(function(result) { + $scope.aircraftDetails[index].aircraftModalList = result; + //$scope.aircraftDetails[index].model = $scope.aircraftModalList[0]; }) } - $scope.getSize = function(){ - FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { - $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; + $scope.getSize = function(model, index){ + FBOFlight.getAircraftSize($scope.aircraft.make, model).then(function(result) { + $scope.aircraftDetails[index].aircraftSizeList = result; + //$scope.aircraftDetails[index].size = $scope.aircraftSizeList[0]; + console.log($scope.aircraftDetails[index]) }) } - $scope.openModal = function(){ - if($scope.aircraft.accountId == undefined){ - toastr.error('Please Add Contact Information', { - closeButton: true - }) - $('#myModal4').modal('hide'); - }else{ - $('#myModal4').modal('show'); - } - - } - $scope.aircraftData = {}; - $scope.aircraftData.aircraftList = []; - $scope.getCraftList = []; - $scope.addAircraft = function(){ - $scope.aircraftData.aircraftList.push($scope.aircraft); - if ($scope.getCraftList.indexOf($scope.aircraft) == -1) { - $scope.getCraftList.push($scope.aircraft); + $scope.aircraftListData = {}; + $scope.addData = []; + + $scope.saveCompanyData = function(){ + for(var i=0; i<$scope.aircraftDetails.length;i++){ + $scope.addData.push({ + 'tail': $scope.aircraftDetails[i].tail, + 'make': $scope.aircraftDetails[i].make, + 'model': $scope.aircraftDetails[i].model, + 'sizeId' : $scope.aircraftDetails[i].sizeId + }); } + $scope.aircraftListData.aircraftList = $scope.addData; + $scope.aircraftListData.accountId = $scope.aircraft.accountId; - FBOFlight.addAircraft($scope.aircraftData).then(function(result) { - $('#myModal4').modal('hide'); - $scope.reset(); - toastr.success('Created Successfully', { - closeButton: true - }) - }, function (err) { - toastr.error('Error in Adding Aircraft', { - closeButton: true - }) - $('#myModal4').modal('hide'); - $scope.getCraftList.splice($scope.aircraft); + FBOFlight.addAircraft($scope.aircraftListData).then(function(result) { + console.log(result) + if(result != null && result.success){ + toastr.success(''+result.success+'', { + closeButton: true + }) + }else{ + toastr.error(''+result.statusText+'', { + closeButton: true + }) + } }); } - $scope.reset = function() { - $scope.aircraft = {}; - $scope.aircraft.accountId = $scope.data.accountId; - $scope.aircraftData.aircraftList = []; - getData(); - } + // getData(); + // function getData(){ + // FBOFlight.getAircraftMake().then(function(result) { + // $scope.aircraftMakeList = result; + // $scope.aircraft.make = $scope.aircraftMakeList[0]; + // FBOFlight.getModal($scope.aircraft.make).then(function(result) { + // $scope.aircraftModalList = result; + // $scope.aircraft.model = $scope.aircraftModalList[0]; + // FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { + // $scope.aircraftSizeList = result; + // $scope.aircraft.size = $scope.aircraftSizeList[0]; + // }) + // }) + + // }) + // } + + + // $scope.getModal = function(){ + // var makeId = $scope.aircraft.make; + // FBOFlight.getModal(makeId).then(function(result) { + // $scope.aircraftModalList = result; + // $scope.aircraft.model = $scope.aircraftModalList[0]; + // FBOFlight.getAircraftSize(makeId, $scope.aircraft.model).then(function(result) { + // $scope.aircraftSizeList = result; + // $scope.aircraft.size = $scope.aircraftSizeList[0]; + // }) + // }) + // } + + // $scope.getSize = function(){ + // FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { + // $scope.aircraftSizeList = result; + // $scope.aircraft.size = $scope.aircraftSizeList[0]; + // }) + // } + + // $scope.openModal = function(){ + // if($scope.aircraft.accountId == undefined){ + // toastr.error('Please Add Contact Information', { + // closeButton: true + // }) + // $('#myModal4').modal('hide'); + // }else{ + // $('#myModal4').modal('show'); + // } + + // } + // $scope.aircraftData = {}; + // $scope.aircraftData.aircraftList = []; + // $scope.getCraftList = []; + // $scope.addAircraft = function(){ + // $scope.aircraftData.aircraftList.push($scope.aircraft); + // if ($scope.getCraftList.indexOf($scope.aircraft) == -1) { + // $scope.getCraftList.push($scope.aircraft); + // } + + // FBOFlight.addAircraft($scope.aircraftData).then(function(result) { + // $('#myModal4').modal('hide'); + // $scope.reset(); + // toastr.success('Created Successfully', { + // closeButton: true + // }) + // }, function (err) { + // toastr.error('Error in Adding Aircraft', { + // closeButton: true + // }) + // $('#myModal4').modal('hide'); + // $scope.getCraftList.splice($scope.aircraft); + // }); + + // } + + // $scope.reset = function() { + // $scope.aircraft = {}; + // $scope.aircraft.accountId = $scope.data.accountId; + // $scope.aircraftData.aircraftList = []; + // getData(); + // } }); \ No newline at end of file diff --git a/app/views/updateAllFBO/updateAllFBO.html b/app/views/updateAllFBO/updateAllFBO.html index dbf9ee3..1f99e42 100644 --- a/app/views/updateAllFBO/updateAllFBO.html +++ b/app/views/updateAllFBO/updateAllFBO.html @@ -39,7 +39,7 @@
- +
+
diff --git a/app/views/updateFBODept/updateFBODept.controller.js b/app/views/updateFBODept/updateFBODept.controller.js index a75c577..8d18462 100644 --- a/app/views/updateFBODept/updateFBODept.controller.js +++ b/app/views/updateFBODept/updateFBODept.controller.js @@ -33,6 +33,10 @@ function getCrafts(){ UpdateAllFBODept.getAircrafts(userProfileID).then(function(response) { $scope.getCraftList = response; + for(var i=0;i<$scope.getCraftList.length;i++){ + $scope.getCraftList[i].sizeId = $scope.getCraftList[i].userAircraftSize.id; + $scope.getCraftList[i].size = $scope.getCraftList[i].userAircraftSize.size; + } }) } @@ -115,7 +119,7 @@ FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; + $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; }) }) @@ -131,7 +135,7 @@ FBOFlight.getAircraftSize(makeId, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; + $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; }) }) } @@ -139,13 +143,16 @@ $scope.getSize = function(){ FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - $scope.aircraft.size = $scope.aircraftSizeList[0]; + console.log($scope.aircraftSizeList) + $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; + console.log($scope.aircraft.sizeId) }) } $scope.aircraftData = {}; $scope.aircraftData.aircraftList = []; $scope.addAircraft = function(){ + console.log($scope.aircraft) $scope.aircraftData.aircraftList.push($scope.aircraft); FBOFlight.addAircraft($scope.aircraftData).then(function(result) { @@ -162,7 +169,7 @@ $('#myModal4').modal('hide'); $scope.getCraftList.splice($scope.aircraft); }); - } + } $scope.closeModal = function(){ $("#myModal5").modal('hide'); @@ -179,7 +186,8 @@ $scope.aircraftModalList = result; FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - + console.log($scope.aircraftSizeList) + $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; }) }) } @@ -192,7 +200,7 @@ $scope.updateAircraftData.id = updateAircraft.id; $scope.updateAircraftData.make = updateAircraft.make; $scope.updateAircraftData.model = updateAircraft.model; - $scope.updateAircraftData.size = updateAircraft.size; + $scope.updateAircraftData.sizeId = updateAircraft.sizeId; $scope.updateAircraftData.tail = updateAircraft.tail; $scope.updateAircraftData.accountId = updateAircraft.accountId; console.log($scope.updateAircraftData) @@ -203,6 +211,7 @@ UpdateAllFBODept.updateAircraft($scope.updatecraftData).then(function(result) { $('#myModal5').modal('hide'); $scope.resetData(); + getCrafts(); toastr.success('Updated Successfully', { closeButton: true }) diff --git a/app/views/updateFBODept/updateFBODept.html b/app/views/updateFBODept/updateFBODept.html index 8b3c124..9e6920d 100644 --- a/app/views/updateFBODept/updateFBODept.html +++ b/app/views/updateFBODept/updateFBODept.html @@ -38,7 +38,7 @@
- +
@@ -167,8 +169,9 @@ - + @@ -218,9 +221,11 @@ - + +