Subversion Repositories SmartDukaan

Rev

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