Subversion Repositories SmartDukaan

Rev

Rev 27754 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27754 Rev 31483
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(document).on('click', ".create-api", function() {
2
	$(document).on('click', ".create-api", function() {
3
		loadCreateApi("main-content");
3
		loadCreateApi("main-content");
4
	});
4
	});
5
	
5
 
6
	$(document).on('click', ".create-api-button", function() {
6
	$(document).on('click', ".create-api-button", function() {
7
		var name = $('#apiName').val();
7
		var name = $('#apiName').val();
8
		var uri = $('#uri').val();
8
		var uri = $('#uri').val();
9
		var method = $('#api-methods option:selected').val();
9
		var method = $('#api-methods option:selected').val();
10
		createApi("main-content", name, uri, method);
10
		createApi("main-content", name, uri, method);
11
	});
11
	});
12
	
12
 
13
	$(document).on('click', ".edit-api", function() {
13
	$(document).on('click', ".edit-api", function() {
14
		loadEditApi("main-content");
14
		loadEditApi("main-content");
15
	});
15
	});
-
 
16
 
-
 
17
	$(document).on('click', ".addBrand", function() {
16
	
18
 
-
 
19
		doPostAjaxRequestHandler(context
-
 
20
			+ "/addBrands"
-
 
21
			, function(response) {
-
 
22
				console.log(response);
-
 
23
				if (response == 'true') {
-
 
24
					alert(success);
-
 
25
				}
-
 
26
			});
-
 
27
	});
17
	$(document).on('change', '#apis-for-edit', function(){
28
	$(document).on('change', '#apis-for-edit', function() {
18
		var apiText = $('#apis-for-edit option:selected').text();
29
		var apiText = $('#apis-for-edit option:selected').text();
19
		var apiTexts = apiText.split('[');
30
		var apiTexts = apiText.split('[');
20
		var name = apiTexts[0].trim();
31
		var name = apiTexts[0].trim();
21
		var uri = apiTexts[1].substring(0, apiTexts[1].length - 1);
32
		var uri = apiTexts[1].substring(0, apiTexts[1].length - 1);
22
		var method = apiTexts[2].substring(0, apiTexts[2].length - 1);
33
		var method = apiTexts[2].substring(0, apiTexts[2].length - 1);
23
		$('#apiName').val(name);
34
		$('#apiName').val(name);
24
		$('#uri').val(uri);
35
		$('#uri').val(uri);
25
		$('#api-methods').val(method);
36
		$('#api-methods').val(method);
26
		//$('#apiName').val(roleName);
37
		//$('#apiName').val(roleName);
27
	});
38
	});
28
	
39
 
29
	$(document).on('click', ".edit-api-button", function() {
40
	$(document).on('click', ".edit-api-button", function() {
30
		var apiId = $('#apis-for-edit').val();
41
		var apiId = $('#apis-for-edit').val();
31
		var apiName = $('#apiName').val();
42
		var apiName = $('#apiName').val();
32
		var uri = $('#uri').val();
43
		var uri = $('#uri').val();
33
		var method = $('#api-methods option:selected').text();
44
		var method = $('#api-methods option:selected').text();
34
		editApi("main-content", apiId, apiName, uri, method);
45
		editApi("main-content", apiId, apiName, uri, method);
35
	});
46
	});
36
	
47
 
37
	$(document).on('click', ".delete-api", function() {
48
	$(document).on('click', ".delete-api", function() {
38
		loadDeleteApi("main-content");
49
		loadDeleteApi("main-content");
39
	});
50
	});
40
	
51
 
41
	$(document).on('click', ".delete-api-button", function() {
52
	$(document).on('click', ".delete-api-button", function() {
42
		var apiId = $('#apis-for-delete').val();
53
		var apiId = $('#apis-for-delete').val();
43
		deleteApi("main-content", apiId);
54
		deleteApi("main-content", apiId);
44
	});
55
	});
45
	
56
 
46
	$(document).on('click', ".create-role", function() {
57
	$(document).on('click', ".create-role", function() {
47
		loadCreateRole("main-content");
58
		loadCreateRole("main-content");
48
	});
59
	});
49
	
60
 
50
	$(document).on('click', ".create-role-button", function() {
61
	$(document).on('click', ".create-role-button", function() {
51
		var roleName = $('#roleName').val();
62
		var roleName = $('#roleName').val();
52
		createRole("main-content", roleName);
63
		createRole("main-content", roleName);
53
	});
64
	});
54
	
65
 
