Subversion Repositories SmartDukaan

Rev

Rev 27285 | Rev 27754 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 27285 Rev 27410
Line 1... Line 1...
1
var TEAM_ACTIVITY = [ "COMMUNICATION_OUT", "COMMUNICATION_INTERNAL",
1
var TEAM_ACTIVITY = ["COMMUNICATION_OUT", "COMMUNICATION_INTERNAL",
2
		"ESCALATED", "ASSIGNED", "CATEGORY_CHANGED" ];
2
	"ESCALATED", "ASSIGNED", "CATEGORY_CHANGED"];
3
$(function() {
3
$(function() {
4
 
4
 
5
	$(".create-ticket-category").live('click', function() {
5
	$(".create-ticket-category").live('click', function() {
6
		console.log("create ticket category clicked......");
6
		console.log("create ticket category clicked......");
7
		loadCreateCategory("main-content");
7
		loadCreateCategory("main-content");
8
	});
8
	});
9
	$(".create-region").live('click', function() {
9
	$(".create-region").live('click', function() {
10
		loadCreateRegion("main-content");
10
		loadCreateRegion("main-content");
11
	});
11
	});
12
	$("#manager-ticket-search-by-partner-name").live(
12
	$("#manager-ticket-search-by-partner-name").live(
13
			'click',
13
		'click',
14
			function() {
14
		function() {
15
				var searchContent = $(this).data('id');
15
			var searchContent = $(this).data('id');
16
				var searchValue = $("#typeaheadpartnername").val();
16
			var searchValue = $("#typeaheadpartnername").val();
17
				var searchType = $("#managersearchType").val();
17
			var searchType = $("#managersearchType").val();
18
				var managerTicketStatus = $("#managerTicketStatus").val();
18
			var managerTicketStatus = $("#managerTicketStatus").val();
19
				var managerTicketorderBy = $("#managerTicketorderBy").val();
19
			var managerTicketorderBy = $("#managerTicketorderBy").val();
20
				if (typeof (searchContent) == "undefined" || !searchContent) {
20
			if (typeof (searchContent) == "undefined" || !searchContent) {
21
					searchContent = "";
21
				searchContent = "";
22
				}
22
			}
23
 
23
 
24
				loadManagerTicket("main-content", managerTicketStatus,
24
			loadManagerTicket("main-content", managerTicketStatus,
25
						managerTicketorderBy, searchType, searchContent,
25
				managerTicketorderBy, searchType, searchContent,
26
						searchValue);
26
				searchValue);
27
 
27
 
28
			});
28
		});
29
	$("#retailer-details-search-button-by-ticketId").live(
29
	$("#retailer-details-search-button-by-ticketId").live(
30
			'click',
30
		'click',
31
			function() {
31
		function() {
32
				var searchContent = $("#search-by-ticketId").val();
32
			var searchContent = $("#search-by-ticketId").val();
33
				var searchType = $("#managersearchType").val();
33
			var searchType = $("#managersearchType").val();
34
				var managerTicketStatus = $("#managerTicketStatus").val();
34
			var managerTicketStatus = $("#managerTicketStatus").val();
35
				var managerTicketorderBy = $("#managerTicketorderBy").val();
35
			var managerTicketorderBy = $("#managerTicketorderBy").val();
36
				if (typeof (searchContent) == "undefined" || !searchContent) {
36
			if (typeof (searchContent) == "undefined" || !searchContent) {
37
					searchContent = "";
37
				searchContent = "";
38
				}
38
			}
39
				if (searchContent == "" || searchContent == undefined
39
			if (searchContent == "" || searchContent == undefined
40
						|| searchContent == null) {
40
				|| searchContent == null) {
41
					alert("Input field can't be empty");
41
				alert("Input field can't be empty");
42
					return false;
42
				return false;
43
				}
43
			}
44
				loadManagerTicket("main-content", managerTicketStatus,
44
			loadManagerTicket("main-content", managerTicketStatus,
45
						managerTicketorderBy, searchType, searchContent, null);
45
				managerTicketorderBy, searchType, searchContent, null);
46
 
46
 
47
			});
47
		});
48
	$("#assignee-ticket-search-by-partner-name").live(
48
	$("#assignee-ticket-search-by-partner-name").live(
49
			'click',
49
		'click',
50
			function() {
50
		function() {
51
				var searchContent = $(this).data('id');
51
			var searchContent = $(this).data('id');
52
				var searchValue = $("#typeaheadpartnernameforassignee").val();
52
			var searchValue = $("#typeaheadpartnernameforassignee").val();
53
				var searchType = $("#assigneesearchType").val();
53
			var searchType = $("#assigneesearchType").val();
54
				var ticketStatus = $("#ticketStatus").val();
54
			var ticketStatus = $("#ticketStatus").val();
55
				var ticketorderBy = $("#orderBy").val();
55
			var ticketorderBy = $("#orderBy").val();
56
				console.log(ticketStatus);
56
			console.log(ticketStatus);
57
				console.log(ticketorderBy);
57
			console.log(ticketorderBy);
58
				console.log(searchValue);
58
			console.log(searchValue);
59
				if (typeof (searchContent) == "undefined" || !searchContent) {
59
			if (typeof (searchContent) == "undefined" || !searchContent) {
60
					searchContent = "";
60
				searchContent = "";
61
				}
61
			}
62
 
62
 
63
				loadMyTicket("main-content", ticketStatus, ticketorderBy,
63
			loadMyTicket("main-content", ticketStatus, ticketorderBy,
64
						searchType, searchContent, searchValue);
64
				searchType, searchContent, searchValue);
65
 
65
 
66
			});
66
		});
67
	$("#assignee-retailer-details-search-button-by-ticketId").live(
67
	$("#assignee-retailer-details-search-button-by-ticketId").live(
68
			'click',
68
		'click',
69
			function() {
69
		function() {
70
				var searchContent = $("#assignee-search-by-ticketId").val();
70
			var searchContent = $("#assignee-search-by-ticketId").val();
71
				var searchType = $("#assigneesearchType").val();
71
			var searchType = $("#assigneesearchType").val();
72
				var ticketStatus = $("#ticketStatus").val();
72
			var ticketStatus = $("#ticketStatus").val();
73
				var ticketorderBy = $("#orderBy").val();
73
			var ticketorderBy = $("#orderBy").val();
74
				if (typeof (searchContent) == "undefined" || !searchContent) {
74
			if (typeof (searchContent) == "undefined" || !searchContent) {
75
					searchContent = "";
75
				searchContent = "";
76
				}
76
			}
77
				if (searchContent == "" || searchContent == undefined
77
			if (searchContent == "" || searchContent == undefined
78
						|| searchContent == null) {
78
				|| searchContent == null) {
79
					alert("Input field can't be empty");
79
				alert("Input field can't be empty");
80
					return false;
80
				return false;
81
				}
81
			}
82
				console.log(ticketStatus);
82
			console.log(ticketStatus);
83
				console.log(ticketorderBy);
83
			console.log(ticketorderBy);
84
				loadMyTicket("main-content", ticketStatus, ticketorderBy,
84
			loadMyTicket("main-content", ticketStatus, ticketorderBy,
85
						searchType, searchContent, null);
85
				searchType, searchContent, null);
86
 
86
 
87
			});
87
		});
88
 
88
 
89
	$("#ticket-last-activity").live('click', function() {
89
	$("#ticket-last-activity").live('click', function() {
90
		var ticketId = $(this).data('ticketid');
90
		var ticketId = $(this).data('ticketid');
91
		var activity = $(this).data('activity');
91
		var activity = $(this).data('activity');
92
		console.log(ticketId);
92
		console.log(ticketId);
Line 138... Line 138...
138
		}
138
		}
139
 
139
 
140
	});
140
	});
141
 
141
 
142
	$(".change-ticket-button")
142
	$(".change-ticket-button")
143
			.live(
143
		.live(
144
					'click',
144
			'click',
145
					function() {
145
			function() {
146
						var ticketId = $("#ticketId").val();
146
				var ticketId = $("#ticketId").val();
147
						var subCategory = $("#subCategory").val();
147
				var subCategory = $("#subCategory").val();
148
						var authUserId = $("#authUser").val();
148
				var authUserId = $("#authUser").val();
149
						var categoryId = $("#category").val();
149
				var categoryId = $("#category").val();
150
						console.log(ticketId);
150
				console.log(ticketId);
151
						if (subCategory == null || subCategory == ""
151
				if (subCategory == null || subCategory == ""
152
								|| subCategory == undefined) {
152
					|| subCategory == undefined) {
153
							alert("Choose appropriate subCategory");
153
					alert("Choose appropriate subCategory");
154
							return false;
154
					return false;
155
						}
155
				}
156
						console.log(authUserId);
156
				console.log(authUserId);
157
						if (confirm("Are you sure you want to change ticket!") == true) {
157
				if (confirm("Are you sure you want to change ticket!") == true) {
158
							changeTicket(ticketId, subCategory, authUserId,
158
					changeTicket(ticketId, subCategory, authUserId,
159
									categoryId);
159
						categoryId);
160
						}
160
				}
161
					});
161
			});
162
	$("#edit-ticket").live('click', function() {
162
	$("#edit-ticket").live('click', function() {
163
		var ticketId = $(this).data('ticketid1');
163
		var ticketId = $(this).data('ticketid1');
164
		loadEditTicket(ticketId);
164
		loadEditTicket(ticketId);
165
	});
165
	});
166
	$(".manager-ticket").live('click', function() {
166
	$(".manager-ticket").live('click', function() {
Line 186... Line 186...
186
	});
186
	});
187
	$("#close-ticket").live('click', function() {
187
	$("#close-ticket").live('click', function() {
188
		var ticketId = $(this).data('ticketid');
188
		var ticketId = $(this).data('ticketid');
189
		closeTicket(ticketId);
189
		closeTicket(ticketId);
190
	});
190
	});
-
 
191
 
-
 
192
	$('.partners').live('change', function() {
-
 
193
		console.log("Hello");
-
 
194
	});
191
	var documentIds = [];
195
	var documentIds = [];
192
	var count = 0;
196
	var count = 0;
193
 
197
 
194
	$(".submit-message-button").live(
198
	$(".submit-message-button").live(
195
			'click',
199
		'click',
196
			function() {
200
		function() {
197
				var message = $("#activityMessage").val();
201
			var message = $("#activityMessage").val();
198
				var internal = $("#internalCommunication").prop("checked");
202
			var internal = $("#internalCommunication").prop("checked");
199
				if (message == "" || message == null || message == undefined) {
203
			if (message == "" || message == null || message == undefined) {
200
					alert("message field can't be empty");
204
				alert("message field can't be empty");
201
					return false;
205
				return false;
202
				}
206
			}
203
				var ticketId = $("#ticketIdforactivity").val();
207
			var ticketId = $("#ticketIdforactivity").val();
204
				var assignee = $("#assigneeUser").val();
208
			var assignee = $("#assigneeUser").val();
205
				var roleType = $("#role").val();
209
			var roleType = $("#role").val();
206
				count = 0;
210
			count = 0;
207
				console.log(message, ticketId, assignee);
211
			console.log(message, ticketId, assignee);
208
 
212
 
209
				createActivity(message, ticketId, assignee, internal, roleType,
213
			createActivity(message, ticketId, assignee, internal, roleType,
210
						documentIds);
214
				documentIds);
211
			});
215
		});
212
 
216
 
213
	$(".uploadFile").live('click', function() {
217
	$(".uploadFile").live('click', function() {
214
		$("#file1").trigger('click');
218
		$("#file1").trigger('click');
215
	});
219
	});
216
 
220
 
217
	$("input[name=file1]")
221
	$("input[name=file1]")
218
			.live(
222
		.live(
219
					'change',
223
			'change',
220
					function(evt) {
224
			function(evt) {
221
						var output = [];
225
				var output = [];
222
						var fileBundle = [];
226
				var fileBundle = [];
223
						for (var i = 0, f; f = evt.target.files[i]; i++) {
227
				for (var i = 0, f; f = evt.target.files[i]; i++) {
224
							count++;
228
					count++;
225
							console.log(count);
229
					console.log(count);
226
							if (evt.target.files[i].size > 5000000) {
230
					if (evt.target.files[i].size > 5000000) {
227
								alert("Size should be less than 5MB");
231
						alert("Size should be less than 5MB");
228
								return false;
232
						return false;
229
							}
233
					}
230
 
234
 
231
							if (count > "5") {
235
					if (count > "5") {
232
								alert("five files send at a time");
236
						alert("five files send at a time");
233
								var lilength = $('.fileList li').size();
237
						var lilength = $('.fileList li').size();
234
								console.log(lilength);
238
						console.log(lilength);
235
								count = lilength;
239
						count = lilength;
236
								console.log(lilength)
240
						console.log(lilength)
237
								return false;
241
						return false;
238
							}
242
					}
239
 
243
 
240
							var file = evt.target.files[i];
244
					var file = evt.target.files[i];
241
							fileBundle.push(file);
245
					fileBundle.push(file);
242
							console.log(fileBundle);
246
					console.log(fileBundle);
243
 
247
 
244
							var removeLink = "<a class=\"removeFile\" href=\"#\" data-fileid=\""
248
					var removeLink = "<a class=\"removeFile\" href=\"#\" data-fileid=\""
245
									+ i + "\">Remove</a>";
249
						+ i + "\">Remove</a>";
246
 
250
 
247
							output.push("<li><strong>", file.name,
251
					output.push("<li><strong>", file.name,
248
									"</strong> - ", "&nbsp; &nbsp; ",
252
						"</strong> - ", "&nbsp; &nbsp; ",
249
									removeLink, "</li> ");
253
						removeLink, "</li> ");
250
 
254
 
251
						}
255
				}
252
 
256
 
253
						for (var j = 0; j < fileBundle.length; j++) {
257
				for (var j = 0; j < fileBundle.length; j++) {
254
							console.log(fileBundle[j])
258
					console.log(fileBundle[j])
255
							var url = context + '/document-upload';
259
					var url = context + '/document-upload';
256
							doAjaxUploadRequestHandler(
260
					doAjaxUploadRequestHandler(
257
									url,
261
						url,
258
									'POST',
262
						'POST',
259
									fileBundle[j],
263
						fileBundle[j],
260
									function(response) {
264
						function(response) {
261
										console.log(response);
265
							console.log(response);
262
										var documentId = response.response.document_id;
266
							var documentId = response.response.document_id;
263
										console.log("documentId : "
267
							console.log("documentId : "
264
												+ documentId);
268
								+ documentId);
265
										documentIds.push(documentId);
269
							documentIds.push(documentId);
266
 
270
 
267
									});
271
						});
268
 
272
 
269
						}
273
				}
270
						console.log(documentIds);
274
				console.log(documentIds);
271
						$(".fileList").append(output.join(""));
275
				$(".fileList").append(output.join(""));
272
 
276
 
273
					});
277
			});
274
 
278
 
275
	$(".removeFile").live('click', function(e) {
279
	$(".removeFile").live('click', function(e) {
276
		e.preventDefault();
280
		e.preventDefault();
277
		console.log("Hello")
281
		console.log("Hello")
278
		var fileId = $(this).parent().children("a").data("fileid");
282
		var fileId = $(this).parent().children("a").data("fileid");
Line 298... Line 302...
298
		 */
302
		 */
299
 
303
 
300
	});
304
	});
301
 
305
 
302
	$("#tickets-paginated .next").live(
306
	$("#tickets-paginated .next").live(
303
			'click',
307
		'click',
304
			function() {
308
		function() {
305
				var searchType = $("#assigneesearchType").val();
309
			var searchType = $("#assigneesearchType").val();
306
				var ticketStatus = $("#ticketStatus").val();
310
			var ticketStatus = $("#ticketStatus").val();
307
				var ticketStatus = $("#ticketStatus").val();
311
			var ticketStatus = $("#ticketStatus").val();
308
				var orderBy = $("#orderBy").val();
312
			var orderBy = $("#orderBy").val();
309
				var params;
313
			var params;
310
				if (searchType == "" || searchType == undefined
314
			if (searchType == "" || searchType == undefined
311
						|| searchType == null || searchType == "TICKET_ID") {
315
				|| searchType == null || searchType == "TICKET_ID") {
312
					params = {
316
				params = {
313
						"ticketStatus" : ticketStatus,
317
					"ticketStatus": ticketStatus,
314
						"orderby" : orderBy
318
					"orderby": orderBy
315
					};
319
				};
316
				} else {
320
			} else {
317
					var searchTerm = $("#assignee-partner-name-input").val();
321
				var searchTerm = $("#assignee-partner-name-input").val();
318
					console.log(searchTerm);
322
				console.log(searchTerm);
319
					params = {
323
				params = {
320
						"ticketStatus" : ticketStatus,
324
					"ticketStatus": ticketStatus,
321
						"orderby" : orderBy,
325
					"orderby": orderBy,
322
						"ticketSearchType" : searchType,
326
					"ticketSearchType": searchType,
323
						"searchTerm" : searchTerm
327
					"searchTerm": searchTerm
324
					};
328
				};
325
				}
329
			}
326
				loadPaginatedNextItems('/cs/myticketPaginated', params,
330
			loadPaginatedNextItems('/cs/myticketPaginated', params,
327
						'tickets-paginated', 'my-ticket-table',
331
				'tickets-paginated', 'my-ticket-table',
328
						'ticket-details-container');
332
				'ticket-details-container');
329
				$(this).blur();
333
			$(this).blur();
330
			});
334
		});
331
 
335
 
332
	$("#manager-tickets-paginated .previous").live(
336
	$("#manager-tickets-paginated .previous").live(
333
			'click',
337
		'click',
334
			function() {
338
		function() {
335
 
339
 
336
				var ticketStatus = $("#managerTicketStatus").val();
340
			var ticketStatus = $("#managerTicketStatus").val();
337
				var orderBy = $("#managerTicketorderBy").val();
341
			var orderBy = $("#managerTicketorderBy").val();
338
				var searchType = $("#managersearchType").val();
342
			var searchType = $("#managersearchType").val();
339
				var params;
343
			var params;
340
				if (searchType == "" || searchType == undefined
344
			if (searchType == "" || searchType == undefined
341
						|| searchType == null || searchType == "TICKET_ID") {
345
				|| searchType == null || searchType == "TICKET_ID") {
342
					params = {
346
				params = {
343
						"ticketStatus" : ticketStatus,
347
					"ticketStatus": ticketStatus,
344
						"orderby" : orderBy
348
					"orderby": orderBy
345
					};
349
				};
346
				} else {
350
			} else {
347
					var searchTerm = $("#partner-name-input").val();
351
				var searchTerm = $("#partner-name-input").val();
348
					console.log(searchTerm);
352
				console.log(searchTerm);
349
					params = {
353
				params = {
350
						"ticketStatus" : ticketStatus,
354
					"ticketStatus": ticketStatus,
351
						"orderby" : orderBy,
355
					"orderby": orderBy,
352
						"ticketSearchType" : searchType,
356
					"ticketSearchType": searchType,
353
						"searchTerm" : searchTerm
357
					"searchTerm": searchTerm
354
					};
358
				};
355
				}
359
			}
356
				loadPaginatedPreviousItems('/cs/managerTicket-paginated',
360
			loadPaginatedPreviousItems('/cs/managerTicket-paginated',
357
						params, 'manager-tickets-paginated',
361
				params, 'manager-tickets-paginated',
358
						'manager-ticket-table',
362
				'manager-ticket-table',
359
						'manager-ticket-details-container');
363
				'manager-ticket-details-container');
360
				$(this).blur();
364
			$(this).blur();
361
			});
365
		});
362
	$("#manager-tickets-paginated .next").live(
366
	$("#manager-tickets-paginated .next").live(
363
			'click',
367
		'click',
364
			function() {
368
		function() {
365
				var ticketStatus = $("#managerTicketStatus").val();
369
			var ticketStatus = $("#managerTicketStatus").val();
366
				var orderBy = $("#managerTicketorderBy").val();
370
			var orderBy = $("#managerTicketorderBy").val();
367
				var searchType = $("#managersearchType").val();
371
			var searchType = $("#managersearchType").val();
368
				var params;
372
			var params;
369
				if (searchType == "" || searchType == undefined
373
			if (searchType == "" || searchType == undefined
370
						|| searchType == null || searchType == "TICKET_ID") {
374
				|| searchType == null || searchType == "TICKET_ID") {
371
					params = {
375
				params = {
372
						"ticketStatus" : ticketStatus,
376
					"ticketStatus": ticketStatus,
373
						"orderby" : orderBy
377
					"orderby": orderBy
374
					};
378
				};
375
				} else {
379
			} else {
376
					var searchTerm = $("#partner-name-input").val();
380
				var searchTerm = $("#partner-name-input").val();
377
					console.log(searchTerm);
381
				console.log(searchTerm);
378
					params = {
382
				params = {
379
						"ticketStatus" : ticketStatus,
383
					"ticketStatus": ticketStatus,
380
						"orderby" : orderBy,
384
					"orderby": orderBy,
381
						"ticketSearchType" : searchType,
385
					"ticketSearchType": searchType,
382
						"searchTerm" : searchTerm
386
					"searchTerm": searchTerm
383
					};
387
				};
384
				}
388
			}
385
 
389
 
386
				loadPaginatedNextItems('/cs/managerTicket-paginated', params,
390
			loadPaginatedNextItems('/cs/managerTicket-paginated', params,
387
						'manager-tickets-paginated', 'manager-ticket-table',
391
				'manager-tickets-paginated', 'manager-ticket-table',
388
						'manager-ticket-details-container');
392
				'manager-ticket-details-container');
389
				$(this).blur();
393
			$(this).blur();
390
			});
394
		});
391
 
395
 
392
	$("#tickets-paginated .previous").live(
396
	$("#tickets-paginated .previous").live(
393
			'click',
397
		'click',
394
			function() {
398
		function() {
395
				var searchType = $("#assigneesearchType").val();
399
			var searchType = $("#assigneesearchType").val();
396
				var ticketStatus = $("#ticketStatus").val();
400
			var ticketStatus = $("#ticketStatus").val();
397
				var ticketStatus = $("#ticketStatus").val();
401
			var ticketStatus = $("#ticketStatus").val();
398
				var orderBy = $("#orderBy").val();
402
			var orderBy = $("#orderBy").val();
399
				var params;
403
			var params;
400
				if (searchType == "" || searchType == undefined
404
			if (searchType == "" || searchType == undefined
401
						|| searchType == null || searchType == "TICKET_ID") {
405
				|| searchType == null || searchType == "TICKET_ID") {
402
					params = {
406
				params = {
403
						"ticketStatus" : ticketStatus,
407
					"ticketStatus": ticketStatus,
404
						"orderby" : orderBy
408
					"orderby": orderBy
405
					};
409
				};
406
				} else {
410
			} else {
407
					var searchTerm = $("#assignee-partner-name-input").val();
411
				var searchTerm = $("#assignee-partner-name-input").val();
408
					console.log(searchTerm);
412
				console.log(searchTerm);
409
					params = {
413
				params = {
410
						"ticketStatus" : ticketStatus,
414
					"ticketStatus": ticketStatus,
411
						"orderby" : orderBy,
415
					"orderby": orderBy,
412
						"ticketSearchType" : searchType,
416
					"ticketSearchType": searchType,
413
						"searchTerm" : searchTerm
417
					"searchTerm": searchTerm
414
					};
418
				};
415
				}
419
			}
416
				loadPaginatedPreviousItems('/cs/myticketPaginated', params,
420
			loadPaginatedPreviousItems('/cs/myticketPaginated', params,
417
						'tickets-paginated', 'my-ticket-table',
421
				'tickets-paginated', 'my-ticket-table',
418
						'ticket-details-container');
422
				'ticket-details-container');
419
				$(this).blur();
423
			$(this).blur();
420
			});
424
		});
421
	$("#positions-paginated .next").live(
425
	$("#positions-paginated .next").live(
422
			'click',
426
		'click',
423
			function() {
427
		function() {
424
				loadPaginatedNextItems('/cs/position-paginated', null,
428
			loadPaginatedNextItems('/cs/position-paginated', null,
425
						'positions-paginated', 'position-table',
429
				'positions-paginated', 'position-table',
426
						'position-details-container');
430
				'position-details-container');
427
				$(this).blur();
431
			$(this).blur();
428
			});
432
		});
429
 
433
 
430
	$("#positions-paginated .previous").live(
434
	$("#positions-paginated .previous").live(
431
			'click',
435
		'click',
432
			function() {
436
		function() {
433
				loadPaginatedPreviousItems('/cs/position-paginated', null,
437
			loadPaginatedPreviousItems('/cs/position-paginated', null,
434
						'positions-paginated', 'position-table',
438
				'positions-paginated', 'position-table',
435
						'position-details-container');
439
				'position-details-container');
436
				$(this).blur();
440
			$(this).blur();
437
			});
441
		});
438
 
442
 
439
	$(".create-partner-region").live('click', function() {
443
	$(".create-partner-region").live('click', function() {
440
		loadCreatePartnerRegion("main-content");
444
		loadCreatePartnerRegion("main-content");
441
	});
445
	});
442
	$(".create-ticket").live('click', function() {
446
	$(".create-ticket").live('click', function() {
443
		loadCreateTicket("main-content");
447
		loadCreateTicket("main-content");
444
	});
448
	});
445
	$(".create-ticket-button")
449
	$(".create-ticket-button")
446
			.live(
450
		.live(
447
					'click',
451
			'click',
448
					function() {
452
			function() {
449
						var categoryId = $('#category').val();
453
				var categoryId = $('#category').val();
450
						var subCategoryId = $('#subCategory').val();
454
				var subCategoryId = $('#subCategory').val();
451
						if (categoryId == "" || categoryId == null
455
				if (categoryId == "" || categoryId == null
452
								|| categoryId == undefined) {
456
					|| categoryId == undefined) {
453
							alert("select appropriate category");
457
					alert("select appropriate category");
454
							return false;
458
					return false;
455
						}
459
				}
456
						if (subCategoryId == "" || subCategoryId == null
460
				if (subCategoryId == "" || subCategoryId == null
457
								|| subCategoryId == undefined) {
461
					|| subCategoryId == undefined) {
458
							alert("select appropriate subCategoryId");
462
					alert("select appropriate subCategoryId");
459
							return false;
463
					return false;
460
						}
464
				}
461
						var dialog = bootbox
465
				var dialog = bootbox
462
								.dialog({
466
					.dialog({
463
									title : "Are you sure want to change create ticket!",
467
						title: "Are you sure want to change create ticket!",
464
									message : "<div class=form-inline'>"
468
						message: "<div class=form-inline'>"
465
											+ "<label for='message'>Message:</label>"
469
							+ "<label for='message'>Message:</label>"
466
											+ "<textarea class='form-control' rows='2' id='message'></textarea>"
470
							+ "<textarea class='form-control' rows='2' id='message'></textarea>"
467
											+ "</div>",
471
							+ "</div>",
468
									buttons : {
472
						buttons: {
469
										cancel : {
473
							cancel: {
470
											label : "cancel",
474
								label: "cancel",
471
											className : 'btn-danger',
475
								className: 'btn-danger',
-
 
476
								callback: function() {
-
 
477
									loadCreateTicket("main-content");
-
 
478
								}
-
 
479
							},
-
 
480
							ok: {
-
 
481
								label: "ok",
-
 
482
								className: 'btn-info',
472
											callback : function() {
483
								callback: function() {
-
 
484
									message = $('#message').val();
-
 
485
									console.log(message);
-
 
486
									if (message == ""
-
 
487
										|| message == null
-
 
488
										|| message == undefined) {
-
 
489
										alert("message field can't be empty");
-
 
490
										return false;
-
 
491
									}
-
 
492
									var params = {
-
 
493
										"categoryId": categoryId,
-
 
494
										"subCategoryId": subCategoryId,
-
 
495
										"message": message
-
 
496
									}
-
 
497
									doPostAjaxRequestWithParamsHandler(
-
 
498
										context
-
 
499
										+ "/cs/createTicket",
-
 
500
										params,
-
 
501
										function(response) {
-
 
502
											if (response == "true") {
-
 
503
												alert("successfully created");
473
												loadCreateTicket("main-content");
504
												loadCreateTicket("main-content");
-
 
505
											} else {
-
 
506
												alert("You have reached maximum number of tickets Resolved , pls click on Resolved for the resolved tickets to create new.");
474
											}
507
											}
475
										},
508
										});
476
										ok : {
-
 
477
											label : "ok",
-
 
478
											className : 'btn-info',
-
 
479
											callback : function() {
-
 
480
												message = $('#message').val();
-
 
481
												console.log(message);
-
 
482
												if (message == ""
-
 
483
														|| message == null
-
 
484
														|| message == undefined) {
-
 
485
													alert("message field can't be empty");
-
 
486
													return false;
-
 
487
												}
-
 
488
												var params = {
-
 
489
													"categoryId" : categoryId,
-
 
490
													"subCategoryId" : subCategoryId,
-
 
491
													"message" : message
-
 
492
												}
-
 
493
												doPostAjaxRequestWithParamsHandler(
-
 
494
														context
-
 
495
																+ "/cs/createTicket",
-
 
496
														params,
-
 
497
														function(response) {
-
 
498
															if (response == "true") {
-
 
499
																alert("successfully created");
-
 
500
																loadCreateTicket("main-content");
-
 
501
															} else {
-
 
502
																alert("You have reached maximum number of tickets Resolved , pls click on Resolved for the resolved tickets to create new.");
-
 
503
															}
-
 
504
														});
-
 
505
 
-
 
506
											}
-
 
507
										}
-
 
508
									}
-
 
509
								});
-
 
510
 
509
 
-
 
510
								}
-
 
511
							}
-
 
512
						}
511
					});
513
					});
-
 
514
 
-
 
515
			});
512
	$(".create-position").live('click', function() {
516
	$(".create-position").live('click', function() {
513
		loadCreatePosition("main-content");
517
		loadCreatePosition("main-content");
514
	});
518
	});
515
 
519
 
-
 
520
	$(".positionPartnerView").live('click', function() {
-
 
521
		$clickedElement = $(this);
-
 
522
		var positionId = $clickedElement.data("positionid");
-
 
523
		$tdElement = $(this).closest('td');
-
 
524
		doGetAjaxRequestHandler(context + "/cs/getPosition?positionId=" + positionId, function(response) {
-
 
525
			
-
 
526
			$tdElement.html(response);
-
 
527
			$tdElement.find('.partners').multiselect({
-
 
528
				includeSelectAllOption: true,
-
 
529
				multiple: true,
-
 
530
				maxHeight: 200,
-
 
531
				buttonWidth: '180px',
-
 
532
				numberDisplayed: 1,
-
 
533
				nonSelectedText: 'Partners',
-
 
534
				nSelectedText: ' - Users Selected',
-
 
535
				allSelectedText: 'All Users Selected',
-
 
536
				enableFiltering: true,
-
 
537
				enableCaseInsensitiveFiltering: true
-
 
538
			});
-
 
539
		});
-
 
540
	});
-
 
541
 
-
 
542
 
516
	$("#ticketStatus").live(
543
	$("#ticketStatus").live(
517
			'change',
544
		'change',
518
			function() {
545
		function() {
519
				var ticketStatus = $("#ticketStatus").val();
546
			var ticketStatus = $("#ticketStatus").val();
520
				var orderBy = $("#orderBy").val();
547
			var orderBy = $("#orderBy").val();
521
				var searchType = $("#assigneesearchType").val();
548
			var searchType = $("#assigneesearchType").val();
522
				if (searchType == "" || searchType == undefined
549
			if (searchType == "" || searchType == undefined
523
						|| searchType == null) {
550
				|| searchType == null) {
524
					loadMyTicket("main-content", ticketStatus, orderBy, null,
551
				loadMyTicket("main-content", ticketStatus, orderBy, null,
525
							null, null);
552
					null, null);
-
 
553
			} else {
-
 
554
				if (searchType == "PARTNER_NAME") {
-
 
555
					var searchTerm = $("#assignee-partner-name-input")
-
 
556
						.val();
-
 
557
					var searchValue = $("#typeaheadpartnernameforassignee")
-
 
558
						.val();
-
 
559
					loadMyTicket("main-content", ticketStatus, orderBy,
-
 
560
						searchType, searchTerm, searchValue);
526
				} else {
561
				} else {
527
					if (searchType == "PARTNER_NAME") {
-
 
528
						var searchTerm = $("#assignee-partner-name-input")
-
 
529
								.val();
-
 
530
						var searchValue = $("#typeaheadpartnernameforassignee")
-
 
531
								.val();
-
 
532
						loadMyTicket("main-content", ticketStatus, orderBy,
-
 
533
								searchType, searchTerm, searchValue);
-
 
534
					} else {
-
 
535
						var searchTerm = $("#assignee-search-by-ticketId")
562
					var searchTerm = $("#assignee-search-by-ticketId")
536
								.val();
563
						.val();
537
						loadMyTicket("main-content", ticketStatus, orderBy,
564
					loadMyTicket("main-content", ticketStatus, orderBy,
538
								searchType, searchTerm, null);
565
						searchType, searchTerm, null);
539
					}
-
 
540
				}
566
				}
-
 
567
			}
541
			});
568
		});
542
	$("#orderBy").live(
569
	$("#orderBy").live(
543
			'change',
570
		'change',
544
			function() {
571
		function() {
545
				var ticketStatus = $("#ticketStatus").val();
572
			var ticketStatus = $("#ticketStatus").val();
546
				var orderBy = $("#orderBy").val();
573
			var orderBy = $("#orderBy").val();
547
				var searchType = $("#assigneesearchType").val();
574
			var searchType = $("#assigneesearchType").val();
548
				if (searchType == "" || searchType == undefined
575
			if (searchType == "" || searchType == undefined
549
						|| searchType == null) {
576
				|| searchType == null) {
550
					loadMyTicket("main-content", ticketStatus, orderBy, null,
577
				loadMyTicket("main-content", ticketStatus, orderBy, null,
551
							null, null);
578
					null, null);
-
 
579
			} else {
-
 
580
				if (searchType == "PARTNER_NAME") {
-
 
581
					var searchTerm = $("#assignee-partner-name-input")
-
 
582
						.val();
-
 
583
					var searchValue = $("#typeaheadpartnernameforassignee")
-
 
584
						.val();
-
 
585
					loadMyTicket("main-content", ticketStatus, orderBy,
-
 
586
						searchType, searchTerm, searchValue);
552
				} else {
587
				} else {
553
					if (searchType == "PARTNER_NAME") {
-
 
554
						var searchTerm = $("#assignee-partner-name-input")
-
 
555
								.val();
-
 
556
						var searchValue = $("#typeaheadpartnernameforassignee")
-
 
557
								.val();
-
 
558
						loadMyTicket("main-content", ticketStatus, orderBy,
-
 
559
								searchType, searchTerm, searchValue);
-
 
560
					} else {
-
 
561
						var searchTerm = $("#assignee-search-by-ticketId")
588
					var searchTerm = $("#assignee-search-by-ticketId")
562
								.val();
589
						.val();
563
						loadMyTicket("main-content", ticketStatus, orderBy,
590
					loadMyTicket("main-content", ticketStatus, orderBy,
564
								searchType, searchTerm, null);
591
						searchType, searchTerm, null);
565
					}
-
 
566
				}
592
				}
-
 
593
			}
567
			});
594
		});
568
	$("#managerTicketStatus").live(
595
	$("#managerTicketStatus").live(
569
			'change',
596
		'change',
570
			function() {
597
		function() {
571
				var ticketStatus = $("#managerTicketStatus").val();
598
			var ticketStatus = $("#managerTicketStatus").val();
572
				var orderBy = $("#managerTicketorderBy").val();
599
			var orderBy = $("#managerTicketorderBy").val();
573
				var searchType = $("#managersearchType").val();
600
			var searchType = $("#managersearchType").val();
574
				if (searchType == "" || searchType == undefined
601
			if (searchType == "" || searchType == undefined
575
						|| searchType == null) {
602
				|| searchType == null) {
576
					loadManagerTicket("main-content", ticketStatus, orderBy,
603
				loadManagerTicket("main-content", ticketStatus, orderBy,
577
							null, null, null);
604
					null, null, null);
-
 
605
			} else {
-
 
606
				if (searchType == "PARTNER_NAME") {
-
 
607
					var searchTerm = $("#partner-name-input").val();
-
 
608
					var searchValue = $("#typeaheadpartnername").val();
-
 
609
					loadManagerTicket("main-content", ticketStatus,
-
 
610
						orderBy, searchType, searchTerm, searchValue);
578
				} else {
611
				} else {
579
					if (searchType == "PARTNER_NAME") {
-
 
580
						var searchTerm = $("#partner-name-input").val();
-
 
581
						var searchValue = $("#typeaheadpartnername").val();
-
 
582
						loadManagerTicket("main-content", ticketStatus,
-
 
583
								orderBy, searchType, searchTerm, searchValue);
-
 
584
					} else {
-
 
585
						var searchTerm = $("#search-by-ticketId").val();
612
					var searchTerm = $("#search-by-ticketId").val();
586
						loadManagerTicket("main-content", ticketStatus,
613
					loadManagerTicket("main-content", ticketStatus,
587
								orderBy, searchType, searchTerm, null);
614
						orderBy, searchType, searchTerm, null);
588
					}
-
 
589
				}
615
				}
-
 
616
			}
590
 
617
 
591
			});
618
		});
592
	$("#managerTicketorderBy").live(
619
	$("#managerTicketorderBy").live(
593
			'change',
620
		'change',
594
			function() {
621
		function() {
595
				var ticketStatus = $("#managerTicketStatus").val();
622
			var ticketStatus = $("#managerTicketStatus").val();
596
				var orderBy = $("#managerTicketorderBy").val();
623
			var orderBy = $("#managerTicketorderBy").val();
597
				var searchType = $("#managersearchType").val();
624
			var searchType = $("#managersearchType").val();
598
				var searchType = $("#managersearchType").val();
625
			var searchType = $("#managersearchType").val();
599
				if (searchType == "" || searchType == undefined
626
			if (searchType == "" || searchType == undefined
600
						|| searchType == null) {
627
				|| searchType == null) {
601
					loadManagerTicket("main-content", ticketStatus, orderBy,
628
				loadManagerTicket("main-content", ticketStatus, orderBy,
602
							null, null, null);
629
					null, null, null);
-
 
630
			} else {
-
 
631
				if (searchType == "PARTNER_NAME") {
-
 
632
					var searchTerm = $("#partner-name-input").val();
-
 
633
					var searchValue = $("#typeaheadpartnername").val();
-
 
634
					loadManagerTicket("main-content", ticketStatus,
-
 
635
						orderBy, searchType, searchTerm, searchValue);
603
				} else {
636
				} else {
604
					if (searchType == "PARTNER_NAME") {
-
 
605
						var searchTerm = $("#partner-name-input").val();
-
 
606
						var searchValue = $("#typeaheadpartnername").val();
-
 
607
						loadManagerTicket("main-content", ticketStatus,
-
 
608
								orderBy, searchType, searchTerm, searchValue);
-
 
609
					} else {
-
 
610
						var searchTerm = $("#search-by-ticketId").val();
637
					var searchTerm = $("#search-by-ticketId").val();
611
						loadManagerTicket("main-content", ticketStatus,
638
					loadManagerTicket("main-content", ticketStatus,
612
								orderBy, searchType, searchTerm, null);
639
						orderBy, searchType, searchTerm, null);
613
					}
-
 
614
				}
640
				}
-
 
641
			}
615
 
642
 
616
			});
643
		});
617
	$("#category").live('change', function() {
644
	$("#category").live('change', function() {
618
		var categoryId = $("#category").val();
645
		var categoryId = $("#category").val();
619
		$("#auth-user-for-category").hide();
646
		$("#auth-user-for-category").hide();
620
		loadSubCategories(categoryId);
647
		loadSubCategories(categoryId);
621
	});
648
	});
622
	$(".create-ticket-category-button")
649
	$(".create-ticket-category-button")
623
			.live(
650
		.live(
624
					'click',
651
			'click',
625
					function() {
652
			function() {
626
						console
653
				console
627
								.log("create-ticket-category-button clicked......");
654
					.log("create-ticket-category-button clicked......");
628
						var name = $("#categoryName").val();
655
				var name = $("#categoryName").val();
629
						var description = $("#categorydescription").val();
656
				var description = $("#categorydescription").val();
630
						console.log(name, description);
657
				console.log(name, description);
631
						if (name == "" || name == null || name == undefined) {
658
				if (name == "" || name == null || name == undefined) {
632
							alert("Name field can't be empty");
659
					alert("Name field can't be empty");
633
							return false;
660
					return false;
634
						}
661
				}
635
						if (description == "" || description == null
662
				if (description == "" || description == null
636
								|| description == undefined) {
663
					|| description == undefined) {
637
							alert("Description field can't be empty");
664
					alert("Description field can't be empty");
638
							return false;
665
					return false;
639
						}
666
				}
640
						if (confirm("Are you sure you want to create ticket category!") == true) {
667
				if (confirm("Are you sure you want to create ticket category!") == true) {
641
							createCategory("main-content", name, description);
668
					createCategory("main-content", name, description);
642
						}
669
				}
643
					});
670
			});
644
	$(".create-region-button")
671
	$(".create-region-button")
645
			.live(
672
		.live(
646
					'click',
673
			'click',
647
					function() {
674
			function() {
648
						var name = $("#regionName").val();
675
				var name = $("#regionName").val();
649
						var description = $("#regiondescription").val();
676
				var description = $("#regiondescription").val();
650
						if (name == "" || name == null || name == undefined) {
677
				if (name == "" || name == null || name == undefined) {
651
							alert("Name field can't be empty");
678
					alert("Name field can't be empty");
652
							return false;
679
					return false;
653
						}
680
				}
654
						if (description == "" || description == null
681
				if (description == "" || description == null
655
								|| description == undefined) {
682
					|| description == undefined) {
656
							alert("Description field can't be empty");
683
					alert("Description field can't be empty");
657
							return false;
684
					return false;
658
						}
685
				}
659
						if (confirm("Are you sure you want to create region!") == true) {
686
				if (confirm("Are you sure you want to create region!") == true) {
660
							createRegion("main-content", name, description);
687
					createRegion("main-content", name, description);
661
						}
688
				}
662
					});
689
			});
663
 
690
 
664
	$(".create-partner-region-button")
691
	$(".create-partner-region-button")
665
			.live(
692
		.live(
666
					'click',
693
			'click',
667
					function() {
694
			function() {
668
 
695
 
669
						var regionId = $("#region").val();
696
				var regionId = $("#region").val();
670
						var fofoIds = $("#partner").val();
697
				var fofoIds = $("#partner").val();
671
						console.log(regionId, fofoIds);
698
				console.log(regionId, fofoIds);
672
						if (regionId == "" || regionId == null
699
				if (regionId == "" || regionId == null
673
								|| regionId == undefined) {
700
					|| regionId == undefined) {
674
							alert("regionId field can't be empty");
701
					alert("regionId field can't be empty");
675
							return false;
702
					return false;
676
						}
703
				}
677
						if (fofoIds == "" || fofoIds == null
704
				if (fofoIds == "" || fofoIds == null
678
								|| fofoIds == undefined) {
705
					|| fofoIds == undefined) {
679
							alert("select appropriate partner");
706
					alert("select appropriate partner");
680
							return false;
707
					return false;
681
						}
708
				}
682
						if (confirm("Are you sure you want to create partner region!") == true) {
709
				if (confirm("Are you sure you want to create partner region!") == true) {
683
							createPartnerRegion("main-content", regionId,
710
					createPartnerRegion("main-content", regionId,
684
									fofoIds);
711
						fofoIds);
685
						}
712
				}
686
					});
713
			});
687
	$(".create-position-button")
714
	$(".create-position-button")
688
			.live(
715
		.live(
689
					'click',
716
			'click',
690
					function() {
717
			function() {
691
 
-
 
692
						var authUser = $("#authUser").val();
-
 
693
						var ticketCategoryPosition = $(
-
 
694
								"#ticketCategoryPosition").val();
-
 
695
						var escalationType = $("#escalationType").val();
-
 
696
						var regionPosition = $("#regionPosition").val();
-
 
697
						var fofoIds = $("#partner").val();
-
 
698
						if (fofoIds.includes("0")) {
-
 
699
							fofoIds = [ 0 ];
-
 
700
							console.log(fofoIds);
-
 
701
						} else {
-
 
702
							console.log(fofoIds);
-
 
703
						}
-
 
704
						console.log(authUser, ticketCategoryPosition,
-
 
705
								escalationType, regionPosition);
-
 
706
						if (authUser == "" || authUser == null
-
 
707
								|| authUser == undefined) {
-
 
708
							alert("select appropriate authUser");
-
 
709
							return false;
-
 
710
						}
-
 
711
						if (ticketCategoryPosition == ""
-
 
712
								|| ticketCategoryPosition == null
-
 
713
								|| ticketCategoryPosition == undefined) {
-
 
714
							alert("select appropriate category");
-
 
715
							return false;
-
 
716
						}
-
 
717
						if (escalationType == "" || escalationType == null
-
 
718
								|| escalationType == undefined) {
-
 
719
							alert("select appropriate escalationType");
-
 
720
							return false;
-
 
721
						}
-
 
722
						if (regionPosition == "" || regionPosition == null
-
 
723
								|| regionPosition == undefined) {
-
 
724
							alert("select appropriate Region");
-
 
725
							return false;
-
 
726
						}
-
 
727
 
718
 
-
 
719
				var authUser = $("#authUser").val();
-
 
720
				var ticketCategoryPosition = $(
-
 
721
					"#ticketCategoryPosition").val();
-
 
722
				var escalationType = $("#escalationType").val();
728
						if (confirm("Are you sure you want to create Position!") == true) {
723
				var regionPosition = $("#regionPosition").val();
-
 
724
				var fofoIds = $("#partner").val();
-
 
725
				if (fofoIds.includes("0")) {
-
 
726
					fofoIds = [0];
-
 
727
					console.log(fofoIds);
-
 
728
				} else {
-
 
729
					console.log(fofoIds);
-
 
730
				}
-
 
731
				console.log(authUser, ticketCategoryPosition,
-
 
732
					escalationType, regionPosition);
-
 
733
				if (authUser == "" || authUser == null
-
 
734
					|| authUser == undefined) {
729
							createPosition("main-content", authUser,
735
					alert("select appropriate authUser");
-
 
736
					return false;
-
 
737
				}
-
 
738
				if (ticketCategoryPosition == ""
-
 
739
					|| ticketCategoryPosition == null
730
									ticketCategoryPosition, escalationType,
740
					|| ticketCategoryPosition == undefined) {
-
 
741
					alert("select appropriate category");
-
 
742
					return false;
-
 
743
				}
-
 
744
				if (escalationType == "" || escalationType == null
-
 
745
					|| escalationType == undefined) {
-
 
746
					alert("select appropriate escalationType");
-
 
747
					return false;
-
 
748
				}
-
 
749
				if (regionPosition == "" || regionPosition == null
731
									regionPosition, fofoIds);
750
					|| regionPosition == undefined) {
-
 
751
					alert("select appropriate Region");
-
 
752
					return false;
732
						}
753
				}
733
 
754
 
-
 
755
				if (confirm("Are you sure you want to create Position!") == true) {
-
 
756
					createPosition("main-content", authUser,
-
 
757
						ticketCategoryPosition, escalationType,
-
 
758
						regionPosition, fofoIds);
-
 
759
				}
-
 
760
 
734
					});
761
			});
735
 
762
 
736
	$("#ticketCategory").live('change', function() {
763
	$("#ticketCategory").live('change', function() {
737
		console.log("change ticket category clicked......");
764
		console.log("change ticket category clicked......");
738
		var ticketCategoryId = $(this).val();
765
		var ticketCategoryId = $(this).val();
739
		console.log(ticketCategoryId);
766
		console.log(ticketCategoryId);
Line 743... Line 770...
743
		console.log("create ticket category clicked......");
770
		console.log("create ticket category clicked......");
744
		loadCreateSubCategory("main-content");
771
		loadCreateSubCategory("main-content");
745
	});
772
	});
746
 
773
 
747
	$(".create-ticket-sub-category-button")
774
	$(".create-ticket-sub-category-button")
748
			.live(
775
		.live(
749
					'click',
776
			'click',
750
					function() {
777
			function() {
751
						console
778
				console
752
								.log("create-ticket-category-button clicked......");
779
					.log("create-ticket-category-button clicked......");
753
						var name = $("#subcategoryName").val();
780
				var name = $("#subcategoryName").val();
754
						var description = $("#subcategorydescription").val();
781
				var description = $("#subcategorydescription").val();
755
						var ticketCategoryId = $("#ticketCategory").val();
782
				var ticketCategoryId = $("#ticketCategory").val();
756
						console.log(name, description);
783
				console.log(name, description);
757
						if (name == "" || name == null || name == undefined) {
784
				if (name == "" || name == null || name == undefined) {
758
							alert("Name field can't be empty");
785
					alert("Name field can't be empty");
759
							return false;
786
					return false;
760
						}
787
				}
761
						if (description == "" || description == null
788
				if (description == "" || description == null
762
								|| description == undefined) {
789
					|| description == undefined) {
763
							alert("Description field can't be empty");
790
					alert("Description field can't be empty");
764
							return false;
791
					return false;
765
						}
792
				}
766
						if (ticketCategoryId == "" || ticketCategoryId == null
793
				if (ticketCategoryId == "" || ticketCategoryId == null
767
								|| ticketCategoryId == undefined) {
794
					|| ticketCategoryId == undefined) {
768
							alert("select appropriate category name");
795
					alert("select appropriate category name");
769
							return false;
796
					return false;
770
						}
797
				}
771
						if (confirm("Are you sure you want to create ticket category!") == true) {
798
				if (confirm("Are you sure you want to create ticket category!") == true) {
772
							createSubCategory("main-content", name,
799
					createSubCategory("main-content", name,
773
									description, ticketCategoryId);
800
						description, ticketCategoryId);
774
						}
801
				}
775
					});
802
			});
776
	$(".remove-position").live('click', function() {
803
	$(".remove-position").live('click', function() {
777
		var positionId = $(this).data('positionid');
804
		var positionId = $(this).data('positionid');
778
		if (confirm("Are you sure you want to remove position!") == true) {
805
		if (confirm("Are you sure you want to remove position!") == true) {
779
			removePosition(positionId);
806
			removePosition(positionId);
780
		}
807
		}
781
	});
808
	});
782
 
809
 
783
	$(".update-position")
810
	$(".update-position")
784
			.live(
811
		.live(
785
					'click',
812
			'click',
786
					function() {
813
			function() {
787
						var positionId = $(this).data('positionid');
814
				var positionId = $(this).data('positionid');
788
						var regionId = $(this).data('regionid');
815
				var regionId = $(this).data('regionid');
789
 
-
 
790
						var row = $(this);
816
		        var row = $(this);
791
						var selectedFofoIds = $(this).closest("tr").find(
817
				var selectedFofoIds = $(this).closest("tr").find(
792
								'#partners ').val();
818
					'#partners').val();
793
						if (selectedFofoIds.includes("0")) {
819
				if (selectedFofoIds.includes("0")) {
794
							selectedFofoIds = [ 0 ];
820
					selectedFofoIds = [0];
795
							console.log(selectedFofoIds);
821
					console.log(selectedFofoIds);
796
						} else {
822
				} else {
797
							console.log(selectedFofoIds);
823
					console.log(selectedFofoIds);
798
						}
824
				}
799
						if (confirm("Are you sure you want to update the partners!") == true) {
825
				if (confirm("Are you sure you want to update the partners!") == true) {
800
							doPostAjaxRequestWithJsonHandler(context
826
					doPostAjaxRequestWithJsonHandler(context
801
									+ "/cs/updatePartnerPosition?regionId="
827
						+ "/cs/updatePartnerPosition?regionId="
802
									+ regionId + "&positionId=" + positionId,
828
						+ regionId + "&positionId=" + positionId,
803
									JSON.stringify(selectedFofoIds), function(
829
						JSON.stringify(selectedFofoIds), function(
804
											response) {
830
							response) {
805
										if (response == "true") {
831
						if (response == "true") {
806
											alert("Update successfully");
832
							alert("Update successfully");
807
											loadCreatePosition("main-content");
833
							loadCreatePosition("main-content");
808
										}
-
 
809
									});
-
 
810
						}
834
						}
811
 
-
 
812
					});
835
					});
-
 
836
				}
-
 
837
 
-
 
838
			});
813
 
839
 
814
});
840
});
815
 
