Commit bdc73f777e4fdd2eb4e6f38801c41beff6738881

Authored by Swarn Singh
1 parent 089f3a3c29
Exists in master

validation issue resolved

app/views/fbo-admin/dashboard.controller.js
... ... @@ -15,6 +15,9 @@
15 15 $scope.essAccountId = true;
16 16 $("#esAccId").css({ opacity: 0.5 });
17 17 $scope.user = {};
  18 + $scope.user.companyName = '';
  19 + $scope.user.email = '';
  20 + $scope.user.password = '';
18 21 $scope.feature = {};
19 22 $scope.feature.level = 'silver';
20 23 $scope.feature.essintaPosSystem = false;
... ... @@ -35,9 +38,66 @@
35 38 }
36 39 })
37 40 }
  41 + $scope.comnayNameInvalid = false;
  42 + $scope.emailInvalid = false;
  43 + $scope.passwordInvalid = false;
  44 +
  45 + $scope.companyNameValid = function(){
  46 + $scope.comnayNameInvalid = false;
  47 + $('.companyNameError').removeClass('customErrorInput');
  48 + }
  49 + $scope.emailValid = function(){
  50 + $scope.emailInvalid = false;
  51 + $('.emailIdError').removeClass('customErrorInput');
  52 + }
  53 + $scope.passwordValid = function(){
  54 + $scope.passwordInvalid = false;
  55 + $('.invalidPassword').removeClass('customErrorInput');
  56 + }
