Commit 1956e38441544c9adde7434fe6d4aa93d303ef82
1 parent
83d88e5798
Exists in
master
handle errors
Showing
7 changed files
with
92 additions
and
17 deletions
Show diff stats
app/views/fbo-admin/dashboard.controller.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | //Load controller | 3 | //Load controller |
4 | angular.module('acuefuel') | 4 | angular.module('acuefuel') |
5 | 5 | ||
6 | .controller('DashboardController', function($scope, FBOAdmin) { | 6 | .controller('DashboardController', function($scope, FBOAdmin) { |
7 | $(document).ready(function(){ | 7 | $(document).ready(function(){ |
8 | $('.i-checks').iCheck({ | 8 | $('.i-checks').iCheck({ |
9 | checkboxClass: 'icheckbox_square-green', | 9 | checkboxClass: 'icheckbox_square-green', |
10 | radioClass: 'iradio_square-green', | 10 | radioClass: 'iradio_square-green', |
11 | }); | 11 | }); |
12 | }); | 12 | }); |
13 | 13 | ||
14 | $scope.userName = 'Dylan Goodwin'; | 14 | $scope.userName = 'Dylan Goodwin'; |
15 | $scope.essAccountId = true; | 15 | $scope.essAccountId = true; |
16 | $("#esAccId").css({ opacity: 0.5 }); | 16 | $("#esAccId").css({ opacity: 0.5 }); |
17 | $scope.user = {}; | 17 | $scope.user = {}; |
18 | $scope.feature = {}; | 18 | $scope.feature = {}; |
19 | $scope.feature.level = 'silver'; | 19 | $scope.feature.level = 'silver'; |
20 | $scope.feature.essintaPosSystem = false; | 20 | $scope.feature.essintaPosSystem = false; |
21 | $scope.feature.acuQuote = false; | 21 | $scope.feature.acuQuote = false; |
22 | $scope.feature.acuTrack = false; | 22 | $scope.feature.acuTrack = false; |
23 | $scope.feature.fuelProgram = false; | 23 | $scope.feature.fuelProgram = false; |
24 | $scope.feature.amstatIntegration = false; | 24 | $scope.feature.amstatIntegration = false; |
25 | $scope.feature.posAccountingIntegration = false; | 25 | $scope.feature.posAccountingIntegration = false; |
26 | $scope.feature.posVeederRootIntegration = false; | 26 | $scope.feature.posVeederRootIntegration = false; |
27 | $scope.userData = function(){ | 27 | $scope.userData = function(){ |
28 | console.log("daadada", $scope.feature) | 28 | console.log("daadada", $scope.feature) |
29 | 29 | ||
30 | if($scope.status == true){ | 30 | if($scope.status == true){ |
31 | $scope.user.status = 'active'; | 31 | $scope.user.status = 'active'; |
32 | }else{ | 32 | }else{ |
33 | $scope.user.status = 'inactive'; | 33 | $scope.user.status = 'inactive'; |
34 | } | 34 | } |
35 | $scope.user.username = $scope.user.email; | 35 | $scope.user.username = $scope.user.email; |
36 | $scope.user.userType = 'fbo'; | 36 | $scope.user.userType = 'fbo'; |
37 | console.log($scope.user) | 37 | console.log($scope.user) |
38 | 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; | 38 | 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; |
39 | FBOAdmin.registerUser(formdata).then(function(result) { | 39 | FBOAdmin.registerUser(formdata).then(function(result) { |
40 | 40 | toastr.success('Created Successfully', { | |
41 | closeButton: true | ||
42 | }) | ||
41 | $scope.feature.accountId = result; | 43 | $scope.feature.accountId = result; |
42 | var featureControlData = "accountId=" + $scope.feature.accountId + "&level=" + $scope.feature.level + "&essintaPosSystem=" + $scope.feature.essintaPosSystem | 44 | var featureControlData = "accountId=" + $scope.feature.accountId + "&level=" + $scope.feature.level + "&essintaPosSystem=" + $scope.feature.essintaPosSystem |
43 | + "&acuQuote=" + $scope.feature.acuQuote + "&acuTrack=" + $scope.feature.acuTrack + "&fuelProgram=" + $scope.feature.fuelProgram + "&amstatIntegration=" + $scope.feature.amstatIntegration+ "&posAccountingIntegration=" | 45 | + "&acuQuote=" + $scope.feature.acuQuote + "&acuTrack=" + $scope.feature.acuTrack + "&fuelProgram=" + $scope.feature.fuelProgram + "&amstatIntegration=" + $scope.feature.amstatIntegration+ "&posAccountingIntegration=" |
44 | + $scope.feature.posAccountingIntegration + "&posVeederRootIntegration=" + $scope.feature.posVeederRootIntegration | 46 | + $scope.feature.posAccountingIntegration + "&posVeederRootIntegration=" + $scope.feature.posVeederRootIntegration |
45 | + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences; | 47 | + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences; |
46 | 48 | ||
47 | FBOAdmin.featureControl(featureControlData).then(function(response) { | 49 | FBOAdmin.featureControl(featureControlData).then(function(response) { |
48 | console.log(response) | 50 | console.log(response) |
49 | 51 | ||
50 | }) | 52 | }) |
51 | }) | 53 | }, function (err) { |
54 | toastr.error('Error in registering', { | ||
55 | closeButton: true | ||
56 | }) | ||
57 | }); | ||
52 | } | 58 | } |
53 | 59 | ||
54 | $scope.enableEssId = function(){ | 60 | $scope.enableEssId = function(){ |
55 | if($scope.feature.essintaPosSystem == true){ | 61 | if($scope.feature.essintaPosSystem == true){ |
56 | $scope.essAccountId = false; | 62 | $scope.essAccountId = false; |
57 | $("#esAccId").css({ opacity: 1 }); | 63 | $("#esAccId").css({ opacity: 1 }); |
58 | }else{ | 64 | }else{ |
59 | $scope.essAccountId = true; | 65 | $scope.essAccountId = true; |
60 | delete $scope.feature.essintaAccountUid; | 66 | delete $scope.feature.essintaAccountUid; |
61 | $("#esAccId").css({ opacity: 0.5 }); | 67 | $("#esAccId").css({ opacity: 0.5 }); |
62 | } | 68 | } |
63 | } | 69 | } |
64 | 70 | ||
65 | }); | 71 | }); |
app/views/fbo-admin/dashboard.service.js
1 | (function() { | 1 | (function() { |
2 | 'use strict'; | 2 | 'use strict'; |
3 | 3 | ||
4 | angular.module('acuefuel') | 4 | angular.module('acuefuel') |
5 | .service('FBOAdmin', ['$rootScope', '$q', '$http', 'BE', FBOAdmin]) | 5 | .service('FBOAdmin', ['$rootScope', '$q', '$http', 'BE', FBOAdmin]) |
6 | 6 | ||
7 | function FBOAdmin($rootScope, $q, $http, BE) { | 7 | function FBOAdmin($rootScope, $q, $http, BE) { |
8 | 8 | ||
9 | this.registerUser = function(data) { | 9 | this.registerUser = function(data) { |
10 | 10 | ||
11 | var deferred = $q.defer(); | 11 | var deferred = $q.defer(); |
12 | $http({ | 12 | $http({ |
13 | method : 'POST', | 13 | method : 'POST', |
14 | url : BE.url +'/account/user/registration', | 14 | url : BE.url +'/account/user/registration', |
15 | headers : {'Content-Type': 'application/x-www-form-urlencoded'}, | 15 | headers : {'Content-Type': 'application/x-www-form-urlencoded'}, |
16 | data : data | 16 | data : data |
17 | }) | 17 | }) |
18 | .success(function(result) { | 18 | .success(function(result) { |
19 | deferred.resolve(result); | 19 | deferred.resolve(result); |
20 | }).error(function(error){ | ||
21 | deferred.reject(error); | ||
20 | }) | 22 | }) |
21 | return deferred.promise; | 23 | return deferred.promise; |
22 | } | 24 | } |
23 | 25 | ||
24 | this.featureControl = function(data) { | 26 | this.featureControl = function(data) { |
25 | 27 | ||
26 | var deferred = $q.defer(); | 28 | var deferred = $q.defer(); |
27 | $http({ | 29 | $http({ |
28 | method : 'POST', | 30 | method : 'POST', |
29 | url : BE.url +'/account/user/accountFeatureControl', | 31 | url : BE.url +'/account/user/accountFeatureControl', |
30 | headers : {'Content-Type': 'application/json'}, | 32 | headers : {'Content-Type': 'application/json'}, |
31 | data : data | 33 | data : data |
32 | }) | 34 | }) |
33 | .success(function(result) { | 35 | .success(function(result) { |
34 | deferred.resolve(result); | 36 | deferred.resolve(result); |
35 | }) | 37 | }) |
36 | return deferred.promise; | 38 | return deferred.promise; |
37 | } | 39 | } |
38 | } | 40 | } |
39 | 41 | ||
40 | })(); | 42 | })(); |
app/views/fbo-flight/flight.html
1 | </div> | 1 | </div> |
2 | <div class="row wrapper border-bottom white-bg page-heading"> | 2 | <div class="row wrapper border-bottom white-bg page-heading"> |
3 | <div class="col-lg-8"> | 3 | <div class="col-lg-8"> |
4 | <h2>Tellus Institute</h2> | 4 | <h2>Tellus Institute</h2> |
5 | </div> | 5 | </div> |
6 | <div class="col-lg-4" style="margin-top: 20px; text-align: right;"> | 6 | <div class="col-lg-4" style="margin-top: 20px; text-align: right;"> |
7 | <button type="button" class="btn btn-default btn-sm" ui-sref="index.flightDept">Cancel</button> | 7 | <button type="button" class="btn btn-default btn-sm" ui-sref="index.flightDept">Cancel</button> |
8 | <button type="button" class="btn btn-primary btn-sm" ng-click="userData()">Save Changes</button> | 8 | <button type="button" class="btn btn-primary btn-sm" ng-click="userData()">Save Changes</button> |
9 | </div> | 9 | </div> |
10 | </div> | 10 | </div> |
11 | </div> | 11 | </div> |
12 | <div class="wrapper wrapper-content animated fadeInRight"> | 12 | <div class="wrapper wrapper-content animated fadeInRight"> |
13 | <div class="row"> | 13 | <div class="row"> |
14 | <div class="col-lg-7"> | 14 | <div class="col-lg-7"> |
15 | <div class="ibox float-e-margins"> | 15 | <div class="ibox float-e-margins"> |
16 | <div class="ibox-title"> | 16 | <div class="ibox-title"> |
17 | <div class="pull-left"> | 17 | <div class="pull-left"> |
18 | <h5>Contact Information</h5> | 18 | <h5>Contact Information</h5> |
19 | </div> | 19 | </div> |
20 | <div class="pull-right my-toggle-switch"> | 20 | <div class="pull-right my-toggle-switch"> |
21 | <div class="switch"> | 21 | <div class="switch"> |
22 | <div class="onoffswitch"> | 22 | <div class="onoffswitch"> |
23 | <input type="checkbox" ng-checked="status === true" ng-model="status" ng-init="status = true" class="onoffswitch-checkbox" id="example1"> | 23 | <input type="checkbox" ng-checked="status === true" ng-model="status" ng-init="status = true" class="onoffswitch-checkbox" id="example1"> |
24 | <label class="onoffswitch-label" for="example1"> | 24 | <label class="onoffswitch-label" for="example1"> |
25 | <span class="onoffswitch-inner"></span> | 25 | <span class="onoffswitch-inner"></span> |
26 | <span class="onoffswitch-switch"></span> | 26 | <span class="onoffswitch-switch"></span> |
27 | </label> | 27 | </label> |
28 | </div> | 28 | </div> |
29 | </div> | 29 | </div> |
30 | </div> | 30 | </div> |
31 | <div class="clearfix"></div> | 31 | <div class="clearfix"></div> |
32 | </div> | 32 | </div> |
33 | <div class="ibox-content"> | 33 | <div class="ibox-content"> |
34 | <div class="row"> | 34 | <div class="row"> |
35 | <form role="form"> | 35 | <form role="form"> |
36 | <div class="col-sm-6 b-r"> | 36 | <div class="col-sm-6 b-r"> |
37 | <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> --> | 37 | <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> --> |
38 | <div class="form-group"><label>Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div> | 38 | <div class="form-group"><label>Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div> |
39 | <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div> | 39 | <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div> |
40 | <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div> | 40 | <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div> |
41 | <!-- <div> | 41 | <!-- <div> |
42 | <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>Log in</strong></button> | 42 | <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>Log in</strong></button> |
43 | <label> <input type="checkbox" class="i-checks"> Remember me </label> | 43 | <label> <input type="checkbox" class="i-checks"> Remember me </label> |
44 | </div> --> | 44 | </div> --> |
45 | 45 | ||
46 | </div> | 46 | </div> |
47 | <div class="col-sm-6"> | 47 | <div class="col-sm-6"> |
48 | <div class="form-group"><label>Password</label> <input type="password" ng-model="user.password" placeholder="Password" class="form-control"></div> | 48 | <div class="form-group"><label>Password</label> <input type="password" ng-model="user.password" placeholder="Password" class="form-control"></div> |
49 | <div class="form-group"><label>Phone</label> <input type="number" ng-model="user.phone" placeholder="Phone" class="form-control"></div> | 49 | <div class="form-group"><label>Phone</label> <input type="number" ng-model="user.phone" placeholder="Phone" class="form-control"></div> |
50 | <div class="form-group"><label>Mobile</label> <input type="number" ng-model="user.mobile" placeholder="Mobile" class="form-control"></div> | 50 | <div class="form-group"><label>Mobile</label> <input type="number" ng-model="user.mobile" placeholder="Mobile" class="form-control"></div> |
51 | </div> | 51 | </div> |
52 | </form> | 52 | </form> |
53 | </div> | 53 | </div> |
54 | </div> | 54 | </div> |
55 | </div> | 55 | </div> |
56 | </div> | 56 | </div> |
57 | <div class="col-lg-5"> | 57 | <div class="col-lg-5"> |
58 | <div class="ibox float-e-margins"> | 58 | <div class="ibox float-e-margins"> |
59 | <div class="ibox-title"> | 59 | <div class="ibox-title"> |
60 | <h5>Client Notes</h5> | 60 | <h5>Client Notes</h5> |
61 | 61 | ||
62 | </div> | 62 | </div> |
63 | <div class="ibox-content"> | 63 | <div class="ibox-content"> |
64 | <div class="row"> | 64 | <div class="row"> |
65 | <form role="form"> | 65 | <form role="form"> |
66 | <textarea class="form-control" rows="10" ng-model="user.clientNote" id="comment"></textarea> | 66 | <textarea class="form-control" rows="10" ng-model="user.clientNote" id="comment"></textarea> |
67 | </form> | 67 | </form> |
68 | </div> | 68 | </div> |
69 | </div> | 69 | </div> |
70 | 70 | ||
71 | </div> | 71 | </div> |
72 | </div> | 72 | </div> |
73 | </div> | 73 | </div> |
74 | </div> | 74 | </div> |
75 | 75 | ||
76 | <div> | 76 | <div> |
77 | <div class="row"> | 77 | <div class="row"> |
78 | <div class="col-lg-7"> | 78 | <div class="col-lg-7"> |
79 | <div class="ibox float-e-margins"> | 79 | <div class="ibox float-e-margins"> |
80 | <div class="ibox-title"> | 80 | <div class="ibox-title"> |
81 | <h5>Aircraft List</h5> | 81 | <h5>Aircraft List</h5> |
82 | <div class="pull-right"> | 82 | <div class="pull-right"> |
83 | <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#myModal4">+ Add</button> | 83 | <button type="button" class="btn btn-primary btn-sm" ng-click="openModal()">+ Add</button> |
84 | </div> | 84 | </div> |
85 | <div class="clearfix"></div> | 85 | <div class="clearfix"></div> |
86 | <div class="modal inmodal" id="myModal4" tabindex="-1" role="dialog" aria-hidden="true"> | 86 | <div class="modal inmodal" id="myModal4" tabindex="-1" role="dialog" aria-hidden="true"> |
87 | <div class="modal-dialog"> | 87 | <div class="modal-dialog"> |
88 | <div class="modal-content animated fadeIn"> | 88 | <div class="modal-content animated fadeIn"> |
89 | <div class="modal-header"> | 89 | <div class="modal-header"> |
90 | <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> | 90 | <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button> |
91 | <!-- <i class="fa fa-clock-o modal-icon"></i> --> | 91 | <!-- <i class="fa fa-clock-o modal-icon"></i> --> |
92 | <h4 class="modal-title">Add Aircraft</h4> | 92 | <h4 class="modal-title">Add Aircraft</h4> |
93 | <!-- <small>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</small> --> | 93 | <!-- <small>Lorem Ipsum is simply dummy text of the printing and typesetting industry.</small> --> |
94 | </div> | 94 | </div> |
95 | <div class="modal-body" style="padding: 15px;"> | 95 | <div class="modal-body" style="padding: 15px;"> |
96 | <table class="table table-bordered table-hover table-striped"> | 96 | <table class="table table-bordered table-hover table-striped"> |
97 | <thead> | 97 | <thead> |
98 | <tr> | 98 | <tr> |
99 | <th>Tail</th> | 99 | <th>Tail</th> |
100 | <th>Make</th> | 100 | <th>Make</th> |
101 | <th>Model</th> | 101 | <th>Model</th> |
102 | <th>Size</th> | 102 | <th>Size</th> |
103 | </tr> | 103 | </tr> |
104 | </thead> | 104 | </thead> |
105 | <tbody> | 105 | <tbody> |
106 | <tr> | 106 | <tr> |
107 | <td> | 107 | <td> |
108 | <input type="text" style="width:100px;" ng-model="aircraft.tail" class="form-control"> | 108 | <input type="text" style="width:100px;" ng-model="aircraft.tail" class="form-control"> |
109 | </td> | 109 | </td> |
110 | <td style="width: 30%"> | 110 | <td style="width: 30%"> |
111 | <select class="form-control" ng-model="aircraft.make" ng-change="getModal()"> | 111 | <select class="form-control" ng-model="aircraft.make" ng-change="getModal()"> |
112 | <option ng-repeat="make in aircraftMakeList">{{make}}</option> | 112 | <option ng-repeat="make in aircraftMakeList">{{make}}</option> |
113 | </select> | 113 | </select> |
114 | </td> | 114 | </td> |
115 | <td style="width: 30%"> | 115 | <td style="width: 30%"> |
116 | <select class="form-control"> | 116 | <select class="form-control"> |
117 | <option ng-repeat="model in aircraftModalList" ng-model="aircraft.model">{{model}}</option> | 117 | <option ng-repeat="model in aircraftModalList" ng-model="aircraft.model">{{model}}</option> |
118 | </select> | 118 | </select> |
119 | </td> | 119 | </td> |
120 | <td style="width: 30%"> | 120 | <td style="width: 30%"> |
121 | <select class="form-control"> | 121 | <select class="form-control"> |
122 | <option ng-repeat="size in aircraftSizeList" ng-model="aircraft.size">{{size}}</option> | 122 | <option ng-repeat="size in aircraftSizeList" ng-model="aircraft.size">{{size}}</option> |
123 | </select> | 123 | </select> |
124 | </td> | 124 | </td> |
125 | </tr> | 125 | </tr> |
126 | </tbody> | 126 | </tbody> |
127 | </table> | 127 | </table> |
128 | </div> | 128 | </div> |
129 | <div class="modal-footer"> | 129 | <div class="modal-footer"> |
130 | <button type="button" class="btn btn-white" data-dismiss="modal">Close</button> | 130 | <button type="button" class="btn btn-white" data-dismiss="modal">Close</button> |
131 | <button type="button" class="btn btn-primary" ng-click="addAircraft()">Save changes</button> | 131 | <button type="button" class="btn btn-primary" ng-click="addAircraft()">Save changes</button> |
132 | </div> | 132 | </div> |
133 | </div> | 133 | </div> |
134 | </div> | 134 | </div> |
135 | </div> | 135 | </div> |
136 | </div> | 136 | </div> |
137 | <div class="ibox-content"> | 137 | <div class="ibox-content"> |
138 | <div class="table-responsive"> | 138 | <div class="table-responsive"> |
139 | <table class="table table-bordered table-hover table-striped"> | 139 | <table class="table table-bordered table-hover table-striped"> |
140 | <thead> | 140 | <thead> |
141 | <tr> | 141 | <tr> |
142 | <th>Tail</th> | 142 | <th>Tail</th> |
143 | <th>Make</th> | 143 | <th>Make</th> |
144 | <th>Model</th> | 144 | <th>Model</th> |
145 | <th>Size</th> | 145 | <th>Size</th> |
146 | </tr> | 146 | </tr> |
147 | </thead> | 147 | </thead> |
148 | <tbody> | 148 | <tbody> |
149 | <tr ng-repeat="airData in getCraftList track by $index"> | 149 | <tr ng-repeat="airData in getCraftList track by $index"> |
150 | <td> | 150 | <td> |
151 | <input type="text" style="width:100px;" ng-model="airData.tail" class="form-control"> | 151 | <input type="text" style="width:100px;" ng-model="airData.tail" class="form-control"> |
152 | </td> | 152 | </td> |
153 | <td> | 153 | <td> |
154 | <select class="form-control" ng-model="airData.make"> | 154 | <select class="form-control" ng-model="airData.make"> |
155 | <option>{{airData.make}}</option> | 155 | <option>{{airData.make}}</option> |
156 | </select> | 156 | </select> |
157 | </td> | 157 | </td> |
158 | <td> | 158 | <td> |
159 | <select class="form-control" ng-model="airData.model"> | 159 | <select class="form-control" ng-model="airData.model"> |
160 | <option>{{airData.model}}</option> | 160 | <option>{{airData.model}}</option> |
161 | </select> | 161 | </select> |
162 | </td> | 162 | </td> |
163 | <td> | 163 | <td> |
164 | <select class="form-control" ng-model="airData.size"> | 164 | <select class="form-control" ng-model="airData.size"> |
165 | <option>{{airData.size}}</option> | 165 | <option>{{airData.size}}</option> |
166 | </select> | 166 | </select> |
167 | </td> | 167 | </td> |
168 | </tr> | 168 | </tr> |
169 | </tbody> | 169 | </tbody> |
170 | </table> | 170 | </table> |
171 | </div> | 171 | </div> |
172 | <div class="clearfix"></div> | 172 | <div class="clearfix"></div> |
173 | </div> | 173 | </div> |
174 | </div> | 174 | </div> |
175 | </div> | 175 | </div> |
176 | <div class="col-lg-5"> | 176 | <div class="col-lg-5"> |
177 | <div class="ibox float-e-margins"> | 177 | <div class="ibox float-e-margins"> |
178 | <div class="ibox-title"> | 178 | <div class="ibox-title"> |
179 | <h5>Account Authenticatio & Payment Method</h5> | 179 | <h5>Account Authenticatio & Payment Method</h5> |
180 | 180 | ||
181 | </div> | 181 | </div> |
182 | <div class="ibox-content"> | 182 | <div class="ibox-content"> |
183 | <!-- <div class="row"> | 183 | <!-- <div class="row"> |
184 | <div class="col-md-3"> | 184 | <div class="col-md-3"> |
185 | <img src="images/master.png"> | 185 | <img src="images/master.png"> |
186 | </div> | 186 | </div> |
187 | <div class="col-md-9"> | 187 | <div class="col-md-9"> |
188 | <div class="col"> | 188 | <div class="col"> |
189 | <span style="font-size: large; color: #909394;">**** **** **** 7002</span> | 189 | <span style="font-size: large; color: #909394;">**** **** **** 7002</span> |
190 | </div> | 190 | </div> |
191 | <div class="col"> | 191 | <div class="col"> |
192 | <span><strong>Expiry Date:</strong>10/16</span> | 192 | <span><strong>Expiry Date:</strong>10/16</span> |
193 | </div> | 193 | </div> |
194 | </div> | 194 | </div> |
195 | <div class="clearfix"></div> | 195 | <div class="clearfix"></div> |
196 | <br> | 196 | <br> |
197 | 197 | ||
198 | <div class="col-md-3"> | 198 | <div class="col-md-3"> |
199 | <img src="images/visa1.png"> | 199 | <img src="images/visa1.png"> |
200 | </div> | 200 | </div> |
201 | <div class="col-md-9"> | 201 | <div class="col-md-9"> |
202 | <div class="col"> | 202 | <div class="col"> |
203 | <span style="font-size: large; color: #909394;">**** **** **** 1060</span> | 203 | <span style="font-size: large; color: #909394;">**** **** **** 1060</span> |
204 | </div> | 204 | </div> |
205 | <div class="col"> | 205 | <div class="col"> |
206 | <span><strong>Expiry Date:</strong>10/16</span> | 206 | <span><strong>Expiry Date:</strong>10/16</span> |
207 | </div> | 207 | </div> |
208 | </div> | 208 | </div> |
209 | <div class="clearfix"></div> | 209 | <div class="clearfix"></div> |
210 | </div> --> | 210 | </div> --> |
211 | 211 | ||
212 | 212 | ||
213 | <div class="row"> | 213 | <div class="row"> |
214 | 214 | ||
215 | <!-- <form name="myForm"> | 215 | <!-- <form name="myForm"> |
216 | 216 | ||
217 | <div class="span3"> | 217 | <div class="span3"> |
218 | <label for="">Card number</label> | 218 | <label for="">Card number</label> |
219 | <input type="text" class="form-control" ng-model="number"> | 219 | <input type="text" class="form-control" ng-model="number"> |
220 | </div> | 220 | </div> |
221 | 221 | ||
222 | <div class="span3"> | 222 | <div class="span3"> |
223 | <label for="">Name on card </label> | 223 | <label for="">Name on card </label> |
224 | <input type="text" class="form-control"> | 224 | <input type="text" class="form-control"> |
225 | </div> | 225 | </div> |
226 | 226 | ||
227 | <div class="row"> | 227 | <div class="row"> |
228 | <div class="col-sm-6"> | 228 | <div class="col-sm-6"> |
229 | <label for="">Expiry</label> | 229 | <label for="">Expiry</label> |
230 | <input type="text" class="form-control" ng-model="expiry"> | 230 | <input type="text" class="form-control" ng-model="expiry"> |
231 | </div> | 231 | </div> |
232 | 232 | ||
233 | <div class="col-sm-6"> | 233 | <div class="col-sm-6"> |
234 | <label for="">CVV</label> | 234 | <label for="">CVV</label> |
235 | <input type="text" class="form-control" ng-model="cvc"> | 235 | <input type="text" class="form-control" ng-model="cvc"> |
236 | </div> | 236 | </div> |
237 | </div> | 237 | </div> |
238 | <div class="span4"> | 238 | <div class="span4"> |
239 | <button type="submit" class="btn btn-primary btn-large">Add</button> | 239 | <button type="submit" class="btn btn-primary btn-large">Add</button> |
240 | </div> | 240 | </div> |
241 | 241 | ||
242 | </form> --> | 242 | </form> --> |
243 | 243 | ||
244 | <div class="container"> | 244 | <div class="container"> |
245 | <div class="row"> | 245 | <div class="row"> |
246 | <div class="col-xs-12 col-md-4"> | 246 | <div class="col-xs-12 col-md-4"> |
247 | <div class="panel panel-default credit-card-box"> | 247 | <div class="panel panel-default credit-card-box"> |
248 | <div class="panel-heading display-table" > | 248 | <div class="panel-heading display-table" > |
249 | <div class="row display-tr" > | 249 | <div class="row display-tr" > |
250 | <h3 class="panel-title display-td" >Payment Details</h3> | 250 | <h3 class="panel-title display-td" >Payment Details</h3> |
251 | <div class="display-td" > | 251 | <div class="display-td" > |
252 | <img class="img-responsive pull-right" src="http://i76.imgup.net/accepted_c22e0.png"> | 252 | <img class="img-responsive pull-right" src="http://i76.imgup.net/accepted_c22e0.png"> |
253 | </div> | 253 | </div> |
254 | </div> | 254 | </div> |
255 | </div> | 255 | </div> |
256 | <div class="panel-body"> | 256 | <div class="panel-body"> |
257 | <form role="form" id="payment-form"> | 257 | <form role="form" id="payment-form"> |
258 | <div class="row"> | 258 | <div class="row"> |
259 | <div class="col-xs-12"> | 259 | <div class="col-xs-12"> |
260 | <div class="form-group"> | 260 | <div class="form-group"> |
261 | <label for="cardNumber">CARD NUMBER</label> | 261 | <label for="cardNumber">CARD NUMBER</label> |
262 | <div class="input-group"> | 262 | <div class="input-group"> |
263 | <input type="number" ng-model="data.cardNumber" maxlength="16" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" class="form-control" name="cardNumber" placeholder="Valid Card Number" autocomplete="cc-number" required autofocus> | 263 | <input type="number" ng-model="data.cardNumber" maxlength="16" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" class="form-control" name="cardNumber" placeholder="Valid Card Number" autocomplete="cc-number" required autofocus> |
264 | <span class="input-group-addon"><i class="fa fa-credit-card"></i></span> | 264 | <span class="input-group-addon"><i class="fa fa-credit-card"></i></span> |
265 | </div> | 265 | </div> |
266 | </div> | 266 | </div> |
267 | </div> | 267 | </div> |
268 | </div> | 268 | </div> |
269 | <div class="row"> | 269 | <div class="row"> |
270 | <div class="col-xs-7 col-md-7"> | 270 | <div class="col-xs-7 col-md-7"> |
271 | <div class="form-group"> | 271 | <div class="form-group"> |
272 | <label for="cardExpiry"><span class="hidden-xs">EXPIRATION</span><span class="visible-xs-inline">EXP</span> DATE</label> | 272 | <label for="cardExpiry"><span class="hidden-xs">EXPIRATION</span><span class="visible-xs-inline">EXP</span> DATE</label> |
273 | <input type="text" ng-model="data.expiryDate" class="form-control" name="cardExpiry" placeholder="MM / YY" autocomplete="cc-exp" | 273 | <input type="text" ng-model="data.expiryDate" class="form-control" name="cardExpiry" placeholder="MM / YY" autocomplete="cc-exp" |
274 | required> | 274 | required> |
275 | </div> | 275 | </div> |
276 | </div> | 276 | </div> |
277 | <div class="col-xs-5 col-md-5 pull-right"> | 277 | <div class="col-xs-5 col-md-5 pull-right"> |
278 | <div class="form-group"> | 278 | <div class="form-group"> |
279 | <label for="cardCVC">CVV CODE</label> | 279 | <label for="cardCVC">CVV CODE</label> |
280 | <input type="number" maxlength="3" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" class="form-control" name="cardCVC" placeholder="CVC" autocomplete="cc-csc" | 280 | <input type="number" maxlength="3" oninput="javascript: if (this.value.length > this.maxLength) this.value = this.value.slice(0, this.maxLength);" class="form-control" name="cardCVC" placeholder="CVC" autocomplete="cc-csc" |
281 | required> | 281 | required> |
282 | </div> | 282 | </div> |
283 | </div> | 283 | </div> |
284 | </div> | 284 | </div> |
285 | <div class="row"> | 285 | <div class="row"> |
286 | <div class="col-xs-12"> | 286 | <div class="col-xs-12"> |
287 | <div class="form-group"> | 287 | <div class="form-group"> |
288 | <label for="name">Card Type</label> | 288 | <label for="name">Card Type</label> |
289 | <select class="form-control m-b" name="account" ng-model="data.cardType" style="margin-bottom: 0;"> | 289 | <select class="form-control m-b" name="account" ng-model="data.cardType" style="margin-bottom: 0;"> |
290 | <option value="creditCard" selected>Credit Card</option> | 290 | <option value="creditCard" selected>Credit Card</option> |
291 | <option value="debitCard">Debit Card</option> | 291 | <option value="debitCard">Debit Card</option> |
292 | </select> | 292 | </select> |
293 | </div> | 293 | </div> |
294 | </div> | 294 | </div> |
295 | </div> | 295 | </div> |
296 | <div class="row"> | 296 | <div class="row"> |
297 | <div class="col-xs-12"> | 297 | <div class="col-xs-12"> |
298 | <button class="btn btn-success btn-lg btn-block" type="submit" ng-click="addCard()">Add</button> | 298 | <button class="btn btn-success btn-lg btn-block" type="submit" ng-click="addCard()">Add</button> |
299 | </div> | 299 | </div> |
300 | </div> | 300 | </div> |
301 | <div class="row" style="display:none;"> | 301 | <div class="row" style="display:none;"> |
302 | <div class="col-xs-12"> | 302 | <div class="col-xs-12"> |
303 | <p class="payment-errors"></p> | 303 | <p class="payment-errors"></p> |
304 | </div> | 304 | </div> |
305 | </div> | 305 | </div> |
306 | </form> | 306 | </form> |
307 | </div> | 307 | </div> |
308 | </div> | 308 | </div> |
309 | </div> | 309 | </div> |
310 | </div> | 310 | </div> |
311 | </div> | 311 | </div> |
312 | </div> | 312 | </div> |
313 | </div> | 313 | </div> |
314 | </div> | 314 | </div> |
315 | </div> | 315 | </div> |
316 | </div> | 316 | </div> |
317 | </div> | 317 | </div> |
318 | </div> | 318 | </div> |
319 | <script type="text/javascript" src="https://js.stripe.com/v2/"></script> | 319 | <script type="text/javascript" src="https://js.stripe.com/v2/"></script> |
app/views/fbo-flight/flightDept.controller.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | //Load controller | 3 | //Load controller |
4 | angular.module('acuefuel') | 4 | angular.module('acuefuel') |
5 | 5 | ||
6 | .controller('FlightDeptController', function ($scope, $uibModal, FBOFlight) { | 6 | .controller('FlightDeptController', function ($scope, $uibModal, FBOFlight) { |
7 | $scope.data = {}; | 7 | $scope.data = {}; |
8 | $scope.user = {}; | 8 | $scope.user = {}; |
9 | $scope.aircraft = {}; | 9 | $scope.aircraft = {}; |
10 | $scope.userData = function(){ | 10 | $scope.userData = function(){ |
11 | if($scope.status == true){ | 11 | if($scope.status == true){ |
12 | $scope.user.status = 'active'; | 12 | $scope.user.status = 'active'; |
13 | }else{ | 13 | }else{ |
14 | $scope.user.status = 'inactive'; | 14 | $scope.user.status = 'inactive'; |
15 | } | 15 | } |
16 | $scope.user.username = $scope.user.email; | 16 | $scope.user.username = $scope.user.email; |
17 | $scope.user.userType = 'flightDetp'; | 17 | $scope.user.userType = 'flightDetp'; |
18 | console.log($scope.user) | 18 | console.log($scope.user) |
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; | 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; |
20 | FBOFlight.registerUser(formdata).then(function(result) { | 20 | FBOFlight.registerUser(formdata).then(function(result) { |
21 | $scope.registerId = result; | 21 | $scope.registerId = result; |
22 | $scope.data.accountId = $scope.registerId; | 22 | $scope.data.accountId = $scope.registerId; |
23 | $scope.aircraft.accountId = $scope.registerId; | 23 | $scope.aircraft.accountId = $scope.registerId; |
24 | toastr.success('Created Successfully', { | 24 | toastr.success('Created Successfully', { |
25 | closeButton: true | 25 | closeButton: true |
26 | }) | 26 | }) |
27 | }) | 27 | }, function (err) { |
28 | toastr.error('Error in registering', { | ||
29 | closeButton: true | ||
30 | }) | ||
31 | }); | ||
28 | } | 32 | } |
29 | 33 | ||
30 | $scope.data.cardType = 'creditCard'; | 34 | $scope.data.cardType = 'creditCard'; |
31 | var cardData = {} | 35 | var cardData = {} |
32 | cardData.paymentMethodList = []; | 36 | cardData.paymentMethodList = []; |
33 | $scope.addCard = function(){ | 37 | $scope.addCard = function(){ |
34 | cardData.paymentMethodList.push($scope.data); | 38 | if($scope.aircraft.accountId == undefined){ |
35 | console.log("cardData", cardData); | 39 | toastr.error('Please Add Contact Information', { |
36 | FBOFlight.addCardInformation(cardData).then(function(result) { | 40 | closeButton: true |
37 | console.log(result) | 41 | }) |
38 | toastr.success('Created Successfully', { | 42 | }else{ |
39 | closeButton: true | 43 | cardData.paymentMethodList.push($scope.data); |
40 | }) | 44 | console.log("cardData", cardData); |
41 | }) | 45 | FBOFlight.addCardInformation(cardData).then(function(result) { |
46 | console.log(result) | ||
47 | toastr.success('Created Successfully', { | ||
48 | closeButton: true | ||
49 | }) | ||
50 | }) | ||
51 | } | ||
52 | |||
42 | } | 53 | } |
43 | 54 | ||
44 | getData(); | 55 | getData(); |
45 | function getData(){ | 56 | function getData(){ |
46 | FBOFlight.getAircraftMake().then(function(result) { | 57 | FBOFlight.getAircraftMake().then(function(result) { |
47 | $scope.aircraftMakeList = result; | 58 | $scope.aircraftMakeList = result; |
48 | $scope.aircraft.make = $scope.aircraftMakeList[0]; | 59 | $scope.aircraft.make = $scope.aircraftMakeList[0]; |
49 | FBOFlight.getModal($scope.aircraft.make).then(function(result) { | 60 | FBOFlight.getModal($scope.aircraft.make).then(function(result) { |
50 | $scope.aircraftModalList = result; | 61 | $scope.aircraftModalList = result; |
51 | $scope.aircraft.model = $scope.aircraftModalList[0]; | 62 | $scope.aircraft.model = $scope.aircraftModalList[0]; |
52 | 63 | ||
53 | }) | 64 | }) |
54 | 65 | ||
55 | }) | 66 | }) |
56 | 67 | ||
57 | FBOFlight.getAircraftSize().then(function(result) { | 68 | FBOFlight.getAircraftSize().then(function(result) { |
58 | $scope.aircraftSizeList = result; | 69 | $scope.aircraftSizeList = result; |
59 | $scope.aircraft.size = $scope.aircraftSizeList[0]; | 70 | $scope.aircraft.size = $scope.aircraftSizeList[0]; |
60 | 71 | ||
61 | }) | 72 | }) |
62 | } | 73 | } |
63 | 74 | ||
64 | 75 | ||
65 | $scope.getModal = function(){ | 76 | $scope.getModal = function(){ |
66 | var modelId = $scope.aircraft.make | 77 | var modelId = $scope.aircraft.make |
67 | FBOFlight.getModal(modelId).then(function(result) { | 78 | FBOFlight.getModal(modelId).then(function(result) { |
68 | $scope.aircraftModalList = result; | 79 | $scope.aircraftModalList = result; |
69 | $scope.aircraft.model = $scope.aircraftModalList[0]; | 80 | $scope.aircraft.model = $scope.aircraftModalList[0]; |
70 | 81 | ||
71 | }) | 82 | }) |
72 | } | 83 | } |
84 | |||
85 | $scope.openModal = function(){ | ||
86 | if($scope.aircraft.accountId == undefined){ | ||
87 | toastr.error('Please Add Contact Information', { | ||
88 | closeButton: true | ||
89 | }) | ||
90 | $('#myModal4').modal('hide'); | ||
91 | }else{ | ||
92 | $('#myModal4').modal('show'); | ||
93 | } | ||
94 | |||
95 | } | ||
73 | $scope.aircraftData = {}; | 96 | $scope.aircraftData = {}; |
74 | $scope.aircraftData.aircraftList = []; | 97 | $scope.aircraftData.aircraftList = []; |
75 | $scope.getCraftList = []; | 98 | $scope.getCraftList = []; |
76 | $scope.addAircraft = function(){ | 99 | $scope.addAircraft = function(){ |
100 | console.log($scope.aircraft.accountId) | ||
77 | $scope.aircraftData.aircraftList.push($scope.aircraft); | 101 | $scope.aircraftData.aircraftList.push($scope.aircraft); |
78 | console.log($scope.aircraftData.aircraftList) | 102 | console.log($scope.aircraftData.aircraftList) |
79 | if ($scope.getCraftList.indexOf($scope.aircraft) == -1) { | 103 | if ($scope.getCraftList.indexOf($scope.aircraft) == -1) { |
80 | $scope.getCraftList.push($scope.aircraft); | 104 | $scope.getCraftList.push($scope.aircraft); |
81 | 105 | ||
82 | } | 106 | } |
83 | 107 | ||
84 | FBOFlight.addAircraft($scope.aircraftData).then(function(result) { | 108 | FBOFlight.addAircraft($scope.aircraftData).then(function(result) { |
85 | $('#myModal4').modal('hide'); | 109 | $('#myModal4').modal('hide'); |
86 | $scope.reset(); | 110 | $scope.reset(); |
87 | toastr.success('Created Successfully', { | 111 | toastr.success('Created Successfully', { |
88 | closeButton: true | 112 | closeButton: true |
89 | }) | 113 | }) |
90 | }) | 114 | }) |
115 | |||
91 | } | 116 | } |
92 | 117 | ||
93 | $scope.reset = function() { | 118 | $scope.reset = function() { |
94 | $scope.aircraft = {}; | 119 | $scope.aircraft = {}; |
95 | $scope.aircraft.accountId = $scope.data.accountId; | 120 | $scope.aircraft.accountId = $scope.data.accountId; |
96 | $scope.aircraftData.aircraftList = []; | 121 | $scope.aircraftData.aircraftList = []; |
97 | getData(); | 122 | getData(); |
98 | } | 123 | } |
99 | }); | 124 | }); |
app/views/fbo-flight/flightDeptService.js
1 | (function() { | 1 | (function() { |
2 | 'use strict'; | 2 | 'use strict'; |
3 | 3 | ||
4 | angular.module('acuefuel') | 4 | angular.module('acuefuel') |
5 | .service('FBOFlight', ['$rootScope', '$q', '$http', 'BE', FBOFlight]) | 5 | .service('FBOFlight', ['$rootScope', '$q', '$http', 'BE', FBOFlight]) |
6 | 6 | ||
7 | function FBOFlight($rootScope, $q, $http, BE) { | 7 | function FBOFlight($rootScope, $q, $http, BE) { |
8 | 8 | ||
9 | this.registerUser = function(data) { | 9 | this.registerUser = function(data) { |
10 | 10 | ||
11 | var deferred = $q.defer(); | 11 | var deferred = $q.defer(); |
12 | $http({ | 12 | $http({ |
13 | method : 'POST', | 13 | method : 'POST', |
14 | url : BE.url +'/account/user/registration', | 14 | url : BE.url +'/account/user/registration', |
15 | headers : {'Content-Type': 'application/x-www-form-urlencoded'}, | 15 | headers : {'Content-Type': 'application/x-www-form-urlencoded'}, |
16 | data : data | 16 | data : data |
17 | }) | 17 | }) |
18 | .success(function(result) { | 18 | .success(function(result) { |
19 | deferred.resolve(result); | 19 | deferred.resolve(result); |
20 | }).error(function(error){ | ||
21 | deferred.reject(error); | ||
20 | }) | 22 | }) |
21 | return deferred.promise; | 23 | return deferred.promise; |
22 | } | 24 | } |
23 | 25 | ||
24 | this.addCardInformation = function(data) { | 26 | this.addCardInformation = function(data) { |
25 | 27 | ||
26 | var deferred = $q.defer(); | 28 | var deferred = $q.defer(); |
27 | $http({ | 29 | $http({ |
28 | method : 'POST', | 30 | method : 'POST', |
29 | url : BE.url +'/account/user/addPaymentMethods', | 31 | url : BE.url +'/account/user/addPaymentMethods', |
30 | headers : {'Content-Type': 'application/json'}, | 32 | headers : {'Content-Type': 'application/json'}, |
31 | data : data | 33 | data : data |
32 | }) | 34 | }) |
33 | .success(function(result) { | 35 | .success(function(result) { |
34 | deferred.resolve(result); | 36 | deferred.resolve(result); |
35 | }) | 37 | }) |
36 | return deferred.promise; | 38 | return deferred.promise; |
37 | } | 39 | } |
38 | 40 | ||
39 | this.getAircraftMake = function(){ | 41 | this.getAircraftMake = function(){ |
40 | var deferred = $q.defer(); | 42 | var deferred = $q.defer(); |
41 | $http({ | 43 | $http({ |
42 | method : 'GET', | 44 | method : 'GET', |
43 | url : BE.url +'/fuelerlinx/acufuel/getAircraftMake', | 45 | url : BE.url +'/fuelerlinx/acufuel/getAircraftMake', |
44 | headers : {'Content-Type': 'application/json'}, | 46 | headers : {'Content-Type': 'application/json'}, |
45 | }) | 47 | }) |
46 | .success(function(result) { | 48 | .success(function(result) { |
47 | deferred.resolve(result); | 49 | deferred.resolve(result); |
48 | }) | 50 | }) |
49 | return deferred.promise; | 51 | return deferred.promise; |
50 | } | 52 | } |
51 | 53 | ||
52 | this.getAircraftSize = function(){ | 54 | this.getAircraftSize = function(){ |
53 | var deferred = $q.defer(); | 55 | var deferred = $q.defer(); |
54 | $http({ | 56 | $http({ |
55 | method : 'GET', | 57 | method : 'GET', |
56 | url : BE.url +'/fuelerlinx/acufuel/getAircraftSize', | 58 | url : BE.url +'/fuelerlinx/acufuel/getAircraftSize', |
57 | headers : {'Content-Type': 'application/json'}, | 59 | headers : {'Content-Type': 'application/json'}, |
58 | }) | 60 | }) |
59 | .success(function(result) { | 61 | .success(function(result) { |
60 | deferred.resolve(result); | 62 | deferred.resolve(result); |
61 | }) | 63 | }) |
62 | return deferred.promise; | 64 | return deferred.promise; |
63 | } | 65 | } |
64 | 66 | ||
65 | this.getModal = function(id){ | 67 | this.getModal = function(id){ |
66 | var deferred = $q.defer(); | 68 | var deferred = $q.defer(); |
67 | $http({ | 69 | $http({ |
68 | method : 'GET', | 70 | method : 'GET', |
69 | url : BE.url +'/fuelerlinx/acufuel/getAircraftModel/' + id, | 71 | url : BE.url +'/fuelerlinx/acufuel/getAircraftModel/' + id, |
70 | headers : {'Content-Type': 'application/json'}, | 72 | headers : {'Content-Type': 'application/json'}, |
71 | }) | 73 | }) |
72 | .success(function(result) { | 74 | .success(function(result) { |
73 | deferred.resolve(result); | 75 | deferred.resolve(result); |
74 | }) | 76 | }) |
75 | return deferred.promise; | 77 | return deferred.promise; |
76 | } | 78 | } |
77 | 79 | ||
78 | this.addAircraft = function(data){ | 80 | this.addAircraft = function(data){ |
79 | var deferred = $q.defer(); | 81 | var deferred = $q.defer(); |
80 | $http({ | 82 | $http({ |
81 | method : 'POST', | 83 | method : 'POST', |
82 | url : BE.url +'/account/user/addAircraft', | 84 | url : BE.url +'/account/user/addAircraft', |
83 | headers : {'Content-Type': 'application/json'}, | 85 | headers : {'Content-Type': 'application/json'}, |
84 | data: data | 86 | data: data |
85 | }) | 87 | }) |
86 | .success(function(result) { | 88 | .success(function(result) { |
87 | deferred.resolve(result); | 89 | deferred.resolve(result); |
88 | }) | 90 | }) |
89 | return deferred.promise; | 91 | return deferred.promise; |
90 | } | 92 | } |
91 | } | 93 | } |
92 | 94 | ||
93 | })(); | 95 | })(); |
app/views/update-airports/updateAirportController.js
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | angular.module('acuefuel') | 3 | angular.module('acuefuel') |
4 | 4 | ||
5 | .controller('updateAirportController', function ($scope, UpdateAirportService) { | 5 | .controller('updateAirportController', function ($scope, UpdateAirportService) { |
6 | $scope.dropName = true; | 6 | $scope.dropName = true; |
7 | $scope.supplierName = true; | 7 | $scope.supplierName = true; |
8 | $scope.countryName = true; | 8 | $scope.countryName = true; |
9 | $scope.subDivisionName = true; | 9 | $scope.subDivisionName = true; |
10 | $scope.fboHandlerName = true; | 10 | $scope.fboHandlerName = true; |
11 | console.log(localStorage.getItem('airportLoader')) | 11 | console.log(localStorage.getItem('airportLoader')) |
12 | if(localStorage.getItem('airportLoader') == 'false'){ | 12 | if(localStorage.getItem('airportLoader') == 'false'){ |
13 | $scope.showAirports = false; | 13 | $scope.showAirports = false; |
14 | }else{ | 14 | }else{ |
15 | $scope.showAirports = true; | 15 | $scope.showAirports = true; |
16 | } | 16 | } |
17 | if(localStorage.getItem('countryLoader') == 'false'){ | 17 | if(localStorage.getItem('countryLoader') == 'false'){ |
18 | $scope.showCountries = false; | 18 | $scope.showCountries = false; |
19 | }else{ | 19 | }else{ |
20 | $scope.showCountries = true; | 20 | $scope.showCountries = true; |
21 | } | 21 | } |
22 | if(localStorage.getItem('fboHandleLoader') == 'false'){ | 22 | if(localStorage.getItem('fboHandleLoader') == 'false'){ |
23 | $scope.fboHandlerDetail = false; | 23 | $scope.fboHandlerDetail = false; |
24 | }else{ | 24 | }else{ |
25 | $scope.fboHandlerDetail = true; | 25 | $scope.fboHandlerDetail = true; |
26 | } | 26 | } |
27 | if(localStorage.getItem('subDivStateLoader') == 'false'){ | 27 | if(localStorage.getItem('subDivStateLoader') == 'false'){ |
28 | $scope.subDivState = false; | 28 | $scope.subDivState = false; |
29 | }else{ | 29 | }else{ |
30 | $scope.subDivState = true; | 30 | $scope.subDivState = true; |
31 | } | 31 | } |
32 | if(localStorage.getItem('suppDetailLoader') == 'false'){ | 32 | if(localStorage.getItem('suppDetailLoader') == 'false'){ |
33 | $scope.suppDetail = false; | 33 | $scope.suppDetail = false; |
34 | }else{ | 34 | }else{ |
35 | $scope.suppDetail = true; | 35 | $scope.suppDetail = true; |
36 | } | 36 | } |
37 | 37 | ||
38 | // Showing Date | 38 | // Showing Date |
39 | var today = new Date(); | 39 | var today = new Date(); |
40 | var dd = today.getDate(); | 40 | var dd = today.getDate(); |
41 | var mm = today.getMonth()+1; | 41 | var mm = today.getMonth()+1; |
42 | var yyyy = today.getFullYear(); | 42 | var yyyy = today.getFullYear(); |
43 | if(dd < 10){ | 43 | if(dd < 10){ |
44 | dd='0'+dd; | 44 | dd='0'+dd; |
45 | } | 45 | } |
46 | if(mm < 10){ | 46 | if(mm < 10){ |
47 | mm='0'+mm; | 47 | mm='0'+mm; |
48 | } | 48 | } |
49 | $scope.newDate = dd + '/' + mm + '/' + yyyy; | 49 | $scope.newDate = dd + '/' + mm + '/' + yyyy; |
50 | 50 | ||
51 | //Import Airport Data | 51 | //Import Airport Data |
52 | $scope.data = {}; | 52 | $scope.data = {}; |
53 | $scope.importAirportData = function(fileName) { | 53 | $scope.importAirportData = function(fileName) { |
54 | $scope.showAirports = false; | 54 | $scope.showAirports = false; |
55 | window.localStorage.setItem('airportLoader', false); | 55 | window.localStorage.setItem('airportLoader', false); |
56 | console.log(fileName) | 56 | console.log(fileName) |
57 | if(fileName.name != undefined){ | 57 | if(fileName.name != undefined){ |
58 | $scope.dropName = false; | 58 | $scope.dropName = false; |
59 | $scope.selectedFile = fileName; | 59 | $scope.selectedFile = fileName; |
60 | $scope.data.airportFile = $scope.selectedFile; | 60 | $scope.data.airportFile = $scope.selectedFile; |
61 | }else if(fileName instanceof Array){ | 61 | }else if(fileName instanceof Array){ |
62 | $scope.dropName = false; | 62 | $scope.dropName = false; |
63 | $scope.selectedFile = fileName[0]; | 63 | $scope.selectedFile = fileName[0]; |
64 | $scope.data.airportFile = $scope.selectedFile; | 64 | $scope.data.airportFile = $scope.selectedFile; |
65 | } | 65 | } |
66 | var fileCheck = $scope.data.airportFile.name.split('.')[1]; | 66 | var fileCheck = $scope.data.airportFile.name.split('.')[1]; |
67 | console.log(fileCheck) | 67 | console.log(fileCheck) |
68 | if(fileCheck == 'csv'){ | 68 | if(fileCheck == 'csv'){ |
69 | UpdateAirportService.updateAirportData($scope.data).then(function(result) { | 69 | UpdateAirportService.updateAirportData($scope.data).then(function(result) { |
70 | localStorage.removeItem('airportLoader'); | 70 | localStorage.removeItem('airportLoader'); |
71 | $scope.showAirports = true; | 71 | $scope.showAirports = true; |
72 | console.log(result) | 72 | console.log(result) |
73 | toastr.success('Copied', { | 73 | toastr.success('Copied', { |
74 | closeButton: true | 74 | closeButton: true |
75 | }) | 75 | }) |
76 | }) | 76 | }, function (err) { |
77 | localStorage.removeItem('airportLoader'); | ||
78 | $scope.showAirports = true; | ||
79 | toastr.error('Error in uploading', { | ||
80 | closeButton: true | ||
81 | }) | ||
82 | }); | ||
77 | }else { | 83 | }else { |
78 | localStorage.removeItem('airportLoader'); | 84 | localStorage.removeItem('airportLoader'); |
79 | $scope.showAirports = true; | 85 | $scope.showAirports = true; |
80 | $scope.dropName = true; | 86 | $scope.dropName = true; |
81 | toastr.error('Please select only csv file', { | 87 | toastr.error('Please select only csv file', { |
82 | closeButton: true | 88 | closeButton: true |
83 | }) | 89 | }) |
84 | } | 90 | } |
85 | 91 | ||
86 | } | 92 | } |
87 | 93 | ||
88 | //Import Supplier Detail Data | 94 | //Import Supplier Detail Data |
89 | $scope.supplierData = {}; | 95 | $scope.supplierData = {}; |
90 | $scope.importSuppluerDetail = function(fileName){ | 96 | $scope.importSuppluerDetail = function(fileName){ |
91 | $scope.suppDetail = false; | 97 | $scope.suppDetail = false; |
92 | window.localStorage.setItem('suppDetailLoader', false); | 98 | window.localStorage.setItem('suppDetailLoader', false); |
93 | console.log(fileName) | 99 | console.log(fileName) |
94 | if(fileName.name != undefined){ | 100 | if(fileName.name != undefined){ |
95 | $scope.supplierName = false; | 101 | $scope.supplierName = false; |
96 | $scope.selectedSuplier = fileName; | 102 | $scope.selectedSuplier = fileName; |
97 | $scope.supplierData.supplierDetailFile = $scope.selectedSuplier; | 103 | $scope.supplierData.supplierDetailFile = $scope.selectedSuplier; |
98 | }else if(fileName instanceof Array){ | 104 | }else if(fileName instanceof Array){ |
99 | $scope.supplierName = false; | 105 | $scope.supplierName = false; |
100 | $scope.selectedSuplier = fileName[0]; | 106 | $scope.selectedSuplier = fileName[0]; |
101 | $scope.supplierData.supplierDetailFile = $scope.selectedSuplier; | 107 | $scope.supplierData.supplierDetailFile = $scope.selectedSuplier; |
102 | } | 108 | } |
103 | var fileCheck = $scope.supplierData.supplierDetailFile.name.split('.')[1]; | 109 | var fileCheck = $scope.supplierData.supplierDetailFile.name.split('.')[1]; |
104 | console.log(fileCheck) | 110 | console.log(fileCheck) |
105 | if(fileCheck == 'csv'){ | 111 | if(fileCheck == 'csv'){ |
106 | UpdateAirportService.updateSupplierDetail($scope.supplierData).then(function(result) { | 112 | UpdateAirportService.updateSupplierDetail($scope.supplierData).then(function(result) { |
107 | console.log(result) | 113 | console.log(result) |
108 | $scope.suppDetail = true; | 114 | $scope.suppDetail = true; |
109 | localStorage.removeItem('suppDetailLoader'); | 115 | localStorage.removeItem('suppDetailLoader'); |
110 | toastr.success('File Upload Successfully', { | 116 | toastr.success('File Upload Successfully', { |
111 | closeButton: true | 117 | closeButton: true |
112 | }) | 118 | }) |
113 | }) | 119 | }, function (err) { |
120 | localStorage.removeItem('suppDetailLoader'); | ||
121 | $scope.suppDetail = true; | ||
122 | toastr.error('Error in uploading', { | ||
123 | closeButton: true | ||
124 | }) | ||
125 | }); | ||
114 | }else { | 126 | }else { |
115 | localStorage.removeItem('suppDetailLoader'); | 127 | localStorage.removeItem('suppDetailLoader'); |
116 | $scope.suppDetail = true; | 128 | $scope.suppDetail = true; |
117 | $scope.supplierName = true; | 129 | $scope.supplierName = true; |
118 | toastr.error('Please select only csv file', { | 130 | toastr.error('Please select only csv file', { |
119 | closeButton: true | 131 | closeButton: true |
120 | }) | 132 | }) |
121 | } | 133 | } |
122 | } | 134 | } |
123 | 135 | ||
124 | //Import Countries Data | 136 | //Import Countries Data |
125 | $scope.countryData = {}; | 137 | $scope.countryData = {}; |
126 | $scope.importCountryData = function(fileName){ | 138 | $scope.importCountryData = function(fileName){ |
127 | $scope.showCountries = false; | 139 | $scope.showCountries = false; |
128 | window.localStorage.setItem('countryLoader', false); | 140 | window.localStorage.setItem('countryLoader', false); |
129 | console.log(fileName) | 141 | console.log(fileName) |
130 | if(fileName.name != undefined){ | 142 | if(fileName.name != undefined){ |
131 | $scope.countryName = false; | 143 | $scope.countryName = false; |
132 | $scope.selectedCountry = fileName; | 144 | $scope.selectedCountry = fileName; |
133 | $scope.countryData.countrieFile = $scope.selectedCountry; | 145 | $scope.countryData.countrieFile = $scope.selectedCountry; |
134 | }else if(fileName instanceof Array){ | 146 | }else if(fileName instanceof Array){ |
135 | $scope.countryName = false; | 147 | $scope.countryName = false; |
136 | $scope.selectedCountry = fileName[0]; | 148 | $scope.selectedCountry = fileName[0]; |
137 | $scope.countryData.countrieFile = $scope.selectedCountry; | 149 | $scope.countryData.countrieFile = $scope.selectedCountry; |
138 | } | 150 | } |
139 | var fileCheck = $scope.countryData.countrieFile.name.split('.')[1]; | 151 | var fileCheck = $scope.countryData.countrieFile.name.split('.')[1]; |
140 | console.log(fileCheck) | 152 | console.log(fileCheck) |
141 | if(fileCheck == 'csv'){ | 153 | if(fileCheck == 'csv'){ |
142 | UpdateAirportService.updateCountries($scope.countryData).then(function(result) { | 154 | UpdateAirportService.updateCountries($scope.countryData).then(function(result) { |
143 | console.log(result) | 155 | console.log(result) |
144 | $scope.showCountries = true; | 156 | $scope.showCountries = true; |
145 | localStorage.removeItem('countryLoader'); | 157 | localStorage.removeItem('countryLoader'); |
146 | toastr.success('File Upload Successfully', { | 158 | toastr.success('File Upload Successfully', { |
147 | closeButton: true | 159 | closeButton: true |
148 | }) | 160 | }) |
149 | }) | 161 | }, function (err) { |
162 | localStorage.removeItem('countryLoader'); | ||
163 | $scope.showCountries = true; | ||
164 | toastr.error('Error in uploading', { | ||
165 | closeButton: true | ||
166 | }) | ||
167 | }); | ||
150 | }else { | 168 | }else { |
151 | localStorage.removeItem('countryLoader'); | 169 | localStorage.removeItem('countryLoader'); |
152 | $scope.showCountries = true; | 170 | $scope.showCountries = true; |
153 | $scope.countryName = true; | 171 | $scope.countryName = true; |
154 | toastr.error('Please select only csv file', { | 172 | toastr.error('Please select only csv file', { |
155 | closeButton: true | 173 | closeButton: true |
156 | }) | 174 | }) |
157 | } | 175 | } |
158 | } | 176 | } |
159 | 177 | ||
160 | //Import Sub Divison State Data | 178 | //Import Sub Divison State Data |
161 | $scope.subDivisionData = {}; | 179 | $scope.subDivisionData = {}; |
162 | $scope.importsubDivisionData = function(fileName){ | 180 | $scope.importsubDivisionData = function(fileName){ |
163 | $scope.subDivState = false; | 181 | $scope.subDivState = false; |
164 | window.localStorage.setItem('subDivStateLoader', false); | 182 | window.localStorage.setItem('subDivStateLoader', false); |
165 | console.log(fileName) | 183 | console.log(fileName) |
166 | if(fileName.name != undefined){ | 184 | if(fileName.name != undefined){ |
167 | $scope.subDivisionName = false; | 185 | $scope.subDivisionName = false; |
168 | $scope.selectedState = fileName; | 186 | $scope.selectedState = fileName; |
169 | $scope.subDivisionData.subDivisionStateFile = $scope.selectedState; | 187 | $scope.subDivisionData.subDivisionStateFile = $scope.selectedState; |
170 | }else if(fileName instanceof Array){ | 188 | }else if(fileName instanceof Array){ |
171 | $scope.subDivisionName = false; | 189 | $scope.subDivisionName = false; |
172 | $scope.selectedState = fileName[0]; | 190 | $scope.selectedState = fileName[0]; |
173 | $scope.subDivisionData.subDivisionStateFile = $scope.selectedState; | 191 | $scope.subDivisionData.subDivisionStateFile = $scope.selectedState; |
174 | } | 192 | } |
175 | var fileCheck = $scope.subDivisionData.subDivisionStateFile.name.split('.')[1]; | 193 | var fileCheck = $scope.subDivisionData.subDivisionStateFile.name.split('.')[1]; |
176 | console.log(fileCheck) | 194 | console.log(fileCheck) |
177 | if(fileCheck == 'csv'){ | 195 | if(fileCheck == 'csv'){ |
178 | UpdateAirportService.updateSubDivisionState($scope.subDivisionData).then(function(result) { | 196 | UpdateAirportService.updateSubDivisionState($scope.subDivisionData).then(function(result) { |
179 | console.log(result) | 197 | console.log(result) |
180 | localStorage.removeItem('subDivStateLoader'); | 198 | localStorage.removeItem('subDivStateLoader'); |
181 | $scope.subDivState = true; | 199 | $scope.subDivState = true; |
182 | toastr.success('File Upload Successfully', { | 200 | toastr.success('File Upload Successfully', { |
183 | closeButton: true | 201 | closeButton: true |
184 | }) | 202 | }) |
185 | }) | 203 | }, function (err) { |
204 | localStorage.removeItem('subDivStateLoader'); | ||
205 | $scope.subDivState = true; | ||
206 | toastr.error('Error in uploading', { | ||
207 | closeButton: true | ||
208 | }) | ||
209 | }); | ||
186 | }else { | 210 | }else { |
187 | localStorage.removeItem('subDivStateLoader'); | 211 | localStorage.removeItem('subDivStateLoader'); |
188 | $scope.subDivState = true; | 212 | $scope.subDivState = true; |
189 | $scope.subDivisionName = true; | 213 | $scope.subDivisionName = true; |
190 | toastr.error('Please select only csv file', { | 214 | toastr.error('Please select only csv file', { |
191 | closeButton: true | 215 | closeButton: true |
192 | }) | 216 | }) |
193 | } | 217 | } |
194 | } | 218 | } |
195 | 219 | ||
196 | //Import FBO Handler Data | 220 | //Import FBO Handler Data |
197 | $scope.fboHandlerData = {}; | 221 | $scope.fboHandlerData = {}; |
198 | $scope.importFboHandler = function(fileName){ | 222 | $scope.importFboHandler = function(fileName){ |
199 | $scope.fboHandlerDetail = false; | 223 | $scope.fboHandlerDetail = false; |
200 | window.localStorage.setItem('fboHandleLoader', false); | 224 | window.localStorage.setItem('fboHandleLoader', false); |
201 | console.log(fileName) | 225 | console.log(fileName) |
202 | if(fileName.name != undefined){ | 226 | if(fileName.name != undefined){ |
203 | $scope.fboHandlerName = false; | 227 | $scope.fboHandlerName = false; |
204 | $scope.selectedFBO = fileName; | 228 | $scope.selectedFBO = fileName; |
205 | $scope.fboHandlerData.FBOHandlerFile = $scope.selectedFBO; | 229 | $scope.fboHandlerData.FBOHandlerFile = $scope.selectedFBO; |
206 | }else if(fileName instanceof Array){ | 230 | }else if(fileName instanceof Array){ |
207 | $scope.fboHandlerName = false; | 231 | $scope.fboHandlerName = false; |
208 | $scope.selectedFBO = fileName[0]; | 232 | $scope.selectedFBO = fileName[0]; |
209 | $scope.fboHandlerData.FBOHandlerFile = $scope.selectedFBO; | 233 | $scope.fboHandlerData.FBOHandlerFile = $scope.selectedFBO; |
210 | } | 234 | } |
211 | var fileCheck = $scope.fboHandlerData.FBOHandlerFile.name.split('.')[1]; | 235 | var fileCheck = $scope.fboHandlerData.FBOHandlerFile.name.split('.')[1]; |
212 | console.log(fileCheck) | 236 | console.log(fileCheck) |
213 | if(fileCheck == 'csv'){ | 237 | if(fileCheck == 'csv'){ |
214 | UpdateAirportService.updateFBOHandler($scope.fboHandlerData).then(function(result) { | 238 | UpdateAirportService.updateFBOHandler($scope.fboHandlerData).then(function(result) { |
215 | console.log(result) | 239 | console.log(result) |
216 | localStorage.removeItem('fboHandleLoader'); | 240 | localStorage.removeItem('fboHandleLoader'); |
217 | $scope.fboHandlerDetail = true; | 241 | $scope.fboHandlerDetail = true; |
218 | toastr.success('File Upload Successfully', { | 242 | toastr.success('File Upload Successfully', { |
219 | closeButton: true | 243 | closeButton: true |
220 | }) | 244 | }) |
221 | }) | 245 | }, function (err) { |
246 | localStorage.removeItem('fboHandleLoader'); | ||
247 | $scope.fboHandlerDetail = true; | ||
248 | toastr.error('Error in uploading', { | ||
249 | closeButton: true | ||
250 | }) | ||
251 | }); | ||
222 | }else { | 252 | }else { |
223 | localStorage.removeItem('fboHandleLoader'); | 253 | localStorage.removeItem('fboHandleLoader'); |
224 | $scope.fboHandlerDetail = true; | 254 | $scope.fboHandlerDetail = true; |
225 | $scope.fboHandlerName = true; | 255 | $scope.fboHandlerName = true; |
226 | toastr.error('Please select only csv file', { | 256 | toastr.error('Please select only csv file', { |
227 | closeButton: true | 257 | closeButton: true |
228 | }) | 258 | }) |
229 | } | 259 | } |
230 | } | 260 | } |
231 | 261 | ||
232 | }) | 262 | }) |
app/views/update-airports/updateAirportService.js
1 | (function() { | 1 | (function() { |
2 | 'use strict'; | 2 | 'use strict'; |
3 | 3 | ||
4 | angular.module('acuefuel') | 4 | angular.module('acuefuel') |
5 | .service('UpdateAirportService', ['$rootScope', '$q', '$http', 'BE', UpdateAirportService]) | 5 | .service('UpdateAirportService', ['$rootScope', '$q', '$http', 'BE', UpdateAirportService]) |
6 | 6 | ||
7 | function UpdateAirportService($rootScope, $q, $http, BE) { | 7 | function UpdateAirportService($rootScope, $q, $http, BE) { |
8 | 8 | ||
9 | this.updateAirportData = function(data) { | 9 | this.updateAirportData = function(data) { |
10 | 10 | ||
11 | var fd = new FormData(); | 11 | var fd = new FormData(); |
12 | 12 | ||
13 | angular.forEach(data, function(value, key) { | 13 | angular.forEach(data, function(value, key) { |
14 | fd.append(key, value); | 14 | fd.append(key, value); |
15 | }) | 15 | }) |
16 | 16 | ||
17 | var deferred = $q.defer(); | 17 | var deferred = $q.defer(); |
18 | $http({ | 18 | $http({ |
19 | method : 'POST', | 19 | method : 'POST', |
20 | transformRequest: angular.identity, | 20 | transformRequest: angular.identity, |
21 | url : BE.url +'/airport/upload/airports', | 21 | url : BE.url +'/airport/upload/airports', |
22 | headers : {'Content-Type': undefined}, | 22 | headers : {'Content-Type': undefined}, |
23 | data : fd | 23 | data : fd |
24 | }) | 24 | }) |
25 | .success(function(result) { | 25 | .success(function(result) { |
26 | deferred.resolve(result); | 26 | deferred.resolve(result); |
27 | }).error(function(error){ | ||
28 | deferred.reject(error); | ||
27 | }) | 29 | }) |
28 | return deferred.promise; | 30 | return deferred.promise; |
29 | } | 31 | } |
30 | 32 | ||
31 | this.updateSupplierDetail = function(data) { | 33 | this.updateSupplierDetail = function(data) { |
32 | 34 | ||
33 | var fd = new FormData(); | 35 | var fd = new FormData(); |
34 | 36 | ||
35 | angular.forEach(data, function(value, key) { | 37 | angular.forEach(data, function(value, key) { |
36 | fd.append(key, value); | 38 | fd.append(key, value); |
37 | }) | 39 | }) |
38 | 40 | ||
39 | var deferred = $q.defer(); | 41 | var deferred = $q.defer(); |
40 | $http({ | 42 | $http({ |
41 | method : 'POST', | 43 | method : 'POST', |
42 | transformRequest: angular.identity, | 44 | transformRequest: angular.identity, |
43 | url : BE.url +'/airport/upload/supplierDetail', | 45 | url : BE.url +'/airport/upload/supplierDetail', |
44 | headers : {'Content-Type': undefined}, | 46 | headers : {'Content-Type': undefined}, |
45 | data : fd | 47 | data : fd |
46 | }) | 48 | }) |
47 | .success(function(result) { | 49 | .success(function(result) { |
48 | deferred.resolve(result); | 50 | deferred.resolve(result); |
51 | }).error(function(error){ | ||
52 | deferred.reject(error); | ||
49 | }) | 53 | }) |
50 | return deferred.promise; | 54 | return deferred.promise; |
51 | } | 55 | } |
52 | 56 | ||
53 | this.updateCountries = function(data) { | 57 | this.updateCountries = function(data) { |
54 | 58 | ||
55 | var fd = new FormData(); | 59 | var fd = new FormData(); |
56 | 60 | ||
57 | angular.forEach(data, function(value, key) { | 61 | angular.forEach(data, function(value, key) { |
58 | fd.append(key, value); | 62 | fd.append(key, value); |
59 | }) | 63 | }) |
60 | 64 | ||
61 | var deferred = $q.defer(); | 65 | var deferred = $q.defer(); |
62 | $http({ | 66 | $http({ |
63 | method : 'POST', | 67 | method : 'POST', |
64 | transformRequest: angular.identity, | 68 | transformRequest: angular.identity, |
65 | url : BE.url +'/airport/upload/updateCountries', | 69 | url : BE.url +'/airport/upload/updateCountries', |
66 | headers : {'Content-Type': undefined}, | 70 | headers : {'Content-Type': undefined}, |
67 | data : fd | 71 | data : fd |
68 | }) | 72 | }) |
69 | .success(function(result) { | 73 | .success(function(result) { |
70 | deferred.resolve(result); | 74 | deferred.resolve(result); |
75 | }).error(function(error){ | ||
76 | deferred.reject(error); | ||
71 | }) | 77 | }) |
72 | return deferred.promise; | 78 | return deferred.promise; |
73 | } | 79 | } |
74 | 80 | ||
75 | this.updateSubDivisionState = function(data) { | 81 | this.updateSubDivisionState = function(data) { |
76 | 82 | ||
77 | var fd = new FormData(); | 83 | var fd = new FormData(); |
78 | 84 | ||
79 | angular.forEach(data, function(value, key) { | 85 | angular.forEach(data, function(value, key) { |
80 | fd.append(key, value); | 86 | fd.append(key, value); |
81 | }) | 87 | }) |
82 | 88 | ||
83 | var deferred = $q.defer(); | 89 | var deferred = $q.defer(); |
84 | $http({ | 90 | $http({ |
85 | method : 'POST', | 91 | method : 'POST', |
86 | transformRequest: angular.identity, | 92 | transformRequest: angular.identity, |
87 | url : BE.url +'/airport/upload/subDivisionState', | 93 | url : BE.url +'/airport/upload/subDivisionState', |
88 | headers : {'Content-Type': undefined}, | 94 | headers : {'Content-Type': undefined}, |
89 | data : fd | 95 | data : fd |
90 | }) | 96 | }) |
91 | .success(function(result) { | 97 | .success(function(result) { |
92 | deferred.resolve(result); | 98 | deferred.resolve(result); |
99 | }).error(function(error){ | ||
100 | deferred.reject(error); | ||
93 | }) | 101 | }) |
94 | return deferred.promise; | 102 | return deferred.promise; |
95 | } | 103 | } |
96 | 104 | ||
97 | this.updateFBOHandler = function(data) { | 105 | this.updateFBOHandler = function(data) { |
98 | 106 | ||
99 | var fd = new FormData(); | 107 | var fd = new FormData(); |
100 | 108 | ||
101 | angular.forEach(data, function(value, key) { | 109 | angular.forEach(data, function(value, key) { |
102 | fd.append(key, value); | 110 | fd.append(key, value); |
103 | }) | 111 | }) |
104 | 112 | ||
105 | var deferred = $q.defer(); | 113 | var deferred = $q.defer(); |
106 | $http({ | 114 | $http({ |
107 | method : 'POST', | 115 | method : 'POST', |
108 | transformRequest: angular.identity, | 116 | transformRequest: angular.identity, |
109 | url : BE.url +'/airport/upload/FBOHandler', | 117 | url : BE.url +'/airport/upload/FBOHandler', |
110 | headers : {'Content-Type': undefined}, | 118 | headers : {'Content-Type': undefined}, |
111 | data : fd | 119 | data : fd |
112 | }) | 120 | }) |
113 | .success(function(result) { | 121 | .success(function(result) { |
114 | deferred.resolve(result); | 122 | deferred.resolve(result); |
123 | }).error(function(error){ | ||
124 | deferred.reject(error); | ||
115 | }) | 125 | }) |
116 | return deferred.promise; | 126 | return deferred.promise; |
117 | } | 127 | } |
118 | } | 128 | } |
119 | 129 | ||
120 | })(); | 130 | })(); |