841
 
816
function loadCreateCategory(domId) {
842
function loadCreateCategory(domId) {
817
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
843
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
818
		$('#' + domId).html(response);
844
		$('#' + domId).html(response);
819
	});
845
	});
820
}
846
}
821
function removePosition(positionId) {
847
function removePosition(positionId) {
822
	doDeleteAjaxRequestHandler(context + "/cs/removePosition?positionId="
848
	doDeleteAjaxRequestHandler(context + "/cs/removePosition?positionId="
823
			+ positionId, function(response) {
849
		+ positionId, function(response) {
824
		if (response == "true") {
850
			if (response == "true") {
825
			alert("Position removed successfully");
851
				alert("Position removed successfully");
826
			loadCreatePosition("main-content");
852
				loadCreatePosition("main-content");
827
		}
853
			}
828
	});
854
		});
829
}
855
}
830
 
856
 
831
function loadCreateRegion(domId) {
857
function loadCreateRegion(domId) {
832
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
858
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
833
		$('#' + domId).html(response);
859
		$('#' + domId).html(response);
834
	});
860
	});
835
}
861
}
836
function loadMyTicket(domId, ticketStatus, sortOrder, ticketSearchType,
862
function loadMyTicket(domId, ticketStatus, sortOrder, ticketSearchType,
837
		searchTerm, searchValue) {
863
	searchTerm, searchValue) {
838
 
864
 
839
	if (ticketStatus == null && sortOrder == null) {
865
	if (ticketStatus == null && sortOrder == null) {
840
		doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
866
		doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
841
			$('#' + domId).html(response);
867
			$('#' + domId).html(response);
842
		});
868
		});