55
	$(document).on('click', ".create-duplicate-role", function() {
66
	$(document).on('click', ".create-duplicate-role", function() {
56
		loadCreateDuplicateRole("main-content");
67
		loadCreateDuplicateRole("main-content");
57
	});
68
	});
58
	
69
 
59
	$(document).on('change', '#roles-for-duplicate', function(){
70
	$(document).on('change', '#roles-for-duplicate', function() {
60
		var roleName = $('#roles-for-duplicate option:selected').text();
71
		var roleName = $('#roles-for-duplicate option:selected').text();
61
		$('#roleName').val(roleName+"2");
72
		$('#roleName').val(roleName + "2");
62
	});
73
	});
63
	
74
 
64
	$(document).on('click', ".create-duplicate-role-button", function() {
75
	$(document).on('click', ".create-duplicate-role-button", function() {
65
		console.log("create duplicate role button clicked");
76
		console.log("create duplicate role button clicked");
66
		var roleId = $('#roles-for-duplicate').val();
77
		var roleId = $('#roles-for-duplicate').val();
67
		var roleName = $('#roleName').val();
78
		var roleName = $('#roleName').val();
68
		createDuplicateRole("main-content", roleId, roleName); 
79
		createDuplicateRole("main-content", roleId, roleName);
69
	});
80
	});
70
	
81
 
71
	$(document).on('click', ".delete-role", function() {
82
	$(document).on('click', ".delete-role", function() {
72
		loadDeleteRole("main-content");
83
		loadDeleteRole("main-content");
73
	});
84
	});
74
	
85
 
75
	$(document).on('click', ".delete-role-button", function() {
86
	$(document).on('click', ".delete-role-button", function() {
76
		var roleId = $('#roles-for-delete').val();
87
		var roleId = $('#roles-for-delete').val();
77
		deleteRole("main-content", roleId);
88
		deleteRole("main-content", roleId);
78
	});
89
	});
79
	
90
 
80
	$(document).on('click', ".rename-role", function() {
91
	$(document).on('click', ".rename-role", function() {
81
		loadRenameRole("main-content");
92
		loadRenameRole("main-content");
82
	});
93
	});
83
	
94
 
84
	$(document).on('change', '#roles-for-rename', function(){
95
	$(document).on('change', '#roles-for-rename', function() {
85
		var roleName = $('#roles-for-rename option:selected').text();
96
		var roleName = $('#roles-for-rename option:selected').text();
86
		$('#roleName').val(roleName);
97
		$('#roleName').val(roleName);
87
	});
98
	});
88
	
99
 
89
	$(document).on('click', ".rename-role-button", function() {
100
	$(document).on('click', ".rename-role-button", function() {
90
		var roleId = $('#roles-for-rename').val();
101
		var roleId = $('#roles-for-rename').val();
91
		var roleName = $('#roleName').val();
102
		var roleName = $('#roleName').val();
92
		renameRole("main-content", roleId, roleName);
103
		renameRole("main-content", roleId, roleName);
93
	});
104
	});
94
	
105
 
95
	$(document).on('click', ".add-remove-api", function() {
106
	$(document).on('click', ".add-remove-api", function() {
96
		loadAddRemoveApi("main-content");
107
		loadAddRemoveApi("main-content");
97
	});
108
	});
98
	
109
 
99
	$(document).on('click', ".add-remove-role", function() {
110
	$(document).on('click', ".add-remove-role", function() {
100
		loadAddRemoveRole("main-content");
111
		loadAddRemoveRole("main-content");
101
	});
112
	});
102
	
113
 
103
	$(document).on('change', '#api-roles', function(){
114
	$(document).on('change', '#api-roles', function() {
104
		//$('#tag-listing-brand-value').text($(this).text());
115
		//$('#tag-listing-brand-value').text($(this).text());
105
		loadApisByRoleId("apis-container", $(this).val());
116
		loadApisByRoleId("apis-container", $(this).val());
106
	});
117
	});
107
	
118
 
108
	$(document).on('click', ".add-remove-api-button", function() {
119
	$(document).on('click', ".add-remove-api-button", function() {
109
		var roleId = $('#api-roles').val();
120
		var roleId = $('#api-roles').val();
110
		var roleName = $('#api-roles option:selected').text();
121
		var roleName = $('#api-roles option:selected').text();
111
		var apiIds = $('#apis').val();
122
		var apiIds = $('#apis').val();
112
		addRemoveApis("main-content", roleId, apiIds);
123
		addRemoveApis("main-content", roleId, apiIds);
113
		//$('#api-roles option:selected').text(roleName);
124
		//$('#api-roles option:selected').text(roleName);
114
	});
125
	});
