Subversion Repositories SmartDukaan

Rev

Rev 27285 | Rev 27754 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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