843
	} else if (ticketSearchType == null) {
869
	} else if (ticketSearchType == null) {
844
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
870
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
845
				+ ticketStatus + "&orderby=" + sortOrder, function(response) {
871
			+ ticketStatus + "&orderby=" + sortOrder, function(response) {
846
			$('#' + domId).html(response);
872
				$('#' + domId).html(response);
847
		});
873
			});
848
	} else {
874
	} else {
849
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
875
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
850
				+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
876
			+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
851
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
877
			+ ticketSearchType + "&searchTerm=" + searchTerm, function(
852
				response) {
878
				response) {
853
			$('#' + domId).html(response);
879
			$('#' + domId).html(response);
854
			if (ticketSearchType == "PARTNER_NAME") {
880
			if (ticketSearchType == "PARTNER_NAME") {
855
				$('.assigneebyPartnerName').css('display', 'inline-block');
881
				$('.assigneebyPartnerName').css('display', 'inline-block');
856
				$('.assingeebyTicketId').css('display', 'none');
882
				$('.assingeebyTicketId').css('display', 'none');
Line 865... Line 891...
865
	}
891
	}
866
}
892
}
867
 
893
 
868
function loadCreatePartnerRegion(domId) {
894
function loadCreatePartnerRegion(domId) {
869
	doGetAjaxRequestHandler(context + "/cs/createPartnerRegion", function(
895
	doGetAjaxRequestHandler(context + "/cs/createPartnerRegion", function(
870
			response) {
896
		response) {
871
		$('#' + domId).html(response);
897
		$('#' + domId).html(response);
872
	});
898
	});
873
}
899
}
874
function loadCreatePosition(domId) {
900
function loadCreatePosition(domId) {
875
	doGetAjaxRequestHandler(context + "/cs/createPosition", function(response) {
901
	doGetAjaxRequestHandler(context + "/cs/createPosition", function(response) {
876
		$('#' + domId).html(response);
902
		$('#' + domId).html(response);
877
	});
903
	});
878
}
904
}
879
function loadSubCategories(categoryId) {
905
function loadSubCategories(categoryId) {
880
	doGetAjaxRequestHandler(context
906
	doGetAjaxRequestHandler(context
881
			+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
907
		+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
882
			function(response) {
908
		function(response) {
883
				$('#' + "create-ticket-sub-categories").html(response);
909
			$('#' + "create-ticket-sub-categories").html(response);
884
			});
910
		});
885
}
911
}
886
function createCategory(domId, name, description) {
912
function createCategory(domId, name, description) {
887
	var params = {
913
	var params = {
888
		"name" : name,
914
		"name": name,
889
		"description" : description
915
		"description": description
890
	}
916
	}
891
	doPostAjaxRequestWithParamsHandler(context + "/cs/createCategory", params,
917
	doPostAjaxRequestWithParamsHandler(context + "/cs/createCategory", params,
892
			function(response) {
918
		function(response) {
893
				alert("Category created successfully");
919
			alert("Category created successfully");
894
				loadCreateCategory(domId);
920
			loadCreateCategory(domId);
895
			});
921
		});
896
}
922
}
897
function changeTicket(ticketId, subCategoryId, authUserId, categoryId) {
923
function changeTicket(ticketId, subCategoryId, authUserId, categoryId) {
898
	var params = {
924
	var params = {
899
		"ticketId" : ticketId,
925
		"ticketId": ticketId,
900
		"subCategoryId" : subCategoryId,
926
		"subCategoryId": subCategoryId,
901
		"authUserId" : authUserId,
927
		"authUserId": authUserId,
902
		"categoryId" : categoryId
928
		"categoryId": categoryId
903
	}
929
	}
904
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
930
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
905
			function(response) {
931
		function(response) {
906
				if (response == "true") {
932
			if (response == "true") {
907
					alert("Ticket changed successfully");
933
				alert("Ticket changed successfully");
908
					loadManagerTicket("main-content", null, null, null, null,
934
				loadManagerTicket("main-content", null, null, null, null,
909
							null);
935
					null);
910
				}
936
			}
911
			});
937
		});