115
	
126
 
116
	$(document).on('click', ".add-remove-role-button", function() {
127
	$(document).on('click', ".add-remove-role-button", function() {
117
		var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
128
		var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
118
		var roleIds = $('#roles').val();
129
		var roleIds = $('#roles').val();
119
		addRemoveRoles("main-content", emailIdOrMobileNumber, roleIds);
130
		addRemoveRoles("main-content", emailIdOrMobileNumber, roleIds);
120
	});
131
	});
121
	
132
 
122
});
133
});
123
 
134
 
124
function getRolesByEmailIdOrMobileNumber(){
135
function getRolesByEmailIdOrMobileNumber() {
125
	var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
136
	var emailIdOrMobileNumber = $('#emailIdOrMobileNumber').val();
126
	console.log("emailIdOrMobileNumber = "+emailIdOrMobileNumber);
137
	console.log("emailIdOrMobileNumber = " + emailIdOrMobileNumber);
127
	if(emailIdOrMobileNumber != ""){
138
	if (emailIdOrMobileNumber != "") {
128
		loadRolesByEmailIdOrMobileNumber("roles-container", emailIdOrMobileNumber);
139
		loadRolesByEmailIdOrMobileNumber("roles-container", emailIdOrMobileNumber);
129
	}
140
	}
130
}
141
}
131
 
142
 
132
function loadCreateApi(domId){
143
function loadCreateApi(domId) {
133
	doGetAjaxRequestHandler(context+"/createApi", function(response){
144
	doGetAjaxRequestHandler(context + "/createApi", function(response) {
134
		$('#' + domId).html(response);
145
		$('#' + domId).html(response);
135
	});
146
	});
136
}
147
}
137
 
148
 
138
function loadEditApi(domId){
149
function loadEditApi(domId) {
139
	doGetAjaxRequestHandler(context+"/editApi", function(response){
150
	doGetAjaxRequestHandler(context + "/editApi", function(response) {
140
		$('#' + domId).html(response);
151
		$('#' + domId).html(response);
141
	});
152
	});
142
}
153
}
143
 
154
 
144
function loadDeleteApi(domId){
155
function loadDeleteApi(domId) {
145
	doGetAjaxRequestHandler(context+"/deleteApi", function(response){
156
	doGetAjaxRequestHandler(context + "/deleteApi", function(response) {
146
		$('#' + domId).html(response);
157
		$('#' + domId).html(response);
147
	});
158
	});
148
}
159
}
149
 
160
 
150
function loadCreateRole(domId){
161
function loadCreateRole(domId) {
151
	doGetAjaxRequestHandler(context+"/createRole", function(response){
162
	doGetAjaxRequestHandler(context + "/createRole", function(response) {
152
		$('#' + domId).html(response);
163
		$('#' + domId).html(response);
153
	});
164
	});
154
}
165
}
155
 
166
 
156
function loadCreateDuplicateRole(domId){
167
function loadCreateDuplicateRole(domId) {
157
	doGetAjaxRequestHandler(context+"/createDuplicateRole", function(response){
168
	doGetAjaxRequestHandler(context + "/createDuplicateRole", function(response) {
158
		$('#' + domId).html(response);
169
		$('#' + domId).html(response);
159
	});
170
	});
160
}
171
}
161
 
172
 
162
function loadDeleteRole(domId){
173
function loadDeleteRole(domId) {
163
	doGetAjaxRequestHandler(context+"/deleteRole", function(response){
174
	doGetAjaxRequestHandler(context + "/deleteRole", function(response) {
164
		$('#' + domId).html(response);
175
		$('#' + domId).html(response);
165
	});
176
	});
166
}
177
}
167
 
178
 
168
function loadRenameRole(domId){
179
function loadRenameRole(domId) {
169
	doGetAjaxRequestHandler(context+"/renameRole", function(response){
180
	doGetAjaxRequestHandler(context + "/renameRole", function(response) {
170
		$('#' + domId).html(response);
181
		$('#' + domId).html(response);
171
	});
182
	});
172
}
183
}
173
 
184
 
174
function loadAddRemoveApi(domId){
185
function loadAddRemoveApi(domId) {
175
	doGetAjaxRequestHandler(context+"/addRemoveApi", function(response){
186
	doGetAjaxRequestHandler(context + "/addRemoveApi", function(response) {
176
		$('#' + domId).html(response);
187
		$('#' + domId).html(response);
177
	});
188
	});
178
}
189
}
179
 
