Skip to content

Commit abe8d58

Browse files
author
ankur.singhal
committed
Menu bar added
1 parent 666447b commit abe8d58

8 files changed

Lines changed: 272 additions & 155 deletions

File tree

‎survey/src/main/webapp/css/application/survey.css‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,36 @@ g text {
115115
margin-top: 40px;
116116
position: relative;
117117
z-index: 1;
118+
}
119+
120+
ul {
121+
list-style-type: none;
122+
margin: 0;
123+
padding: 0;
124+
overflow: hidden;
125+
background-color: #9ad5e9;
126+
}
127+
128+
li {
129+
float: left;
130+
}
131+
132+
li a {
133+
display: block;
134+
color: white;
135+
text-align: center;
136+
padding: 14px 16px;
137+
text-decoration: none;
138+
}
139+
140+
/* Change the link color to #111 (black) on hover */
141+
li a:hover {
142+
background-color: #57bee2;
143+
}
144+
145+
.active {
146+
background-color: #1b52a1;
147+
}
148+
li {
149+
border-right: 1px solid #bbb;
118150
}

‎survey/src/main/webapp/htm/application/admin.htm‎

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@
44

55
<div ng-show="isSuperAdmin">
66

7+
<div class="row-fluid">
8+
<ul>
9+
<li ng-class="{ active: isActive('/admin')}"><a href="#/admin">Download Reports</a></li>
10+
<li ng-class="{ active: isActive('/userManagement')}"><a href="#/userManagement">User management</a></li>
11+
</ul>
12+
</div>
13+
714
<div id="loading_Overlay"></div>
815
<div id="loading_img">
916
<img src="/survey/images/loading.gif" />
1017
</div>
11-
<div class="row-fluid marginDiv">
12-
<div class="row-fluid col-md-6">
13-
<label class="lable-align">Add New Admin User&nbsp;&nbsp;</label>
14-
<input type="text" name="optional" ng-model="superAdmin" value="" />
15-
<button class="btn btn-primary" ng-click="addAdmin()">Add</button>
16-
</div>
17-
<div class="col-md-6"><span>{{message}}</span></div>
18-
</div>
19-
2018
<br/><br/>
2119

2220
<div class="row-fluid marginDiv">
@@ -42,16 +40,8 @@
4240
<button class="btn btn-primary" ng-click="reportDownload()">Download Report</button>
4341
<br/><br/>
4442
<div class="row-fluid marginDivPie container">
45-
<div class="col-md-3" google-chart chart="myChartObjectSR" on-select="srSelected(selectedItem)" style="height:300px; width:25%;"></div>
46-
<div class="col-md-4" google-chart chart="myChartObjectSTR" on-select="strSelected(selectedItem)" style="height:300px; width:25%;"></div>
47-
<div class="col-md-5 pull-right">
48-
<div class="row-fluid pull-right">
49-
<input type="text" name="userText" ng-model="userText" value="" />
50-
<button class="btn btn-primary" ng-click="loadAdminUsers()">Search user</button>
51-
<button class="btn btn-primary" ng-click="deactivateUsers()">De-Activate</button>
52-
</div>
53-
<div class="row-fluid gridStyle" ng-grid="gridOptions1"></div>
54-
</div>
43+
<div class="col-md-6" google-chart chart="myChartObjectSR" on-select="srSelected(selectedItem)" style="height:400px; width:25%;"></div>
44+
<div class="col-md-6" google-chart chart="myChartObjectSTR" on-select="strSelected(selectedItem)" style="height:400px; width:25%;"></div>
5545
</div>
5646