912
}
938
}
913
function createRegion(domId, name, description) {
939
function createRegion(domId, name, description) {
914
	var params = {
940
	var params = {
915
		"name" : name,
941
		"name": name,
916
		"description" : description
942
		"description": description
917
	}
943
	}
918
	doPostAjaxRequestWithParamsHandler(context + "/cs/createRegion", params,
944
	doPostAjaxRequestWithParamsHandler(context + "/cs/createRegion", params,
919
			function(response) {
945
		function(response) {
920
				if (response == "true") {
946
			if (response == "true") {
921
					alert("Region created successfully");
947
				alert("Region created successfully");
922
					loadCreateRegion(domId);
948
				loadCreateRegion(domId);
923
				}
949
			}
924
			});
950
		});
925
}
951
}
926
function loadCreateSubCategory(domId) {
952
function loadCreateSubCategory(domId) {
927
	doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
953
	doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
928
			response) {
954
		response) {
929
		$('#' + domId).html(response);
955
		$('#' + domId).html(response);
930
	});
956
	});
931
}
957
}
932
function loadManagerTicket(domId, ticketStatus, sortOrder, ticketSearchType,
958
function loadManagerTicket(domId, ticketStatus, sortOrder, ticketSearchType,
933
		searchTerm, searchValue) {
959
	searchTerm, searchValue) {
934
	if (ticketStatus == null && sortOrder == null) {
960
	if (ticketStatus == null && sortOrder == null) {
935
		doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
961
		doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
936
				response) {
962
			response) {
937
			$('#' + domId).html(response);
963
			$('#' + domId).html(response);
938
		});
964
		});
