diff --git a/app/js/app.js b/app/js/app.js index d959430..7cc48ea 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -385,8 +385,19 @@ .run(['$rootScope', '$state', 'LoginService', 'AUTH_EVENTS', function($rootScope, $state, LoginService, AUTH_EVENTS) { $rootScope.$on('$stateChangeStart', function (event, next, nextParams, fromState) { //console.log("from",from, "fromState",fromState) + $rootScope.isShowEmail = false; + $rootScope.isShowFMA = false; $rootScope.previousState = fromState.name; $rootScope.currentUser = JSON.parse(window.localStorage.getItem('currentUser')); + var EPDAccess = JSON.parse(window.localStorage.getItem('EPDAccess')); + var FMAAccess = JSON.parse(window.localStorage.getItem('FMAAccess')); + if(EPDAccess === true || EPDAccess == null){ + $rootScope.isShowEmail = true; + } + if(FMAAccess === true || FMAAccess == null){ + $rootScope.isShowFMA = true; + } + // console.log("nextParams",nextParams) /*LoginService.isAuthorized = function (authorizedRoles) { if (!angular.isArray(authorizedRoles)) { diff --git a/app/partials/dashboard/dashboard.controller.js b/app/partials/dashboard/dashboard.controller.js index 4341541..bc830fb 100644 --- a/app/partials/dashboard/dashboard.controller.js +++ b/app/partials/dashboard/dashboard.controller.js @@ -13,6 +13,7 @@ } $scope.logout = function () { + localStorage.clear(); localStorage.removeItem("loginStatus"); $rootScope.path = false; $state.reload(); diff --git a/app/partials/dashboard/dashboard.html b/app/partials/dashboard/dashboard.html index 4ef9ca8..395f99d 100644 --- a/app/partials/dashboard/dashboard.html +++ b/app/partials/dashboard/dashboard.html @@ -158,7 +158,7 @@ table tr:nth-child(even) {

Price Manager Active

- diff --git a/app/partials/flightDepDashboard/flightDepDashboard.controller.js b/app/partials/flightDepDashboard/flightDepDashboard.controller.js index 4a25568..b1d6962 100644 --- a/app/partials/flightDepDashboard/flightDepDashboard.controller.js +++ b/app/partials/flightDepDashboard/flightDepDashboard.controller.js @@ -22,12 +22,12 @@ } $scope.logout = function () { + localStorage.clear(); localStorage.removeItem("loginStatus"); $rootScope.path = false; $state.reload(); } $scope.getFBOMarginList = function () { - console.log('111111111'); flightDepDashboardService.getFBOs($scope.order.airport).then(function(result) { $scope.marginList = result; }) @@ -59,7 +59,7 @@ $scope.setCost = function(cost){ if(cost != null) { var obj =JSON.parse(cost); - console.log('costttttt',obj.cost); + // console.log('costttttt',obj.cost); $scope.order.fboCost = obj.cost; } } diff --git a/app/partials/login/login.controller.js b/app/partials/login/login.controller.js index 2329976..188d8ab 100644 --- a/app/partials/login/login.controller.js +++ b/app/partials/login/login.controller.js @@ -6,6 +6,7 @@ function LoginController($scope, $filter, $rootScope, $state, LoginService) { + $scope.data = {}; $scope.data.username = ''; $scope.data.password = ''; @@ -22,7 +23,20 @@ if (reqPwdChng && reqPwdChng == "Y") { $state.go('resetPassword'); } else { - LoginService.authenticate(); + console.log("else ") + LoginService.authenticate().then(function(result){ + var currentUserDetail = JSON.parse(window.localStorage.getItem("currentUser")); + if(currentUserDetail.type === 'ADDITIONAL'){ + var email = $scope.data.username; + //console.log("hi",email) + LoginService.getAdditionalAccess(email).then(function(result){ + console.log("getaccess",result) + window.localStorage.setItem("EPDAccess", JSON.stringify(result.allowEpd)); + window.localStorage.setItem("FMAAccess", JSON.stringify(result.allowFma)); + }) + } + }) + } }else{ diff --git a/app/partials/login/login.service.js b/app/partials/login/login.service.js index 9cb6eb6..e16f666 100644 --- a/app/partials/login/login.service.js +++ b/app/partials/login/login.service.js @@ -88,6 +88,21 @@ return deferred.promise; } + + authService.getAdditionalAccess = function(email) { + var deferred = $q.defer(); + $http({ + method : 'GET', + url : BASE_URL.url +'/additionalAccount/'+email, + headers : {'Content-Type': 'application/json'}, + }) + .then(function (result){ + deferred.resolve(result.data); + },function (result){ + deferred.resolve(result.data); + }) + return deferred.promise; + } authService.getUser = function () { diff --git a/app/partials/main/main.controller.js b/app/partials/main/main.controller.js index ea02cf6..7fa525d 100644 --- a/app/partials/main/main.controller.js +++ b/app/partials/main/main.controller.js @@ -8,12 +8,23 @@ $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName')); $scope.companyName = JSON.parse(localStorage.getItem('companyName')); + var User = JSON.parse(localStorage.getItem('currentUser')); + if(User.type === 'ADDITIONAL'){ + $scope.companyName = $scope.currentUserName; + } $scope.testFunction = function(){ $scope.currentUserName = JSON.parse(localStorage.getItem('currentUserName')); $scope.companyName = JSON.parse(localStorage.getItem('companyName')); } + + $scope.logout = function(){ + $state.go('login'); + localStorage.clear(); + $rootScope.isAuthenticated = false; + + } /** Automatic logout session after 2 hours diff --git a/app/partials/main/main.html b/app/partials/main/main.html index 990318d..3c5f2d0 100644 --- a/app/partials/main/main.html +++ b/app/partials/main/main.html @@ -25,7 +25,7 @@
  • My Profile
  • Account Settings
  • -
  • Logout
  • +
  • Logout
  • @@ -56,7 +56,7 @@
    diff --git a/app/partials/viewCompany/viewCompany.html b/app/partials/viewCompany/viewCompany.html index 5aa794d..b1de0dc 100644 --- a/app/partials/viewCompany/viewCompany.html +++ b/app/partials/viewCompany/viewCompany.html @@ -210,7 +210,7 @@
    - +
    @@ -322,7 +322,7 @@
    - +
    diff --git a/app/partials/viewFuelVendor/viewFuelVendor.html b/app/partials/viewFuelVendor/viewFuelVendor.html index 22e6481..7c4a152 100644 --- a/app/partials/viewFuelVendor/viewFuelVendor.html +++ b/app/partials/viewFuelVendor/viewFuelVendor.html @@ -229,7 +229,7 @@
    - +
    diff --git a/app/partials/viewVendorContact/viewVendorContact.html b/app/partials/viewVendorContact/viewVendorContact.html index dd3de5b..a04a7bb 100644 --- a/app/partials/viewVendorContact/viewVendorContact.html +++ b/app/partials/viewVendorContact/viewVendorContact.html @@ -97,7 +97,7 @@
    - +
    @@ -129,7 +129,7 @@
    - +
    diff --git a/app/partials/viewcontact/viewcontact.html b/app/partials/viewcontact/viewcontact.html index 5311190..c8f0e4b 100644 --- a/app/partials/viewcontact/viewcontact.html +++ b/app/partials/viewcontact/viewcontact.html @@ -37,7 +37,7 @@

    Contact Detail

    - +
    @@ -104,7 +104,7 @@
    - +