5747
<br/><br/>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<div class="container-fluid" ng-controller="userManagementController">
2+
3+
<div ng-show="!isSuperAdmin"><span class="pull-left">{{authMsg}}</span></div>
4+
5+
<div ng-show="isSuperAdmin">
6+
7+
<div class="row-fluid">
8+
<ul>
9+
<li ng-class="{ active: isActive('/admin')}"><a href="#/admin">Download Reports</a></li>
10+
<li ng-class="{ active: isActive('/userManagement')}"><a href="#/userManagement">User management</a></li>
11+
</ul>
12+
</div>
13+
14+
<div id="loading_Overlay"></div>
15+
<div id="loading_img">
16+
<img src="/survey/images/loading.gif" />
17+
</div>
18+
<div class="row-fluid marginDiv">
19+
<div class="row-fluid col-md-6">
20+
<label class="lable-align">Add New Admin User&nbsp;&nbsp;</label>
21+
<input type="text" name="optional" ng-model="superAdmin" value="" />
22+
<button class="btn btn-primary" ng-click="addAdmin()">Add</button>
23+
</div>
24+
<div class="col-md-6"><span>{{message}}</span></div>
25+
</div>
26+
27+
<br/><br/>
28+
29+
<div class="row-fluid marginDiv">
30+
<div class="col-md-5">
31+
<div class="row-fluid pull-right">
32+
<input type="text" name="userText" ng-model="userText" value="" />
33+
<button class="btn btn-primary" ng-click="loadAdminUsers()">Search user</button>
34+
<button class="btn btn-primary" ng-click="deactivateUsers()">De-Activate</button>
35+
</div>
36+
<div class="row-fluid gridStyle" ng-grid="gridOptions1"></div>
37+
</div>
38+
<div class="col-md-7"></div>
39+
</div>
40+
</div>
41+
</div>

‎survey/src/main/webapp/index.html‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<script src="js/application/surveyCtrl.js"></script>
4848
<script src="js/application/thanksCtrl.js"></script>
4949
<script src="js/application/adminCtrl.js"></script>
50+
<script src="js/application/userManagement.js"></script>
5051

5152
<script>
5253
angular.bootstrap(document, ['surveyApp']);

‎survey/src/main/webapp/js/application/adminCtrl.js‎

Lines changed: 9 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,19 @@
22

33
var adminCtrl = angular.module("surveyApp");
44