939
	} else if (ticketSearchType == null) {
965
	} else if (ticketSearchType == null) {
940
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
966
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
941
				+ ticketStatus + "&orderby=" + sortOrder, function(response) {
967
			+ ticketStatus + "&orderby=" + sortOrder, function(response) {
942
			$('#' + domId).html(response);
968
				$('#' + domId).html(response);
943
		});
969
			});
944
	} else {
970
	} else {
945
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
971
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
946
				+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
972
			+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
947
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
973
			+ ticketSearchType + "&searchTerm=" + searchTerm, function(
948
				response) {
974
				response) {
949
			$('#' + domId).html(response);
975
			$('#' + domId).html(response);
950
			if (ticketSearchType == "PARTNER_NAME") {
976
			if (ticketSearchType == "PARTNER_NAME") {
951
				$('.byPartnerName').css('display', 'inline-block');
977
				$('.byPartnerName').css('display', 'inline-block');
952
				$('.byTicketId').css('display', 'none');
978
				$('.byTicketId').css('display', 'none');
Line 965... Line 991...
965
		$('#' + domId).html(response);
991
		$('#' + domId).html(response);
966
	});
992
	});
967
}
993
}
968
function loadticketSubCategoryById(ticketCategoryId) {
994
function loadticketSubCategoryById(ticketCategoryId) {
969
	doGetAjaxRequestHandler(context
995
	doGetAjaxRequestHandler(context
970
			+ "/cs/getSubCategoryByCategoryId?ticketCategoryId="
996
		+ "/cs/getSubCategoryByCategoryId?ticketCategoryId="
971
			+ ticketCategoryId, function(response) {
997
		+ ticketCategoryId, function(response) {
972
		$(".ticket-sub-category-container").html(response);
998
			$(".ticket-sub-category-container").html(response);
973
	});
999
		});
974
}
1000
}
975
function createPartnerRegion(domId, regionId, fofoIds) {
1001
function createPartnerRegion(domId, regionId, fofoIds) {
976
	doPostAjaxRequestWithJsonHandler(context
1002
	doPostAjaxRequestWithJsonHandler(context
977
			+ "/cs/createPartnerRegion?regionId=" + regionId, JSON
1003
		+ "/cs/createPartnerRegion?regionId=" + regionId, JSON
978
			.stringify(fofoIds), function(response) {
1004
			.stringify(fofoIds), function(response) {
979
		if (response == "true") {
1005
				if (response == "true") {
980
			alert("added region to partner successfully");
1006
					alert("added region to partner successfully");
981
			loadCreatePartnerRegion(domId);
1007
					loadCreatePartnerRegion(domId);
982
		}
1008
				}
983
	});
1009
			});
984
}
1010
}
985
function createSubCategory(domId, name, description, categoryId) {
1011
function createSubCategory(domId, name, description, categoryId) {
986
	var params = {
1012
	var params = {
987
		"categoryId" : categoryId,
1013
		"categoryId": categoryId,
988
		"name" : name,
1014
		"name": name,
989
		"description" : description
1015
		"description": description
990
	}
1016
	}
991
	doPostAjaxRequestWithParamsHandler(context + "/cs/createSubCategory",
1017
	doPostAjaxRequestWithParamsHandler(context + "/cs/createSubCategory",
992
			params, function(response) {
1018
		params, function(response) {
993
				alert("Sub Category created successfully");
1019
			alert("Sub Category created successfully");
994
				loadCreateSubCategory(domId);
1020
			loadCreateSubCategory(domId);
995
			});
1021
		});
996
}
1022
}
997
function createLastActivity(ticketId, activity) {
1023
function createLastActivity(ticketId, activity) {
998
	var params = {
1024
	var params = {
999
		"ticketId" : ticketId,
1025
		"ticketId": ticketId,
1000
		"lastactivity" : activity
1026
		"lastactivity": activity
1001
	}
1027
	}
1002
	doPostAjaxRequestWithParamsHandler(context + "/cs/create-last-activity",
1028
	doPostAjaxRequestWithParamsHandler(context + "/cs/create-last-activity",
1003
			params, function(response) {
1029
		params, function(response) {
1004
				if (response == "true") {
1030
			if (response == "true") {
1005
					alert("successfully mark last activity");
1031
				alert("successfully mark last activity");
1006
					loadMyTicket("main-content", null, null);
1032
				loadMyTicket("main-content", null, null);
1007
				}
1033
			}
1008
			});
1034
		});
1009
}
1035
}
1010
 
