Commit 089f3a3c290d0fb2434193b8d25a006f73fdfc84

Authored by Rishav
1 parent 16fa2ad104
Exists in master

check username available

app/views/fbo-admin/dashboard.controller.js
... ... @@ -24,6 +24,18 @@
24 24 $scope.feature.amstatIntegration = false;
25 25 $scope.feature.posAccountingIntegration = false;
26 26 $scope.feature.posVeederRootIntegration = false;
  27 +
  28 + $scope.checkUsername = function(){
  29 + FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) {
  30 + console.log(status)
  31 + if(status != 200){
  32 + toastr.error('This email has alreay taken', {
  33 + closeButton: true
  34 + })
  35 + }
  36 + })
  37 + }
  38 +
27 39 $scope.userData = function(){
28 40 if($scope.user.email == undefined || $scope.user.email == null){
29 41 toastr.error('Please enter your email first', {
... ...
app/views/fbo-admin/dashboard.html
... ... @@ -36,7 +36,7 @@
36 36 <form role="form">
37 37 <div class="col-sm-6 b-r">
38 38 <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> -->
39   - <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div>
  39 + <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control" ng-blur="checkUsername()"></div>
40 40 <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div>
41 41 <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div>
42 42 <!-- <div>
... ...
app/views/fbo-admin/dashboard.service.js
... ... @@ -37,6 +37,21 @@
37 37 })
38 38 return deferred.promise;
39 39 }
  40 +
  41 + this.checkUsernameEmail = function(email){
  42 + var deferred = $q.defer();
  43 + $http({
  44 + method : 'GET',
  45 + url : BE.url +'/account/user/checkUserNameAvail/'+email,
  46 + headers : {'Content-Type': 'application/json'},
  47 + })
  48 + .then(function (result){
  49 + deferred.resolve(result.status);
  50 + },function (result){
  51 + deferred.resolve(result.status);
  52 + })
  53 + return deferred.promise;
  54 + }
40 55 }
41 56  
42 57 })();
43 58 \ No newline at end of file
... ...
app/views/fbo-flight/flight.html
... ... @@ -102,7 +102,7 @@
102 102 <form role="form">
103 103 <div class="col-sm-6 b-r">
104 104 <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> -->
105   - <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div>
  105 + <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control" ng-blur="checkUsername()"></div>
106 106 <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div>
107 107 <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div>
108 108 <!-- <div>
... ...
app/views/fbo-flight/flightDept.controller.js
... ... @@ -3,13 +3,25 @@
3 3 //Load controller
4 4 angular.module('acuefuel')
5 5  
6   - .controller('FlightDeptController', function ($scope, $uibModal, $state, FBOFlight) {
  6 + .controller('FlightDeptController', function ($scope, $uibModal, $state, FBOFlight, FBOAdmin) {
7 7 $(document).ready(function(){
8 8 $('.fboflight').addClass('active');
9 9 });
10 10 $scope.data = {};
11 11 $scope.user = {};
12 12 $scope.aircraft = {};
  13 +
  14 + $scope.checkUsername = function(){
  15 + FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) {
  16 + console.log(status)
  17 + if(status != 200){
  18 + toastr.error('This email has alreay taken', {
  19 + closeButton: true
  20 + })
  21 + }
  22 + })
  23 + }
  24 +
13 25 $scope.userData = function(){
14 26  
15 27 if($scope.user.email == undefined || $scope.user.email == null){
... ...
app/views/updateAllFBO/updateAllFBO.controller.js
... ... @@ -3,7 +3,7 @@
3 3 //Load controller
4 4 angular.module('acuefuel')
5 5  
6   - .controller('updateAllFBOController', function($scope, $stateParams, $state, UpdateAllFBO) {
  6 + .controller('updateAllFBOController', function($scope, $stateParams, $state, UpdateAllFBO, FBOAdmin) {
7 7 $(document).ready(function(){
8 8 $('.i-checks').iCheck({
9 9 checkboxClass: 'icheckbox_square-green',
... ... @@ -59,6 +59,17 @@
59 59 }
60 60 }
61 61  
  62 + $scope.checkUsername = function(){
  63 + FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) {
  64 + console.log(status)
  65 + if(status != 200){
  66 + toastr.error('This email has alreay taken', {
  67 + closeButton: true
  68 + })
  69 + }
  70 + })
  71 + }
  72 +
62 73 $scope.userData = function(){
63 74 console.log($scope.user.userTypeId)
64 75 if($scope.user.email == undefined || $scope.user.email == null){
... ...
app/views/updateAllFBO/updateAllFBO.html
... ... @@ -39,7 +39,7 @@
39 39 <form role="form">
40 40 <div class="col-sm-6 b-r">
41 41 <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> -->
42   - <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div>
  42 + <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control" ng-blur="checkUsername()"></div>
43 43 <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div>
44 44 <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div>
45 45 <!-- <div>
... ...
app/views/updateFBODept/updateFBODept.controller.js
... ... @@ -3,7 +3,7 @@
3 3 //Load controller
4 4 angular.module('acuefuel')
5 5  
6   - .controller('updateFBODeptController', function($scope, $stateParams, $state, UpdateAllFBODept, UpdateAllFBO, FBOFlight) {
  6 + .controller('updateFBODeptController', function($scope, $stateParams, $state, UpdateAllFBODept, UpdateAllFBO, FBOFlight, FBOAdmin) {
7 7 $(document).ready(function(){
8 8 $('.fboflight').addClass('active');
9 9 });
... ... @@ -76,6 +76,17 @@
76 76 cardData.paymentMethodList = [];
77 77 }
78 78  
  79 + $scope.checkUsername = function(){
  80 + FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) {
  81 + console.log(status)
  82 + if(status != 200){
  83 + toastr.error('This email has alreay taken', {
  84 + closeButton: true
  85 + })
  86 + }
  87 + })
  88 + }
  89 +
79 90 $scope.userData = function(){
80 91 console.log($scope.user.userTypeId)
81 92 if($scope.user.email == undefined || $scope.user.email == null){
... ...
app/views/updateFBODept/updateFBODept.html
... ... @@ -38,7 +38,7 @@
38 38 <form role="form">
39 39 <div class="col-sm-6 b-r">
40 40 <!-- <div class="form-group"><label>Company Name</label> <input type="text" placeholder="Company Name" ng-model="user.companyName" class="form-control"></div> -->
41   - <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control"></div>
  41 + <div class="form-group"><label>Email Username</label> <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control" ng-blur="checkUsername()"></div>
42 42 <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div>
43 43 <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div>
44 44 <!-- <div>
... ...