Blame view
app/views/fbo-admin/dashboard.controller.js
7.29 KB
e4e496d13
|
1 2 3 |
'use strict'; //Load controller |
9835dbe3e
|
4 |
angular.module('acuefuel') |
e4e496d13
|
5 |
|
db8e1f992
|
6 |
.controller('DashboardController', function($scope, $state, FBOAdmin) { |
0a4eb77cc
|
7 8 9 10 11 |
$(document).ready(function(){ $('.i-checks').iCheck({ checkboxClass: 'icheckbox_square-green', radioClass: 'iradio_square-green', }); |
2d8381335
|
12 |
$('.fboadmin').addClass('active'); |
0a4eb77cc
|
13 |
}); |
0a4eb77cc
|
14 15 |
$scope.userName = 'Dylan Goodwin'; $scope.essAccountId = true; |
7379f005b
|
16 |
$("#esAccId").css({ opacity: 0.5 }); |
0a4eb77cc
|
17 |
$scope.user = {}; |
bdc73f777
![]() |
18 19 20 |
$scope.user.companyName = ''; $scope.user.email = ''; $scope.user.password = ''; |
5139fa05b
|
21 |
$scope.user.icao = ''; |
0a4eb77cc
|
22 23 24 25 26 27 28 29 30 |
$scope.feature = {}; $scope.feature.level = 'silver'; $scope.feature.essintaPosSystem = false; $scope.feature.acuQuote = false; $scope.feature.acuTrack = false; $scope.feature.fuelProgram = false; $scope.feature.amstatIntegration = false; $scope.feature.posAccountingIntegration = false; $scope.feature.posVeederRootIntegration = false; |
089f3a3c2
|
31 32 33 34 35 36 37 38 39 40 41 |
$scope.checkUsername = function(){ FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) { console.log(status) if(status != 200){ toastr.error('This email has alreay taken', { closeButton: true }) } }) } |
bdc73f777
![]() |
42 43 44 |
$scope.comnayNameInvalid = false; $scope.emailInvalid = false; $scope.passwordInvalid = false; |
5139fa05b
|
45 |
$scope.icaoInvalid = false; |
bdc73f777
![]() |
46 47 48 49 50 51 52 53 54 55 56 57 58 |
$scope.companyNameValid = function(){ $scope.comnayNameInvalid = false; $('.companyNameError').removeClass('customErrorInput'); } $scope.emailValid = function(){ $scope.emailInvalid = false; $('.emailIdError').removeClass('customErrorInput'); } $scope.passwordValid = function(){ $scope.passwordInvalid = false; $('.invalidPassword').removeClass('customErrorInput'); } |
5139fa05b
|
59 60 61 62 |
$scope.icaoValid = function(){ $scope.icaoInvalid = false; $('.icaoNameError').removeClass('customErrorInput'); } |
089f3a3c2
|
63 |
|
0a4eb77cc
|
64 |
$scope.userData = function(){ |
bdc73f777
![]() |
65 66 67 68 |
console.log('$scope.user', $scope.user); if ($scope.user.companyName == '') { $scope.comnayNameInvalid = true; $('.companyNameError').addClass('customErrorInput'); |
5139fa05b
|
69 70 71 |
}else if ($scope.user.icao == '') { $scope.icaoInvalid = true; $('.icaoNameError').addClass('customErrorInput'); |
bdc73f777
![]() |
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
}else if ($scope.user.email == '') { $scope.emailInvalid = true; $('.emailIdError').addClass('customErrorInput'); }else if ($scope.user.password == '') { $scope.passwordInvalid = true; $('.invalidPassword').addClass('customErrorInput'); }else{ if($scope.status == true){ $scope.user.status = 'active'; }else{ $scope.user.status = 'inactive'; } $scope.user.username = $scope.user.email; $scope.user.userType = 'fbo'; console.log($scope.user) |
5139fa05b
|
87 |
var formdata = "companyName=" + $scope.user.companyName + "&icao=" + $scope.user.icao + "&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; |
bdc73f777
![]() |
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
FBOAdmin.registerUser(formdata).then(function(result) { toastr.success('Created Successfully', { closeButton: true }) $scope.feature.accountId = result; 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 + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences; FBOAdmin.featureControl(featureControlData).then(function(response) { console.log(response) }) $state.go('index.fboAdmin'); }, function (err) { toastr.error('Error in registeration', { closeButton: true }) }); } /*if($scope.user.email == ''){ |
db8e1f992
|
110 111 112 113 114 115 116 117 |
toastr.error('Please enter your email first', { closeButton: true }) }else if($scope.user.firstName == undefined || $scope.user.firstName == null){ toastr.error('Please enter your First Name', { closeButton: true }) }else{ |
0a4eb77cc
|
118 119 120 121 122 123 124 125 |
if($scope.status == true){ $scope.user.status = 'active'; }else{ $scope.user.status = 'inactive'; } $scope.user.username = $scope.user.email; $scope.user.userType = 'fbo'; console.log($scope.user) |
d5fb510e5
|
126 |
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; |
0a4eb77cc
|
127 |
FBOAdmin.registerUser(formdata).then(function(result) { |
1956e3844
|
128 129 130 |
toastr.success('Created Successfully', { closeButton: true }) |
7379f005b
|
131 132 133 134 135 136 137 138 |
$scope.feature.accountId = result; 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 + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences; FBOAdmin.featureControl(featureControlData).then(function(response) { console.log(response) |
0a4eb77cc
|
139 |
|
7379f005b
|
140 |
}) |
db8e1f992
|
141 |
$state.go('index.fboAdmin'); |
1956e3844
|
142 |
}, function (err) { |
16fa2ad10
|
143 |
toastr.error('Error in registeration', { |
1956e3844
|
144 145 146 |
closeButton: true }) }); |
bdc73f777
![]() |
147 |
}*/ |
db8e1f992
|
148 |
|
0a4eb77cc
|
149 150 151 152 153 |
} $scope.enableEssId = function(){ if($scope.feature.essintaPosSystem == true){ $scope.essAccountId = false; |
7379f005b
|
154 |
$("#esAccId").css({ opacity: 1 }); |
0a4eb77cc
|
155 156 157 |
}else{ $scope.essAccountId = true; delete $scope.feature.essintaAccountUid; |
7379f005b
|
158 |
$("#esAccId").css({ opacity: 0.5 }); |
0a4eb77cc
|
159 160 161 162 |
} } }); |