1036
 
1011
function createPosition(domId, authUserId, categoryId, escalationType,
1037
function createPosition(domId, authUserId, categoryId, escalationType,
1012
		regionId, fofoIds) {
1038
	regionId, fofoIds) {
1013
 
1039
 
1014
	var createPositionModel = {};
1040
	var createPositionModel = {};
1015
	createPositionModel['authUserId'] = authUserId;
1041
	createPositionModel['authUserId'] = authUserId;
1016
	createPositionModel['categoryId'] = categoryId
1042
	createPositionModel['categoryId'] = categoryId
1017
	createPositionModel['escalationType'] = escalationType;
1043
	createPositionModel['escalationType'] = escalationType;
1018
	createPositionModel['regionId'] = regionId,
1044
	createPositionModel['regionId'] = regionId,
1019
			createPositionModel['fofoIds'] = fofoIds
1045
		createPositionModel['fofoIds'] = fofoIds
1020
 
1046
 
1021
	console.log(createPositionModel);
1047
	console.log(createPositionModel);
1022
	doPostAjaxRequestWithJsonHandler(context + "/cs/createPosition", JSON
1048
	doPostAjaxRequestWithJsonHandler(context + "/cs/createPosition", JSON
1023
			.stringify(createPositionModel), function(response) {
1049
		.stringify(createPositionModel), function(response) {
1024
		if (response == "true") {
1050
			if (response == "true") {
1025
			alert("Position created successfully");
1051
				alert("Position created successfully");
1026
			loadCreatePosition(domId);
1052
				loadCreatePosition(domId);
1027
		}
1053
			}
1028
	});
1054
		});
1029
}
1055
}
1030
function createActivity(message, ticketId, assigneeId, internal, roleType,
1056
function createActivity(message, ticketId, assigneeId, internal, roleType,
1031
		documentIds) {
1057
	documentIds) {
1032
 
1058
 
1033
	var params = {
1059
	var params = {
1034
		"message" : message,
1060
		"message": message,
1035
		"ticketId" : ticketId,
1061
		"ticketId": ticketId,
1036
		"assigneeId" : assigneeId,
1062
		"assigneeId": assigneeId,
1037
		"internal" : internal,
1063
		"internal": internal,
1038
		"documentIds" : documentIds,
1064
		"documentIds": documentIds,
1039
	}
1065
	}
1040
	if (documentIds.includes("0")) {
1066
	if (documentIds.includes("0")) {
1041
		documentIds = [ 0 ];
1067
		documentIds = [0];
1042
		console.log(documentIds);
1068
		console.log(documentIds);
1043
	} else {
1069
	} else {
1044
		console.log(documentIds);
1070
		console.log(documentIds);
1045
	}
1071
	}
1046
	console.log(JSON.stringify(documentIds))
1072
	console.log(JSON.stringify(documentIds))
1047
	doPostAjaxRequestWithJsonHandler(context + "/cs/createActivity?message="
1073
	doPostAjaxRequestWithJsonHandler(context + "/cs/createActivity?message="
1048
			+ message + "&ticketId=" + ticketId + "&assigneeId=" + assigneeId
1074
		+ message + "&ticketId=" + ticketId + "&assigneeId=" + assigneeId
1049
			+ "&internal=" + internal, JSON.stringify(documentIds), function(
1075
		+ "&internal=" + internal, JSON.stringify(documentIds), function(
1050
			response) {
1076
			response) {
1051
		response = JSON.parse(response);
1077
		response = JSON.parse(response);
1052
 
1078
 
1053
		documentIds.splice(0, documentIds.length);
1079
		documentIds.splice(0, documentIds.length);
1054
 
1080
 
Line 1058... Line 1084...
1058
		loadActivities(ticketId, assigneeName, internal, roleType)
1084
		loadActivities(ticketId, assigneeName, internal, roleType)
1059
	});
1085
	});
1060
}
1086
}
1061
function loadEditTicket(ticketId) {
1087
function loadEditTicket(ticketId) {
1062
	doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
1088
	doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
1063
			function(response) {
1089
		function(response) {
1064
				$("#theModal .modal-content").html(response);
1090
			$("#theModal .modal-content").html(response);
1065
 
1091
 
1066
			});
1092
		});