38 57  
39 58 $scope.userData = function(){
40   - if($scope.user.email == undefined || $scope.user.email == null){
  59 + console.log('$scope.user', $scope.user);
  60 + if ($scope.user.companyName == '') {
  61 + $scope.comnayNameInvalid = true;
  62 + $('.companyNameError').addClass('customErrorInput');
  63 + }else if ($scope.user.email == '') {
  64 + $scope.emailInvalid = true;
  65 + $('.emailIdError').addClass('customErrorInput');
  66 + }else if ($scope.user.password == '') {
  67 + $scope.passwordInvalid = true;
  68 + $('.invalidPassword').addClass('customErrorInput');
  69 + }else{
  70 + if($scope.status == true){
  71 + $scope.user.status = 'active';
  72 + }else{
  73 + $scope.user.status = 'inactive';
  74 + }
  75 + $scope.user.username = $scope.user.email;
  76 + $scope.user.userType = 'fbo';
  77 + console.log($scope.user)
  78 + 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;
  79 + FBOAdmin.registerUser(formdata).then(function(result) {
  80 + toastr.success('Created Successfully', {
  81 + closeButton: true
  82 + })
  83 + $scope.feature.accountId = result;
  84 + var featureControlData = "accountId=" + $scope.feature.accountId + "&level=" + $scope.feature.level + "&essintaPosSystem=" + $scope.feature.essintaPosSystem
  85 + + "&acuQuote=" + $scope.feature.acuQuote + "&acuTrack=" + $scope.feature.acuTrack + "&fuelProgram=" + $scope.feature.fuelProgram + "&amstatIntegration=" + $scope.feature.amstatIntegration+ "&posAccountingIntegration="
  86 + + $scope.feature.posAccountingIntegration + "&posVeederRootIntegration=" + $scope.feature.posVeederRootIntegration
  87 + + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences;
  88 +
  89 + FBOAdmin.featureControl(featureControlData).then(function(response) {
  90 + console.log(response)
  91 +
  92 + })
  93 + $state.go('index.fboAdmin');
  94 + }, function (err) {
  95 + toastr.error('Error in registeration', {
  96 + closeButton: true
  97 + })
  98 + });
  99 + }
  100 + /*if($scope.user.email == ''){
41 101 toastr.error('Please enter your email first', {
42 102 closeButton: true
43 103 })
... ... @@ -75,7 +135,7 @@
75 135 closeButton: true
76 136 })
77 137 });
78   - }
  138 + }*/
79 139  
80 140 }
81 141  
... ...
app/views/fbo-admin/dashboard.html
  1 +<style type="text/css">
  2 + .customErrorMessage{
  3 + color: #8a1f11;
  4 + font-weight: bold;
  5 + margin-left: 10px;
  6 + }
  7 + .customErrorInput{
  8 + background-color: rgb(251, 227, 228);
  9 + border: 1px solid #fbc2c4;
  10 + color: #8a1f11;
  11 + }
  12 +</style>
  13 +
1 14 </div>
2 15 <div class="row wrapper border-bottom white-bg page-heading">
3 16 <div class="col-lg-8">
4 17 <!-- <h2 ng-click="editName()" ng-show="showCompany" style="cursor: pointer;">Tellus Institute</h2> -->
5   - <div style="margin-top: 20px;"><input type="text" style="width:50%;" placeholder="Enter Company Name" ng-model="user.companyName" class="form-control"></div>
  18 + <div style="margin-top: 20px;">
  19 + <input type="text" style="width:50%; float: left;" placeholder="Enter Company Name" ng-model="user.companyName" class="form-control companyNameError" ng-keyup="companyNameValid()">
  20 + <label class="customErrorMessage" ng-show="comnayNameInvalid" style="margin-top: 7px;">This field is required.</label>
  21 + <div class="clearfix"></div>
  22 + </div>
6 23 </div>
7 24 <div class="col-lg-4" style="margin-top: 20px; text-align: right;">
8 25 <button type="button" class="btn btn-default btn-sm" ui-sref="index.fboAdmin">Cancel</button>
... ... @@ -36,9 +53,19 @@
36 53 <form role="form">
37 54 <div class="col-sm-6 b-r">
38 55 <!-- <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" ng-blur="checkUsername()"></div>
40   - <div class="form-group"><label>First Name</label> <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control"></div>
41   - <div class="form-group"><label>Last Name</label> <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control"></div>
  56 + <div class="form-group">
  57 + <label>Email Username</label>
  58 + <label class="customErrorMessage" ng-show="emailInvalid">This field is required.</label>
  59 + <input type="email" placeholder="Email Username" ng-model="user.email" class="form-control emailIdError" ng-blur="checkUsername()" ng-keyup="emailValid()">
  60 + </div>
  61 + <div class="form-group">
  62 + <label>First Name</label>
  63 + <input type="text" placeholder="First Name" ng-model="user.firstName" class="form-control">
  64 + </div>
  65 + <div class="form-group">
  66 + <label>Last Name</label>
  67 + <input type="text" placeholder="Last Name" ng-model="user.lastName" class="form-control">
  68 + </div>
42 69 <!-- <div>
43 70 <button class="btn btn-sm btn-primary pull-right m-t-n-xs" type="submit"><strong>Log in</strong></button>
44 71 <label> <input type="checkbox" class="i-checks"> Remember me </label>
... ... @@ -46,9 +73,19 @@
46 73  
47 74 </div>
48 75 <div class="col-sm-6">
49   - <div class="form-group"><label>Password</label> <input type="password" ng-model="user.password" placeholder="Password" class="form-control"></div>
50   - <div class="form-group"><label>Phone</label> <input type="number" ng-model="user.phone" placeholder="Phone" class="form-control"></div>
51   - <div class="form-group"><label>Mobile</label> <input type="number" ng-model="user.mobile" placeholder="Mobile" class="form-control"></div>
  76 + <div class="form-group">
  77 + <label>Password</label>
  78 + <label class="customErrorMessage" ng-show="passwordInvalid">This field is required.</label>
  79 + <input type="password" ng-model="user.password" placeholder="Password" class="form-control invalidPassword" ng-keyup="passwordValid()">
  80 + </div>
  81 + <div class="form-group">
  82 + <label>Phone</label>
  83 + <input type="number" ng-model="user.phone" placeholder="Phone" class="form-control">
  84 + </div>
  85 + <div class="form-group">
  86 + <label>Mobile</label>
  87 + <input type="number" ng-model="user.mobile" placeholder="Mobile" class="form-control">
  88 + </div>
52 89 </div>
53 90 </form>
54 91 </div>
... ...