From bdc73f777e4fdd2eb4e6f38801c41beff6738881 Mon Sep 17 00:00:00 2001 From: swarn Date: Tue, 23 May 2017 16:25:20 +0530 Subject: [PATCH] validation issue resolved --- app/views/fbo-admin/dashboard.controller.js | 64 ++++++++++++++++++++++++++++- app/views/fbo-admin/dashboard.html | 51 +++++++++++++++++++---- 2 files changed, 106 insertions(+), 9 deletions(-) diff --git a/app/views/fbo-admin/dashboard.controller.js b/app/views/fbo-admin/dashboard.controller.js index 9c4e902..5082373 100644 --- a/app/views/fbo-admin/dashboard.controller.js +++ b/app/views/fbo-admin/dashboard.controller.js @@ -15,6 +15,9 @@ $scope.essAccountId = true; $("#esAccId").css({ opacity: 0.5 }); $scope.user = {}; + $scope.user.companyName = ''; + $scope.user.email = ''; + $scope.user.password = ''; $scope.feature = {}; $scope.feature.level = 'silver'; $scope.feature.essintaPosSystem = false; @@ -35,9 +38,66 @@ } }) } + $scope.comnayNameInvalid = false; + $scope.emailInvalid = false; + $scope.passwordInvalid = false; + + $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'); + } $scope.userData = function(){ - if($scope.user.email == undefined || $scope.user.email == null){ + console.log('$scope.user', $scope.user); + if ($scope.user.companyName == '') { + $scope.comnayNameInvalid = true; + $('.companyNameError').addClass('customErrorInput'); + }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) + 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; + 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 == ''){ toastr.error('Please enter your email first', { closeButton: true }) @@ -75,7 +135,7 @@ closeButton: true }) }); - } + }*/ } diff --git a/app/views/fbo-admin/dashboard.html b/app/views/fbo-admin/dashboard.html index b25da29..1ce7a3a 100644 --- a/app/views/fbo-admin/dashboard.html +++ b/app/views/fbo-admin/dashboard.html @@ -1,8 +1,25 @@ + +
-
+
+ + +
+
@@ -36,9 +53,19 @@
-
-
-
+
+ + + +
+
+ + +
+
+ + +