1067
}
1093
}
1068
function loadPartnerForRegion(regionId) {
1094
function loadPartnerForRegion(regionId) {
1069
	doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
1095
	doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
1070
			function(response) {
1096
		function(response) {
1071
				$("#partner-region-container").html(response);
1097
			$("#partner-region-container").html(response);
1072
			});
1098
		});
1073
}
1099
}
1074
 
1100
 
1075
function loadPartnerForRegionId(regionId) {
1101
function loadPartnerForRegionId(regionId) {
1076
	doGetAjaxRequestHandler(context + "/cs/getPartnersByRegion?regionId="
1102
	doGetAjaxRequestHandler(context + "/cs/getPartnersByRegion?regionId="
1077
			+ regionId, function(response) {
1103
		+ regionId, function(response) {
1078
		$("#partner-subregion-container").html(response);
1104
			$("#partner-subregion-container").html(response);
1079
	});
1105
		});
1080
}
1106
}
1081
 
1107
 
1082
function loadAccessManagement(domId) {
1108
function loadAccessManagement(domId) {
1083
	doGetAjaxRequestHandler(context + "/admin/access-management", function(
1109
	doGetAjaxRequestHandler(context + "/admin/access-management", function(
1084
			response) {
1110
		response) {
1085
		$('#' + domId).html(response);
1111
		$('#' + domId).html(response);
1086
	});
1112
	});
1087
}
1113
}
1088
 
1114
 