5-
adminCtrl.controller("adminController", function($scope, $rootScope, $http) {
5+
adminCtrl.controller("adminController", function($scope, $rootScope, $http, $location) {
66

77
$rootScope.isSuperAdmin = true;
88
$rootScope.username = "";
99
$scope.authMsg = "";
1010

11-
$scope.loadAdminUsers = function(){
12-
13-
$('#loading_Overlay').show();
14-
$('#loading_img').show();
15-
16-
var dataObj = {
17-
"page" : $scope.pagingOptions1.currentPage,
18-
"pageSize" : $scope.pagingOptions1.pageSize,
19-
"userName": $scope.userText,
20-
"roleId":1
21-
};
22-
23-
$http({
24-
method : "POST",
25-
url : baseUrl + "loadAdminUsers",
26-
data : JSON.stringify(dataObj),
27-
headers : {'Content-Type' : 'application/json'}
28-
}).then(function(response) {
29-
$scope.myUserData = response.data.userPojoList;
30-
$scope.totalServerItems1 = response.data.count;
31-
$('#loading_Overlay').hide();
32-
$('#loading_img').hide();
33-
}).catch(function (data) {
34-
$('#loading_Overlay').hide();
35-
$('#loading_img').hide();
36-
});
37-
38-
}
39-
4011
$scope.totalServerItems = 0;
4112
$scope.pagingOptions = {
4213
pageSizes: [10, 50, 100],
4314
pageSize: "10",
4415
currentPage: 1
4516
};
46-
47-
$scope.totalServerItems1 = 0;
48-
$scope.pagingOptions1 = {
49-
pageSizes: [10, 50, 100],
50-
pageSize: "10",
51-
currentPage: 1
52-
};
53-
17+
5418
$http({
5519
method : "POST",
5620
url : baseUrl + "validateSuperAdmin",
@@ -81,10 +45,6 @@ adminCtrl.controller("adminController", function($scope, $rootScope, $http) {
8145

8246
});
8347

84-
if($rootScope.isSuperAdmin){
85-
$scope.loadAdminUsers();
86-
}
87-
8848
$scope.pieDataSR;
8949
$scope.pieDataSTR;
9050
$scope.myChartObjectSR = {};
@@ -141,69 +101,16 @@ adminCtrl.controller("adminController", function($scope, $rootScope, $http) {
141101
$scope.fromDate = new Date();
142102
$scope.toDate = new Date();
143103

104+
$scope.isActive = function (viewLocation) {
105+
return viewLocation === $location.path();
106+
};
107+
144108
$scope.dpOpenStatus = {};
145109

146110
$scope.setDpOpenStatus = function(id) {
147111
$scope.dpOpenStatus[id] = true
148112
};
149-
150-
// super admin
151-
$scope.addAdmin = function(){
152-
153-
$('#loading_Overlay').show();
154-
$('#loading_img').show();
155-
156-
var dataObj = {
157-
"userName" : $scope.superAdmin,
158-
"roleId":1
159-
};
160-
161-
$http({
162-
method : "POST",
163-
url : baseUrl + "saveUser",
164-
data : JSON.stringify(dataObj),
165-
headers : {'Content-Type' : 'application/json'}
166-
}).then(function(response) {
167-
168-
$('#loading_Overlay').hide();
169-
$('#loading_img').hide();
170-
171-
var JSONObject = response.data;
172-
173-
var messageVal = JSONObject["value"];
174-
175-
if(messageVal == "Success"){
176-
$scope.message = "User "+$scope.superAdmin + " Added Successfully";
177-
$scope.loadAdminUsers();
178-
179-
}else if(messageVal == "alreadyPresent"){
180-
$scope.message = "User "+$scope.superAdmin + " is already there";
181-
182-
}else{
183-
$scope.message = "Error adding in User "+$scope.superAdmin;
184-
}
185-
186-
});
187-
};
188-
189-
$scope.deactivateUsers = function(){
190-
191-
$('#loading_Overlay').show();
192-
$('#loading_img').show();
193-
194-
$http({
195-
method : "POST",
196-
url : baseUrl + "deleteAdminUser",
197-
data : $scope.selectedRows,
198-
headers : {'Content-Type' : 'application/json'}
199-
}).then(function(response) {
200-
$scope.loadAdminUsers();
201-
$scope.gridOptions1.selectedItems.length = 0;
202-
$('#loading_Overlay').hide();
203-
$('#loading_img').hide();
204-
});
205-
};
206-
113+
207114
$scope.$watch('pagingOptions', function (newVal, oldVal) {
208115
if ((newVal !== oldVal) && (newVal.currentPage !== oldVal.currentPage) || (newVal.pageSize !== oldVal.pageSize)) {
209116
$('#loading_Overlay').show();
@@ -234,15 +141,7 @@ adminCtrl.controller("adminController", function($scope, $rootScope, $http) {
234141
});
235142
}
236143
}, true);
237-
238-
239-
$scope.$watch('pagingOptions1', function (newVal, oldVal) {
240-
if ((newVal !== oldVal) && (newVal.currentPage !== oldVal.currentPage) || (newVal.pageSize !== oldVal.pageSize)) {
241-
$scope.loadAdminUsers();
242-
}
243-
}, true);
244-
245-
144+
246145
// search
247146

248147
$scope.searchSurvey = function(){
@@ -455,27 +354,5 @@ adminCtrl.controller("adminController", function($scope, $rootScope, $http) {
455354
{field:'feedback', displayName:'Feedback',width: '100px'},
456355
{field:'createdDate', displayName:'Date',width: '200px'}
457356
]
458-
};
459-
460-
$scope.selectedRows=[];
461-
462-
$scope.gridOptions1 = {
463-
data: 'myUserData',
464-
enablePaging: true,
465-
totalServerItems:'totalServerItems1',
466-
pagingOptions: $scope.pagingOptions1,
467-
showFooter: true,
468-
multiSelect: true,
469-
enableHighlighting: true,
470-
enableRowSelection: true,
471-
selectedItems:$scope.selectedRows,
472-
showFilter : true,
473-
enableColumnResize : true,
474-
showSelectionCheckbox: true,
475-
columnDefs: [
476-
{field: 'userName', displayName: 'User Name',width: '305px'},
477-
{field:'roleName', displayName:'Role',width: '160px'}
478-
]
479-
};
480-
357+
};
481358
});

‎survey/src/main/webapp/js/application/surveyCtrl.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ surveyModule.controller("surveyController", function($scope, $rootScope, $http,
99

1010
$http({
1111
method : "POST",
12-
url : baseUrl + "validateSuperAdmin",
12+
url : "/survey/survey/validateSuperAdmin",
1313
headers : {'Content-Type' : 'application/json'}
1414
}).then(function(response) {
1515
var JSONObject = response.data;
@@ -85,7 +85,7 @@ surveyModule.controller("surveyController", function($scope, $rootScope, $http,
8585

8686
$http({
8787
method : "POST",
88-
url : baseUrl + "addSurvey",
88+
url : "/survey/survey/addSurvey",
8989
data : JSON.stringify(dataObj),
9090
headers : {'Content-Type' : 'application/json'}
9191
}).then(function(response) {

0 commit comments

Comments
 (0)