From f0315ea9be83baf1a1861abc6b6e8fa1f123ed3a Mon Sep 17 00:00:00 2001 From: "kuldeep.arora" Date: Wed, 28 Feb 2018 13:24:31 +0530 Subject: [PATCH] FBO admin and Flight dept admin UI --- app/index.html | 69 +++++++++++++++++++++ app/views/updateAllFBO/updateAllFBO.controller.js | 45 +++++++++++--- app/views/updateAllFBO/updateAllFBO.html | 26 +++++++- app/views/updateAllFBO/updateAllFBO.service.js | 14 +++++ .../updateFBODept/updateFBODept.controller.js | 70 ++++++++++++++++------ app/views/updateFBODept/updateFBODept.html | 24 +++++++- app/views/updateFBODept/updateFBODept.service.js | 16 +++++ 7 files changed, 235 insertions(+), 29 deletions(-) diff --git a/app/index.html b/app/index.html index c03dd7e..2bce6aa 100755 --- a/app/index.html +++ b/app/index.html @@ -38,6 +38,75 @@ + + diff --git a/app/views/updateAllFBO/updateAllFBO.controller.js b/app/views/updateAllFBO/updateAllFBO.controller.js index 74bc75b..acbe87b 100644 --- a/app/views/updateAllFBO/updateAllFBO.controller.js +++ b/app/views/updateAllFBO/updateAllFBO.controller.js @@ -16,14 +16,14 @@ $scope.feature = {}; var userProfileID = $stateParams.id; UpdateAllFBO.getALlFBOData(userProfileID).then(function(result) { - console.log(result) + // console.log(result) $scope.user = result; $scope.user.userTypeId = result.userType.id; if(result.accountFeatureControl != null){ $scope.feature = result.accountFeatureControl; $scope.feature.accountId = result.account.id; - console.log($scope.feature) + // console.log($scope.feature) if($scope.feature.essintaPosSystem == true){ $scope.essAccountId = false; $("#esAccId").css({ opacity: 1 }); @@ -40,7 +40,7 @@ $scope.user.clientNote = response[0].notes $scope.user.userNoteId = response[0].id; }) - console.log($scope.feature,"dsdsdsds") + //console.log($scope.feature,"dsdsdsds") if($scope.user.account.user.status == 'ACTIVE'){ $scope.status = true; }else { @@ -61,7 +61,7 @@ $scope.checkUsername = function(){ FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) { - console.log(status) + // console.log(status) if(status != 200){ toastr.error('This email has alreay taken', { closeButton: true @@ -71,7 +71,7 @@ } $scope.userData = function(){ - console.log($scope.user.userTypeId) + // console.log($scope.user.userTypeId) if($scope.user.email == undefined || $scope.user.email == null){ toastr.error('Please enter your email first', { closeButton: true @@ -96,7 +96,7 @@ } $scope.user.username = $scope.user.email; $scope.user.userType = 'fbo'; - console.log($scope.user) + // console.log($scope.user) // if($scope.user.userNoteId == undefined){ // $scope.user.userNoteId = null; // } @@ -111,11 +111,42 @@ + "&essintaAccountUid=" + $scope.feature.essintaAccountUid + "&additionalLicences=" + $scope.feature.additionalLicences + "&accountFeatureControlId=" + $scope.feature.id; UpdateAllFBO.updatefeatureControl(updatefeatureControlData).then(function(response) { - console.log(response) + // console.log(response) }) $state.go('index.fboAdmin'); }) } } + var deleteUserId = ""; + $scope.deleteData = function(userid){ + $('#delete2').css('display', 'block'); + // console.log("kd user id--",userid) + // $state.go('index.fboAdmin') + deleteUserId = userid; + } + + $scope.deleteUserData = function(){ + // console.log("api hit") + UpdateAllFBO.deleteUser(deleteUserId).then(function(result) { + $('#delete2').css('display', 'none'); + if(result.success){ + toastr.success(''+result.success+'', { + closeButton: true + + }) + }else{ + toastr.error(''+result.statusText+'', { + closeButton: true + + }) + } + $state.go('index.fboAdmin') + }) + } + $scope.cancelDelete = function(){ + $('#delete2').css('display', 'none'); + } + + }); \ No newline at end of file diff --git a/app/views/updateAllFBO/updateAllFBO.html b/app/views/updateAllFBO/updateAllFBO.html index abee05d..8071d0b 100644 --- a/app/views/updateAllFBO/updateAllFBO.html +++ b/app/views/updateAllFBO/updateAllFBO.html @@ -8,7 +8,7 @@
- +
@@ -154,4 +154,26 @@
- \ No newline at end of file + + +
+
+
+ + + + + +
+ + +

Please confirm! Are you sure you want to DELETE this User & its related data?

+
+
+
+ + +
+
+
+ diff --git a/app/views/updateAllFBO/updateAllFBO.service.js b/app/views/updateAllFBO/updateAllFBO.service.js index 3462d89..430d3dc 100644 --- a/app/views/updateAllFBO/updateAllFBO.service.js +++ b/app/views/updateAllFBO/updateAllFBO.service.js @@ -64,6 +64,20 @@ return deferred.promise; } + /* Delete API service for FBO Admin (In AccountResource.java)*/ + this.deleteUser = function(id) { + var deferred = $q.defer(); + $http({ + method : 'DELETE', + url : BE.url +'/account/deleteUser/'+id, + headers : {'Content-Type': 'application/json'}, + }) + .success(function(result) { + deferred.resolve(result); + }) + return deferred.promise; + } + } })(); \ No newline at end of file diff --git a/app/views/updateFBODept/updateFBODept.controller.js b/app/views/updateFBODept/updateFBODept.controller.js index 17a9c86..8f77b7f 100644 --- a/app/views/updateFBODept/updateFBODept.controller.js +++ b/app/views/updateFBODept/updateFBODept.controller.js @@ -14,7 +14,7 @@ $scope.companyId; UpdateAllFBODept.getALlFBOData(userProfileID).then(function(result) { - console.log(result) + // console.log(result) $scope.user = result; // $scope.aircraft.accountId = result.account.id; $scope.user.userTypeId = result.userType.id; @@ -32,7 +32,7 @@ }) UpdateAllFBODept.getAssociatedCompany(userProfileID).then(function(result) { - console.log('=======q===',result) + // console.log('=======q===',result) $scope.companyId = result.id; getCrafts(result.id); $scope.aircraft.accountId = result.id; @@ -55,7 +55,7 @@ }) $scope.openCard = function(payment){ - console.log(payment) + //console.log(payment) $scope.showPayments = false; $scope.data = {}; $scope.data.cardNumber = payment.cardNumber; @@ -68,11 +68,11 @@ var cardData = {} cardData.paymentMethodList = []; $scope.updateCard = function(){ - console.log($scope.data) + // console.log($scope.data) cardData.paymentMethodList.push($scope.data); - console.log("cardData", cardData); + // console.log("cardData", cardData); UpdateAllFBODept.updatePaymentMethod(cardData).then(function(result) { - console.log(result) + // console.log(result) toastr.success('Updated Successfully', { closeButton: true }) @@ -87,7 +87,7 @@ $scope.checkUsername = function(){ FBOAdmin.checkUsernameEmail($scope.user.email).then(function(status) { - console.log(status) + // console.log(status) if(status != 200){ toastr.error('This email has alreay taken', { closeButton: true @@ -97,7 +97,7 @@ } $scope.userData = function(){ - console.log($scope.user.userTypeId) + // console.log($scope.user.userTypeId) if($scope.user.email == undefined || $scope.user.email == null){ toastr.error('Please enter your email first', { closeButton: true @@ -114,7 +114,7 @@ } $scope.user.username = $scope.user.email; $scope.user.userType = 'flightDetp'; - console.log($scope.user) + // console.log($scope.user) // if($scope.user.userNoteId == undefined){ // $scope.user.userNoteId = null; // } @@ -163,9 +163,9 @@ $scope.getSize = function(){ FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - console.log($scope.aircraftSizeList) + // console.log($scope.aircraftSizeList) $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; - console.log($scope.aircraft.sizeId) + // console.log($scope.aircraft.sizeId) }) } @@ -182,11 +182,11 @@ 'model': $scope.aircraft.model, 'sizeId' : $scope.aircraft.sizeId }); - console.log('$scope.addData',$scope.addData); + // console.log('$scope.addData',$scope.addData); $scope.aircraftListData.aircraftList = $scope.addData; $scope.aircraftListData.accountId = $scope.companyId; - console.log($scope.aircraft) + // console.log($scope.aircraft) //$scope.aircraftData.aircraftList.push($scope.aircraft); FBOFlight.addAircraft($scope.aircraftListData).then(function(result) { @@ -201,7 +201,8 @@ closeButton: true }) $('#myModal4').modal('hide'); - $scope.getCraftList.splice($scope.aircraft); + // console.log("aircraf---",$scope.aircraft) + // $scope.getCraftList.splice($scope.aircraft); }); } @@ -213,14 +214,14 @@ $scope.update = function(airdata){ $("#myModal5").modal('show'); $scope.aircraft = airdata; - console.log('--------$scope.companyId---',$scope.companyId); + // console.log('--------$scope.companyId---',$scope.companyId); $scope.aircraft.accountId = $scope.companyId; FBOFlight.getModal($scope.aircraft.make).then(function(result) { $scope.aircraftModalList = result; FBOFlight.getAircraftSize($scope.aircraft.make, $scope.aircraft.model).then(function(result) { $scope.aircraftSizeList = result; - console.log($scope.aircraftSizeList) + // console.log($scope.aircraftSizeList) $scope.aircraft.sizeId = $scope.aircraftSizeList[0].aircraftSize.id; }) }) @@ -237,10 +238,10 @@ $scope.updateAircraftData.sizeId = updateAircraft.sizeId; $scope.updateAircraftData.tail = updateAircraft.tail; $scope.updateAircraftData.accountId = $scope.companyId; - console.log($scope.updateAircraftData) + // console.log($scope.updateAircraftData) $scope.updatecraftData.aircraftList.push($scope.updateAircraftData); - console.log($scope.updatecraftData.aircraftList) + // console.log($scope.updatecraftData.aircraftList) UpdateAllFBODept.updateAircraft($scope.updatecraftData).then(function(result) { $('#myModal5').modal('hide'); @@ -259,7 +260,7 @@ } $scope.remove = function(data){ - console.log(data) + //console.log(data) UpdateAllFBODept.removeAircraft(data.id).then(function(result) { toastr.success(''+result.success+'', { closeButton: true @@ -275,4 +276,35 @@ getData(); } + + var deleteFlightDeptUserId = ""; + $scope.deleteData = function(userid){ + $('#delete2').css('display', 'block'); + //console.log("kd user id--",userid) + deleteFlightDeptUserId = userid; + + } + + $scope.deleteUserData = function(){ + // console.log("api hit") + UpdateAllFBODept.deleteUser(deleteFlightDeptUserId).then(function(result) { + $('#delete2').css('display', 'none'); + if(result.success){ + toastr.success(''+result.success+'', { + closeButton: true + + }) + }else{ + toastr.error(''+result.statusText+'', { + closeButton: true + + }) + } + $state.go('index.flightDept') + }) + } + $scope.cancelDelete = function(){ + $('#delete2').css('display', 'none'); + } + }); \ No newline at end of file diff --git a/app/views/updateFBODept/updateFBODept.html b/app/views/updateFBODept/updateFBODept.html index 6039a7e..baa9384 100644 --- a/app/views/updateFBODept/updateFBODept.html +++ b/app/views/updateFBODept/updateFBODept.html @@ -5,7 +5,7 @@
- +
@@ -349,4 +349,26 @@
+ + +
+
+
+ + + + + +
+ + +

Please confirm! Are you sure you want to DELETE this User & its related data?

+
+
+
+ + +
+
+
\ No newline at end of file diff --git a/app/views/updateFBODept/updateFBODept.service.js b/app/views/updateFBODept/updateFBODept.service.js index 6bda316..d87c6f2 100644 --- a/app/views/updateFBODept/updateFBODept.service.js +++ b/app/views/updateFBODept/updateFBODept.service.js @@ -122,6 +122,22 @@ return deferred.promise; } + /* Delete API service for Flight Dept Admin (In AccountUserResource.java) */ + this.deleteUser = function(id) { + var deferred = $q.defer(); + $http({ + method : 'DELETE', + url : BE.url +'/account/user/deleteUser/'+id, + headers : {'Content-Type': 'application/json'}, + }) + .success(function(result) { + deferred.resolve(result); + }) + return deferred.promise; + } + + + } })(); \ No newline at end of file -- 2.0.0