1089
function loadActivities(ticketId, assignee, internal, roleType) {
1115
function loadActivities(ticketId, assignee, internal, roleType) {
Line 1091... Line 1117...
1091
	$(".activity-container .modal-body").empty();
1117
	$(".activity-container .modal-body").empty();
1092
	$("#activityMessage").val("");
1118
	$("#activityMessage").val("");
1093
	$("#ticketIdforactivity").val(ticketId);
1119
	$("#ticketIdforactivity").val(ticketId);
1094
	$("#role").val(roleType);
1120
	$("#role").val(roleType);
1095
	$(".activity-container .modal-title").html(
1121
	$(".activity-container .modal-title").html(
1096
			"Activity history for Ticket Id " + ticketId)
1122
		"Activity history for Ticket Id " + ticketId)
1097
	console.log(ticketId);
1123
	console.log(ticketId);
1098
	doGetAjaxRequestHandler(
1124
	doGetAjaxRequestHandler(
1099
			context + "/cs/getActivities?ticketId=" + ticketId,
1125
		context + "/cs/getActivities?ticketId=" + ticketId,
1100
			function(response) {
1126
		function(response) {
1101
				response = JSON.parse(response);
1127
			response = JSON.parse(response);
1102
				console.log(response);
1128
			console.log(response);
1103
 
1129
 
1104
				for (var i = 0; i < response.length; i++) {
1130
			for (var i = 0; i < response.length; i++) {
1105
					console.log(response[i].activityAttachment.length);
1131
				console.log(response[i].activityAttachment.length);
1106
					var activityAttachment = []
1132
				var activityAttachment = []
1107
					var attachments = "";
1133
				var attachments = "";
1108
					if (response[i].activityAttachment.length > 0) {
1134
				if (response[i].activityAttachment.length > 0) {
1109
						for (var j = 0; j < response[i].activityAttachment.length; j++) {
1135
					for (var j = 0; j < response[i].activityAttachment.length; j++) {
1110
							var assigneeAttachment = "<a href=\"javascript:void(0)\" style=\"color:#337ab7;float:right;\"onclick=\"downloadDocument("
1136
						var assigneeAttachment = "<a href=\"javascript:void(0)\" style=\"color:#337ab7;float:right;\"onclick=\"downloadDocument("
1111
									+ response[i].activityAttachment[j].documentId
1137
							+ response[i].activityAttachment[j].documentId
1112
									+ ",\`"
1138
							+ ",\`"
1113
									+ response[i].activityAttachment[j].documentName
1139
							+ response[i].activityAttachment[j].documentName
1114
									+ "\`)\">"
1140
							+ "\`)\">"
1115
									+ response[i].activityAttachment[j].documentName
1141
							+ response[i].activityAttachment[j].documentName
1116
									+ "&nbsp;<i class=\"fa fa-download\"></i>"
1142
							+ "&nbsp;<i class=\"fa fa-download\"></i>"
1117
									+ "</a>"
1143
							+ "</a>"
1118
							activityAttachment.push(assigneeAttachment);
1144
						activityAttachment.push(assigneeAttachment);
1119
						}
-
 
1120
						attachments = activityAttachment.join("");
-
 
1121
						console.log(attachments);
-
 
1122
					}
1145
					}
-
 
1146
					attachments = activityAttachment.join("");
-
 
1147
					console.log(attachments);
-
 
1148
				}
1123
					if (response[i].type == "OPENED"
1149
				if (response[i].type == "OPENED"
1124
							|| response[i].type == "COMMUNICATION_IN") {
1150
					|| response[i].type == "COMMUNICATION_IN") {
1125
 
1151
 
1126
						var partnerMessage = "<div class=\"incoming_msg\">"
1152
					var partnerMessage = "<div class=\"incoming_msg\">"
1127
								+ "<div class=\"received_msg\">"
1153
						+ "<div class=\"received_msg\">"
1128
								+ "<div class=\"received_withd_msg\">" + "<p>"
1154
						+ "<div class=\"received_withd_msg\">" + "<p>"
1129
								+ response[i].message + "</p><div>"
1155
						+ response[i].message + "</p><div>"
1130
								+ `${attachments}`
1156
						+ `${attachments}`
1131
								+ "</div> <span class=\"time_date\"> "
1157
						+ "</div> <span class=\"time_date\"> "
1132
								+ response[i].createTimestamp.hour + ":"
1158
						+ response[i].createTimestamp.hour + ":"
1133
								+ response[i].createTimestamp.minute + "|"
1159
						+ response[i].createTimestamp.minute + "|"
1134
								+ response[i].createTimestamp.dayOfMonth + "/"
1160
						+ response[i].createTimestamp.dayOfMonth + "/"
1135
								+ response[i].createTimestamp.monthValue + "/"
1161
						+ response[i].createTimestamp.monthValue + "/"
1136
								+ response[i].createTimestamp.year
1162
						+ response[i].createTimestamp.year
1137
								+ "</span></div>" + "</div>" + "</div>";
1163
						+ "</span></div>" + "</div>" + "</div>";
1138
						$(".activity-container .modal-body").append(
1164
					$(".activity-container .modal-body").append(
1139
								partnerMessage);
1165
						partnerMessage);
1140
 
1166
 
1141
					} else if (response[i].type == "COMMUNICATION_OUT") {
1167
				} else if (response[i].type == "COMMUNICATION_OUT") {
1142
						var assigneeMessage = "<div class=\"outgoing_msg\">"
1168
					var assigneeMessage = "<div class=\"outgoing_msg\">"
1143
								+ "<div class=\"sent_msg\">"
1169
						+ "<div class=\"sent_msg\">"
1144
								+ "<span style=color:green>"
1170
						+ "<span style=color:green>"
1145
								+ "~"
1171
						+ "~"
1146
								+ (response[i].name ? response[i].name
1172
						+ (response[i].name ? response[i].name
1147
										: "Support") + "<p>"
1173
							: "Support") + "<p>"
1148
								+ response[i].message + "</span> </p><div>"
1174
						+ response[i].message + "</span> </p><div>"
1149
								+ `${attachments}`
1175
						+ `${attachments}`
1150
								+ "</div> <span class=\"time_date\">"
1176
						+ "</div> <span class=\"time_date\">"
1151
								+ response[i].createTimestamp.hour + ":"
1177
						+ response[i].createTimestamp.hour + ":"
1152
								+ response[i].createTimestamp.minute + "|"
1178
						+ response[i].createTimestamp.minute + "|"
1153
								+ response[i].createTimestamp.dayOfMonth + "/"
1179
						+ response[i].createTimestamp.dayOfMonth + "/"
1154
								+ response[i].createTimestamp.monthValue + "/"
1180
						+ response[i].createTimestamp.monthValue + "/"
1155
								+ response[i].createTimestamp.year
1181
						+ response[i].createTimestamp.year
1156
								+ "</span> </div>" + "</div>";
1182
						+ "</span> </div>" + "</div>";
1157
						$(".activity-container .modal-body").append(
1183
					$(".activity-container .modal-body").append(
1158
								assigneeMessage);
1184
						assigneeMessage);
1159
 
1185
 
1160
					} else if (response[i].name
1186
				} else if (response[i].name
1161
							&& response[i].type == "COMMUNICATION_INTERNAL") {
1187
					&& response[i].type == "COMMUNICATION_INTERNAL") {
1162
						var assigneeMessage = "<div class=\"outgoing_msg\">"
1188
					var assigneeMessage = "<div class=\"outgoing_msg\">"
1163
								+ "<div class=\"sent_msg\">"
1189
						+ "<div class=\"sent_msg\">"
1164
								+ "<span style=color:green>"
1190
						+ "<span style=color:green>"
1165
								+ "~"
1191
						+ "~"
1166
								+ response[i].name
1192
						+ response[i].name
1167
								+ "<p style=\"color: white;background: #b75454;\">"
1193
						+ "<p style=\"color: white;background: #b75454;\">"
1168
								+ response[i].message + "</span> </p> <div>"
-
 
1169
								+ `${attachments}`
-
 
1170
								+ "</div> <span class=\"time_date\">"
-
 
1171
								+ response[i].createTimestamp.hour + ":"
-
 
1172
								+ response[i].createTimestamp.minute + "|"
-
 
1173
								+ response[i].createTimestamp.dayOfMonth + "/"
-
 
1174
								+ response[i].createTimestamp.monthValue + "/"
-
 
1175
								+ response[i].createTimestamp.year
-
 
1176
								+ "</span> </div>" + "</div>";
-
 
1177
						$(".activity-container .modal-body").append(
-
 
1178
								assigneeMessage);
-
 
1179
 
-
 
1180
					} else {
-
 
1181
						var assigneeMessage = "<div class=\"outgoing_msg\">"
-
 
1182
								+ "<div class=\"sent_msg\">" + "<p>"
-
 
1183
								+ response[i].message + "</span> </p> <div>"
1194
						+ response[i].message + "</span> </p> <div>"
1184
								+ `${attachments}`
1195
						+ `${attachments}`
1185
								+ "</div> <span class=\"time_date\">"
1196
						+ "</div> <span class=\"time_date\">"
1186
								+ response[i].createTimestamp.hour + ":"
1197
						+ response[i].createTimestamp.hour + ":"
1187
								+ response[i].createTimestamp.minute + "|"
1198
						+ response[i].createTimestamp.minute + "|"
1188
								+ response[i].createTimestamp.dayOfMonth + "/"
1199
						+ response[i].createTimestamp.dayOfMonth + "/"
1189
								+ response[i].createTimestamp.monthValue + "/"
1200
						+ response[i].createTimestamp.monthValue + "/"
1190
								+ response[i].createTimestamp.year
1201
						+ response[i].createTimestamp.year
1191
								+ "</span> </div>" + "</div>";
1202
						+ "</span> </div>" + "</div>";
1192
						$(".activity-container .modal-body").append(
1203
					$(".activity-container .modal-body").append(
1193
								assigneeMessage);
1204
						assigneeMessage);
1194
 
1205
 
1195
					}
1206
				} else {
-
 
1207
					var assigneeMessage = "<div class=\"outgoing_msg\">"
-
 
1208
						+ "<div class=\"sent_msg\">" + "<p>"
-
 
1209
						+ response[i].message + "</span> </p> <div>"
-
 
1210
						+ `${attachments}`
-
 
1211
						+ "</div> <span class=\"time_date\">"
-
 
1212
						+ response[i].createTimestamp.hour + ":"
-
 
1213
						+ response[i].createTimestamp.minute + "|"
-
 
1214
						+ response[i].createTimestamp.dayOfMonth + "/"
-
 
1215
						+ response[i].createTimestamp.monthValue + "/"
-
 
1216
						+ response[i].createTimestamp.year
-
 
1217
						+ "</span> </div>" + "</div>";
-
 
1218
					$(".activity-container .modal-body").append(
-
 
1219
						assigneeMessage);
1196
 
1220
 
1197
				}
1221
				}
1198
				if (roleType == "true" || roleType == true) {
-
 
1199
					$('.internalCheckBox').css('display', 'block');
-
 
1200
					if (internal == true || internal == "true") {
-
 
1201
						$('#internalCommunication').prop('checked', true);
-
 
1202
					} else {
-
 
1203
						$('#internalCommunication').prop('checked', false);
-
 
1204
					}
-
 
1205
 
1222
 
-
 
1223
			}
-
 
1224
			if (roleType == "true" || roleType == true) {
-
 
1225
				$('.internalCheckBox').css('display', 'block');
-
 
1226
				if (internal == true || internal == "true") {
-
 
1227
					$('#internalCommunication').prop('checked', true);
1206
				} else {
1228
				} else {
1207
					$('.internalCheckBox').css('display', 'none');
1229
					$('#internalCommunication').prop('checked', false);
1208
				}
1230
				}
-
 
1231
 
-
 
1232
			} else {
-
 
1233
				$('.internalCheckBox').css('display', 'none');
-
 
1234
			}
1209
			});
1235
		});
1210
}
1236
}
1211
 
1237
 
1212
function downloadDocument(documentId, documentName) {
1238
function downloadDocument(documentId, documentName) {
1213
	console.log(documentName)
1239
	console.log(documentName)
1214
	doAjaxGetDownload(context + "/download?documentId=" + documentId,
1240
	doAjaxGetDownload(context + "/download?documentId=" + documentId,
1215
			documentName);
1241
		documentName);
1216
}
1242
}