190
 
180
function loadAddRemoveRole(domId){
191
function loadAddRemoveRole(domId) {
181
	doGetAjaxRequestHandler(context+"/addRemoveRole", function(response){
192
	doGetAjaxRequestHandler(context + "/addRemoveRole", function(response) {
182
		$('#' + domId).html(response);
193
		$('#' + domId).html(response);
183
	});
194
	});
184
}
195
}
185
 
196
 
186
function loadApisByRoleId(domId, roleId){
197
function loadApisByRoleId(domId, roleId) {
187
	doGetAjaxRequestHandler(context+"/roleApis?roleId="+roleId, function(response){
198
	doGetAjaxRequestHandler(context + "/roleApis?roleId=" + roleId, function(response) {
188
		$('#' + domId).html(response);
199
		$('#' + domId).html(response);
189
		configureRoleApisDropDown();
200
		configureRoleApisDropDown();
190
	});
201
	});
191
}
202
}
192
 
203
 
193
function loadRolesByEmailIdOrMobileNumber(domId, emailIdOrMobileNumber){
204
function loadRolesByEmailIdOrMobileNumber(domId, emailIdOrMobileNumber) {
194
	doGetAjaxRequestHandler(context+"/userRoles?emailIdOrMobileNumber="+emailIdOrMobileNumber, function(response){
205
	doGetAjaxRequestHandler(context + "/userRoles?emailIdOrMobileNumber=" + emailIdOrMobileNumber, function(response) {
195
		$('#' + domId).html(response);
206
		$('#' + domId).html(response);
196
		configureUserRolesDropDown();
207
		configureUserRolesDropDown();
197
	});
208
	});
198
}
209
}
199
 
210
 
200
function configureApisForEditDropDown(){
211
function configureApisForEditDropDown() {
201
	$(document).ready(function() {
212
	$(document).ready(function() {
202
        $('#apis-for-edit').multiselect({
213
		$('#apis-for-edit').multiselect({
203
        		multiple:false,
214
			multiple: false,
204
	        	includeSelectAllOption: true,
215
			includeSelectAllOption: true,
205
	        	maxHeight: 200,
216
			maxHeight: 200,
206
	        	buttonWidth: '380px',
217
			buttonWidth: '380px',
207
	        	numberDisplayed: 1,
218
			numberDisplayed: 1,
208
	        	nonSelectedText: 'Apis',
219
			nonSelectedText: 'Apis',
209
	        	nSelectedText: ' - Apis Selected',
220
			nSelectedText: ' - Apis Selected',
210
	        	allSelectedText: 'All Apis Selected',
221
			allSelectedText: 'All Apis Selected',
211
	        	enableFiltering: true
222
			enableFiltering: true
212
        });
223
		});
213
    });
224
	});
214
}
225
}
215
 
226
 
216
function configureApisForDeleteDropDown(){
227
function configureApisForDeleteDropDown() {
217
	$(document).ready(function() {
228
	$(document).ready(function() {
218
        $('#apis-for-delete').multiselect({
229
		$('#apis-for-delete').multiselect({
219
        		multiple:false,
230
			multiple: false,
220
	        	includeSelectAllOption: true,
231
			includeSelectAllOption: true,
221
	        	maxHeight: 200,
232
			maxHeight: 200,
222
	        	buttonWidth: '800px',
233
			buttonWidth: '800px',
223
	        	numberDisplayed: 1,
234
			numberDisplayed: 1,
224
	        	nonSelectedText: 'Apis',
235
			nonSelectedText: 'Apis',
225
	        	nSelectedText: ' - Apis Selected',
236
			nSelectedText: ' - Apis Selected',
226
	        	allSelectedText: 'All Apis Selected',
237
			allSelectedText: 'All Apis Selected',
227
	        	enableFiltering: true
238
			enableFiltering: true
228
        });
239
		});
229
    });
240
	});
230
}
241
}
231
 
242
 
232
function configureUserRolesDropDown(){
243
function configureUserRolesDropDown() {
233
	$(document).ready(function() {
244
	$(document).ready(function() {
234
        $('#roles').multiselect({
245
		$('#roles').multiselect({
235
	        	includeSelectAllOption: true,
246
			includeSelectAllOption: true,
236
	        	maxHeight: 200,
247
			maxHeight: 200,
237
	        	buttonWidth: '280px',
248
			buttonWidth: '280px',
238
	        	numberDisplayed: 1,
249
			numberDisplayed: 1,
239
	        	nonSelectedText: 'Roles',
250
			nonSelectedText: 'Roles',
240
	        	nSelectedText: ' - Roles Selected',
251
			nSelectedText: ' - Roles Selected',
241
	        	allSelectedText: 'All Roles Selected',
252
			allSelectedText: 'All Roles Selected',
242
	        	enableFiltering: true
253
			enableFiltering: true
243
        });
254
		});
244
    });
255
	});
245
}
256
}
246
 
