diff --git a/app/views/fbo-admin/dashboard.controller.js b/app/views/fbo-admin/dashboard.controller.js index 2f48d29..4ea3b3b 100644 --- a/app/views/fbo-admin/dashboard.controller.js +++ b/app/views/fbo-admin/dashboard.controller.js @@ -89,7 +89,7 @@ toastr.success('Created Successfully', { closeButton: true }) - $scope.feature.accountId = result; + $scope.feature.accountId = result.id; var featureControlData = "accountId=" + $scope.feature.accountId + "&level=" + $scope.feature.level + "&essintaPosSystem=" + $scope.feature.essintaPosSystem + "&acuQuote=" + $scope.feature.acuQuote + "&acuTrack=" + $scope.feature.acuTrack + "&fuelProgram=" + $scope.feature.fuelProgram + "&amstatIntegration=" + $scope.feature.amstatIntegration+ "&posAccountingIntegration=" + $scope.feature.posAccountingIntegration + "&posVeederRootIntegration=" + $scope.feature.posVeederRootIntegration diff --git a/app/views/fbo-flight/flight.html b/app/views/fbo-flight/flight.html index 91ef6c7..496b297 100644 --- a/app/views/fbo-flight/flight.html +++ b/app/views/fbo-flight/flight.html @@ -84,7 +84,8 @@
- + + *
@@ -308,7 +309,7 @@
-
Account Authenticatio & Payment Method
+
Account Authentication & Payment Method
diff --git a/app/views/fbo-flight/flightDept.controller.js b/app/views/fbo-flight/flightDept.controller.js index 5c48050..5c888f4 100644 --- a/app/views/fbo-flight/flightDept.controller.js +++ b/app/views/fbo-flight/flightDept.controller.js @@ -64,10 +64,11 @@ console.log($scope.user) var formdata = "companyName=" + $scope.user.companyName + "&email=" + $scope.user.email + "&username=" + $scope.user.username + "&firstName=" + $scope.user.firstName + "&lastName=" + $scope.user.lastName + "&password=" + $scope.user.password + "&phone=" + $scope.user.phone + "&mobile=" + $scope.user.mobile + "&status=" + $scope.user.status + "&userType=" + $scope.user.userType + "&clientNote=" + $scope.user.clientNote; FBOFlight.registerUser(formdata).then(function(result) { - $scope.registerId = result; + $scope.registerId = result.id; + $scope.companyId = result.companyId; $scope.data.accountId = $scope.registerId; - $scope.aircraft.accountId = $scope.registerId; - if($scope.aircraft.accountId == $scope.registerId){ + $scope.aircraft.accountId = $scope.companyId; + if($scope.aircraft.accountId == $scope.companyId){ $scope.saveCompanyData(); } toastr.success('Created Successfully', { @@ -148,6 +149,7 @@ $scope.addData = []; $scope.saveCompanyData = function(){ + console.log('=========2========',$scope.aircraftDetails); for(var i=0; i<$scope.aircraftDetails.length;i++){ $scope.addData.push({ 'tail': $scope.aircraftDetails[i].tail, @@ -173,6 +175,13 @@ }); } + getCompanyName(); + function getCompanyName(){ + $scope.showLoader = true; + FBOFlight.getCompanyName().then(function(result) { + $scope.compNameList = result; + }) + } // getData(); // function getData(){ diff --git a/app/views/fbo-flight/flightDeptService.js b/app/views/fbo-flight/flightDeptService.js index 8e3fee5..cb9a0d4 100644 --- a/app/views/fbo-flight/flightDeptService.js +++ b/app/views/fbo-flight/flightDeptService.js @@ -92,6 +92,21 @@ }) return deferred.promise; } + + this.getCompanyName = function() { + var deferred = $q.defer(); + $http({ + method : 'GET', + url : BE.url +'/company/searchName', + headers : {'Content-Type': 'application/json'}, + }) + .then(function (result){ + deferred.resolve(result.data); + },function (result){ + deferred.resolve(result.data); + }) + return deferred.promise; + } } })(); \ No newline at end of file diff --git a/app/views/updateFBODept/updateFBODept.controller.js b/app/views/updateFBODept/updateFBODept.controller.js index 907a095..17a9c86 100644 --- a/app/views/updateFBODept/updateFBODept.controller.js +++ b/app/views/updateFBODept/updateFBODept.controller.js @@ -11,31 +11,40 @@ $scope.aircraft = {}; $scope.updateData = {}; var userProfileID = $stateParams.id; + $scope.companyId; + UpdateAllFBODept.getALlFBOData(userProfileID).then(function(result) { - console.log(result) - $scope.user = result; - $scope.aircraft.accountId = result.account.id; - $scope.user.userTypeId = result.userType.id; - UpdateAllFBODept.getNotes(userProfileID).then(function(response) { - $scope.user.clientNote = response[0].notes - $scope.user.userNoteId = response[0].id; + console.log(result) + $scope.user = result; + // $scope.aircraft.accountId = result.account.id; + $scope.user.userTypeId = result.userType.id; + UpdateAllFBODept.getNotes(userProfileID).then(function(response) { + $scope.user.clientNote = response[0].notes + $scope.user.userNoteId = response[0].id; + }) + // $scope.feature = result.accountFeatureControl; + // console.log($scope.feature,"dsdsdsds") + if($scope.user.account.user.status == 'ACTIVE'){ + $scope.status = true; + }else { + $scope.status = false; + } }) - // $scope.feature = result.accountFeatureControl; - // console.log($scope.feature,"dsdsdsds") - if($scope.user.account.user.status == 'ACTIVE'){ - $scope.status = true; - }else { - $scope.status = false; - } + + UpdateAllFBODept.getAssociatedCompany(userProfileID).then(function(result) { + console.log('=======q===',result) + $scope.companyId = result.id; + getCrafts(result.id); + $scope.aircraft.accountId = result.id; }) - getCrafts(); - function getCrafts(){ - UpdateAllFBODept.getAircrafts(userProfileID).then(function(response) { + + function getCrafts(id){ + UpdateAllFBODept.getAircrafts(id).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; + $scope.getCraftList[i].sizeId = $scope.getCraftList[i].compAircraftSize.id; + $scope.getCraftList[i].size = $scope.getCraftList[i].compAircraftSize.size; } }) } @@ -160,15 +169,29 @@ }) } - $scope.aircraftData = {}; - $scope.aircraftData.aircraftList = []; + + $scope.addAircraft = function(){ + $scope.aircraftListData = {}; + $scope.addData = []; + $scope.aircraftListData.aircraftList= []; + + $scope.addData.push({ + 'tail': $scope.aircraft.tail, + 'make': $scope.aircraft.make, + 'model': $scope.aircraft.model, + 'sizeId' : $scope.aircraft.sizeId + }); + console.log('$scope.addData',$scope.addData); + + $scope.aircraftListData.aircraftList = $scope.addData; + $scope.aircraftListData.accountId = $scope.companyId; console.log($scope.aircraft) - $scope.aircraftData.aircraftList.push($scope.aircraft); + //$scope.aircraftData.aircraftList.push($scope.aircraft); - FBOFlight.addAircraft($scope.aircraftData).then(function(result) { + FBOFlight.addAircraft($scope.aircraftListData).then(function(result) { $('#myModal4').modal('hide'); - getCrafts(); + getCrafts($scope.companyId); $scope.resetData(); toastr.success('Created Successfully', { closeButton: true @@ -190,8 +213,8 @@ $scope.update = function(airdata){ $("#myModal5").modal('show'); $scope.aircraft = airdata; - console.log($scope.aircraft) - $scope.aircraft.accountId = $scope.user.account.id; + console.log('--------$scope.companyId---',$scope.companyId); + $scope.aircraft.accountId = $scope.companyId; FBOFlight.getModal($scope.aircraft.make).then(function(result) { $scope.aircraftModalList = result; @@ -213,7 +236,7 @@ $scope.updateAircraftData.model = updateAircraft.model; $scope.updateAircraftData.sizeId = updateAircraft.sizeId; $scope.updateAircraftData.tail = updateAircraft.tail; - $scope.updateAircraftData.accountId = updateAircraft.accountId; + $scope.updateAircraftData.accountId = $scope.companyId; console.log($scope.updateAircraftData) $scope.updatecraftData.aircraftList.push($scope.updateAircraftData); @@ -222,7 +245,7 @@ UpdateAllFBODept.updateAircraft($scope.updatecraftData).then(function(result) { $('#myModal5').modal('hide'); $scope.resetData(); - getCrafts(); + getCrafts($scope.companyId); toastr.success('Updated Successfully', { closeButton: true }) @@ -241,14 +264,14 @@ toastr.success(''+result.success+'', { closeButton: true }) - getCrafts(); + getCrafts($scope.companyId); }) } $scope.resetData = function() { $scope.aircraft = {}; - $scope.aircraft.accountId = $scope.user.account.id; - $scope.aircraftData.aircraftList = []; + $scope.aircraft.accountId = $scope.companyId; + $scope.aircraftListData.aircraftList = []; getData(); } diff --git a/app/views/updateFBODept/updateFBODept.service.js b/app/views/updateFBODept/updateFBODept.service.js index 61d2435..6bda316 100644 --- a/app/views/updateFBODept/updateFBODept.service.js +++ b/app/views/updateFBODept/updateFBODept.service.js @@ -19,6 +19,20 @@ }) return deferred.promise; } + + this.getAssociatedCompany = function(id) { + + var deferred = $q.defer(); + $http({ + method : 'GET', + url : BE.url +'/account/user/getFlightDeptCompany/'+id, + headers : {'Content-Type': 'application/json'}, + }) + .success(function(result) { + deferred.resolve(result); + }) + return deferred.promise; + } this.getNotes = function(id) {