Blame view
app/views/fbo-flight/flightDept.controller.js
3.5 KB
e4e496d13
|
1 2 3 |
'use strict'; //Load controller |
9835dbe3e
|
4 |
angular.module('acuefuel') |
e4e496d13
|
5 |
|
d5fb510e5
|
6 |
.controller('FlightDeptController', function ($scope, $uibModal, FBOFlight) { |
0a4eb77cc
|
7 |
$scope.data = {}; |
5c6477d3d
|
8 |
$scope.user = {}; |
104d51edf
|
9 |
$scope.aircraft = {}; |
5c6477d3d
|
10 11 12 13 14 15 16 17 18 |
$scope.userData = function(){ if($scope.status == true){ $scope.user.status = 'active'; }else{ $scope.user.status = 'inactive'; } $scope.user.username = $scope.user.email; $scope.user.userType = 'flightDetp'; console.log($scope.user) |
d5fb510e5
|
19 |
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; |
7379f005b
|
20 21 22 |
FBOFlight.registerUser(formdata).then(function(result) { $scope.registerId = result; $scope.data.accountId = $scope.registerId; |
104d51edf
|
23 24 25 26 |
$scope.aircraft.accountId = $scope.registerId; toastr.success('Created Successfully', { closeButton: true }) |
5c6477d3d
|
27 28 |
}) } |
0a4eb77cc
|
29 30 |
$scope.data.cardType = 'creditCard'; |
7379f005b
|
31 32 33 34 35 36 37 |
var cardData = {} cardData.paymentMethodList = []; $scope.addCard = function(){ cardData.paymentMethodList.push($scope.data); console.log("cardData", cardData); FBOFlight.addCardInformation(cardData).then(function(result) { console.log(result) |
104d51edf
|
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
toastr.success('Created Successfully', { closeButton: true }) }) } 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().then(function(result) { $scope.aircraftSizeList = result; $scope.aircraft.size = $scope.aircraftSizeList[0]; |
7379f005b
|
60 61 62 |
}) } |
104d51edf
|
63 |
|
d5fb510e5
|
64 |
|
104d51edf
|
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
$scope.getModal = function(){ var modelId = $scope.aircraft.make FBOFlight.getModal(modelId).then(function(result) { $scope.aircraftModalList = result; $scope.aircraft.model = $scope.aircraftModalList[0]; }) } $scope.aircraftData = {}; $scope.aircraftData.aircraftList = []; $scope.getCraftList = []; $scope.addAircraft = function(){ $scope.aircraftData.aircraftList.push($scope.aircraft); console.log($scope.aircraftData.aircraftList) 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 }) }) } $scope.reset = function() { $scope.aircraft = {}; $scope.aircraft.accountId = $scope.data.accountId; $scope.aircraftData.aircraftList = []; getData(); } |
5c6477d3d
|
99 |
}); |