257
 
247
function configureRoleApisDropDown(){
258
function configureRoleApisDropDown() {
248
	$(document).ready(function() {
259
	$(document).ready(function() {
249
        $('#apis').multiselect({
260
		$('#apis').multiselect({
250
	        	includeSelectAllOption: true,
261
			includeSelectAllOption: true,
251
	        	maxHeight: 200,
262
			maxHeight: 200,
252
	        	buttonWidth: '800px',
263
			buttonWidth: '800px',
253
	        	numberDisplayed: 1,
264
			numberDisplayed: 1,
254
	        	nonSelectedText: 'Apis',
265
			nonSelectedText: 'Apis',
255
	        	nSelectedText: ' - Apis Selected',
266
			nSelectedText: ' - Apis Selected',
256
	        	allSelectedText: 'All Apis Selected',
267
			allSelectedText: 'All Apis Selected',
257
	        	enableFiltering: true
268
			enableFiltering: true
258
        });
269
		});
259
    });
270
	});
260
}
271
}
261
 
272
 
262
function createApi(domId, name, uri, method){
273
function createApi(domId, name, uri, method) {
263
	if(name == ""){
274
	if (name == "") {
264
		alert("Api name is required");
275
		alert("Api name is required");
265
		return;
276
		return;
266
	}
277
	}
267
	if(uri == ""){
278
	if (uri == "") {
268
		alert("Api uri is required");
279
		alert("Api uri is required");
269
		return;
280
		return;
270
	}
281
	}
271
	if(method == ""){
282
	if (method == "") {
272
		alert("Please choose api method");
283
		alert("Please choose api method");
273
		return;
284
		return;
274
	}
285
	}
275
	var params = {
286
	var params = {
276
			"name":name,
287
		"name": name,
277
			"uri":uri,
288
		"uri": uri,
278
			"method":method
289
		"method": method
279
		}
290
	}
280
	if(confirm("Are you sure you want to create Api!") == true){
291
	if (confirm("Are you sure you want to create Api!") == true) {
281
		doPostAjaxRequestWithParamsHandler(context+"/createApi", params, function(response){
292
		doPostAjaxRequestWithParamsHandler(context + "/createApi", params, function(response) {
282
			$('#' + domId).html(response);
293
			$('#' + domId).html(response);
283
		});
294
		});
284
	}
295
	}
285
}
296
}
286
 
297
 
287
function editApi(domId, apiId, name, uri, method){
298
function editApi(domId, apiId, name, uri, method) {
288
	if(confirm("Are you sure you want to update api!") == true){
299
	if (confirm("Are you sure you want to update api!") == true) {
289
		doPutAjaxRequestHandler(context+"/editApi?apiId="+apiId+"&name="+name+"&uri="+uri+"&method="+method, function(response){
300
		doPutAjaxRequestHandler(context + "/editApi?apiId=" + apiId + "&name=" + name + "&uri=" + uri + "&method=" + method, function(response) {
290
			$('#' + domId).html(response);
301
			$('#' + domId).html(response);
291
		});
302
		});
292
	}
303
	}
293
}
304
}
294
 
305
 
295
function deleteApi(domId, apiId){
306
function deleteApi(domId, apiId) {
296
	if(confirm("Are you sure you want to delete api!") == true){
307
	if (confirm("Are you sure you want to delete api!") == true) {
297
		doDeleteAjaxRequestHandler(context+"/deleteApi?apiId="+apiId, function(response){
308
		doDeleteAjaxRequestHandler(context + "/deleteApi?apiId=" + apiId, function(response) {
298
			$('#' + domId).html(response);
309
			$('#' + domId).html(response);
299
		});
310
		});
300
	}
311
	}
301
}
312
}
302
 
313
 
303
function createRole(domId, name){
314
function createRole(domId, name) {
304
	var params = {
315
	var params = {
305
			"name":name
316
		"name": name
306
		}
317
	}
307
	if(confirm("Are you sure you want to create Role!") == true){
318
	if (confirm("Are you sure you want to create Role!") == true) {
308
		doPostAjaxRequestWithParamsHandler(context+"/createRole", params, function(response){
319
		doPostAjaxRequestWithParamsHandler(context + "/createRole", params, function(response) {
309
			$('#' + domId).html(response);
320
			$('#' + domId).html(response);
310
		});
321
		});
311
	}
322
	}
312
}
323
}
313
 
324
 
314
function createDuplicateRole(domId, roleId, name){
325
function createDuplicateRole(domId, roleId, name) {
315
	var params = {
326
	var params = {
316
			"roleId":roleId,
327
		"roleId": roleId,
317
			"name":name
328
		"name": name
318
		}
329
	}
319
	if(confirm("Are you sure you want to create duplicate role!") == true){
330
	if (confirm("Are you sure you want to create duplicate role!") == true) {
320
		doPostAjaxRequestWithParamsHandler(context+"/createDuplicateRole", params, function(response){
331
		doPostAjaxRequestWithParamsHandler(context + "/createDuplicateRole", params, function(response) {
321
			$('#' + domId).html(response);
332
			$('#' + domId).html(response);
322
		});
333
		});
323
	}
334
	}
324
}
335
}
325
 
336
 
326
function deleteRole(domId, roleId){
337
function deleteRole(domId, roleId) {
327
	if(confirm("Are you sure you want to delete role!") == true){
338
	if (confirm("Are you sure you want to delete role!") == true) {
328
		doDeleteAjaxRequestHandler(context+"/deleteRole?roleId="+roleId, function(response){
339
		doDeleteAjaxRequestHandler(context + "/deleteRole?roleId=" + roleId, function(response) {
329
			$('#' + domId).html(response);
340
			$('#' + domId).html(response);
330
		});
341
		});
331
	}
342
	}
332
}
343
}
333
 
344
 
334
function renameRole(domId, roleId, name){
345
function renameRole(domId, roleId, name) {
335
	if(confirm("Are you sure you want to rename role!") == true){
346
	if (confirm("Are you sure you want to rename role!") == true) {
336
		doPutAjaxRequestHandler(context+"/renameRole?roleId="+roleId+"&name="+name, function(response){
347
		doPutAjaxRequestHandler(context + "/renameRole?roleId=" + roleId + "&name=" + name, function(response) {
337
			$('#' + domId).html(response);
348
			$('#' + domId).html(response);
338
		});
349
		});
339
	}
350
	}
340
}
351
}
341
 
352
 
342
function addRemoveApis(domId, roleId, apiIds){
353
function addRemoveApis(domId, roleId, apiIds) {
343
	if(confirm("Are you sure you want to add or remove apis!") == true){
354
	if (confirm("Are you sure you want to add or remove apis!") == true) {
344
		doPostAjaxRequestWithJsonHandler(context+"/addRemoveApis?roleId="+roleId, JSON.stringify(apiIds), function(response){
355
		doPostAjaxRequestWithJsonHandler(context + "/addRemoveApis?roleId=" + roleId, JSON.stringify(apiIds), function(response) {
345
			$('#' + domId).html(response);
356
			$('#' + domId).html(response);
346
			$('#api-roles').val(roleId);
357
			$('#api-roles').val(roleId);
347
			$('#api-roles').change();
358
			$('#api-roles').change();
348
		});
359
		});
349
	}
360
	}
350
}
361
}
351
 
362
 
352
function addRemoveRoles(domId, emailIdOrMobileNumber, roleIds){
363
function addRemoveRoles(domId, emailIdOrMobileNumber, roleIds) {
353
	if(confirm("Are you sure you want to add or remove roles!") == true){
364
	if (confirm("Are you sure you want to add or remove roles!") == true) {
354
		doPostAjaxRequestWithJsonHandler(context+"/addRemoveRoles?emailIdOrMobileNumber="+emailIdOrMobileNumber, JSON.stringify(roleIds), function(response){
365
		doPostAjaxRequestWithJsonHandler(context + "/addRemoveRoles?emailIdOrMobileNumber=" + emailIdOrMobileNumber, JSON.stringify(roleIds), function(response) {
355
			$('#' + domId).html(response);
366
			$('#' + domId).html(response);
356
			$('#emailIdOrMobileNumber').val(emailIdOrMobileNumber);
367
			$('#emailIdOrMobileNumber').val(emailIdOrMobileNumber);
357
			getRolesByEmailIdOrMobileNumber();
368
			getRolesByEmailIdOrMobileNumber();
358
		});
369
		});
359
	}
370
	}