Subversion Repositories SmartDukaan

Rev

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

Rev 24469 Rev 24471
Line 5... Line 5...
5
		loadCreateCategory("main-content");
5
		loadCreateCategory("main-content");
6
	});
6
	});
7
	$(".create-region").live('click', function() {
7
	$(".create-region").live('click', function() {
8
		loadCreateRegion("main-content");
8
		loadCreateRegion("main-content");
9
	});
9
	});
10
	
10
 
11
	$(".change-ticket-button").live('click', function() {
11
	$(".change-ticket-button")
-
 
12
			.live(
-
 
13
					'click',
-
 
14
					function() {
12
		var ticketId=$("#ticketId").val();
15
						var ticketId = $("#ticketId").val();
13
		var subCategory=$("#subCategory").val();
16
						var subCategory = $("#subCategory").val();
14
		var authUserId=$("#authUser").val();
17
						var authUserId = $("#authUser").val();
15
		console.log(ticketId);
18
						console.log(ticketId);
16
		if(subCategory==null||subCategory==""||subCategory==undefined)
19
						if (subCategory == null || subCategory == ""
17
			{
20
								|| subCategory == undefined) {
18
				alert("Choose appropriate subCategory");
21
							alert("Choose appropriate subCategory");
19
			}
22
						}
20
		if (confirm("Are you sure you want to change ticket!") == true) {
23
						if (confirm("Are you sure you want to change ticket!") == true) {
21
		changeTicket(ticketId,subCategory,authUserId);
24
							changeTicket(ticketId, subCategory, authUserId);
22
		}
25
						}
23
	});
26
					});
24
	$("#edit-ticket").live('click', function() {
27
	$("#edit-ticket").live('click', function() {
25
		
28
 
26
		var ticketId=$(this).data('ticketid1');
29
		var ticketId = $(this).data('ticketid1');
27
		console.log(ticketId);
30
		console.log(ticketId);
28
		loadEditTicket(ticketId);
31
		loadEditTicket(ticketId);
29
	});
32
	});
30
	$(".manager-ticket").live('click', function() {
33
	$(".manager-ticket").live('click', function() {
31
		loadManagerTicket("main-content");
34
		loadManagerTicket("main-content");
Line 89... Line 92...
89
				loadPaginatedPreviousItems('/cs/myticketPaginated', null,
92
				loadPaginatedPreviousItems('/cs/myticketPaginated', null,
90
						'tickets-paginated', 'my-ticket-table',
93
						'tickets-paginated', 'my-ticket-table',
91
						'ticket-details-container');
94
						'ticket-details-container');
92
				$(this).blur();
95
				$(this).blur();
93
			});
96
			});
-
 
97
	$("#positions-paginated .next").live(
-
 
98
			'click',
-
 
99
			function() {
-
 
100
				loadPaginatedNextItems('/cs/position-paginated', null,
-
 
101
						'positions-paginated', 'position-table',
-
 
102
						'position-details-container');
-
 
103
				$(this).blur();
-
 
104
			});
-
 
105
 
-
 
106
	$("#positions-paginated .previous").live(
-
 
107
			'click',
-
 
108
			function() {
-
 
109
				loadPaginatedPreviousItems('/cs/position-paginated', null,
-
 
110
						'positions-paginated', 'position-table',
-
 
111
						'position-details-container');
-
 
112
				$(this).blur();
-
 
113
			});
94
 
114
 
95
	$(".create-partner-region").live('click', function() {
115
	$(".create-partner-region").live('click', function() {
96
		loadCreatePartnerRegion("main-content");
116
		loadCreatePartnerRegion("main-content");
97
	});
117
	});
98
	$(".create-ticket").live('click', function() {
118
	$(".create-ticket").live('click', function() {
Line 314... Line 334...
314
						if (confirm("Are you sure you want to create ticket category!") == true) {
334
						if (confirm("Are you sure you want to create ticket category!") == true) {
315
							createSubCategory("main-content", name,
335
							createSubCategory("main-content", name,
316
									description, ticketCategoryId);
336
									description, ticketCategoryId);
317
						}
337
						}
318
					});
338
					});
-
 
339
	$(".remove-position").live('click', function() {
-
 
340
		var positionId = $(this).data('positionid');
-
 
341
		if (confirm("Are you sure you want to remove position!") == true) {
-
 
342
		removePosition(positionId);
-
 
343
		}
-
 
344
	});
319
 
345
 
320
});
346
});
321
 
347
 
322
function loadCreateCategory(domId) {
348
function loadCreateCategory(domId) {
323
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
349
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
324
		$('#' + domId).html(response);
350
		$('#' + domId).html(response);
325
	});
351
	});
326
}
352
}
-
 
353
function removePosition(positionId)
-
 
354
{
-
 
355
	doDeleteAjaxRequestHandler(context + "/cs/removePosition?positionId="+positionId, function(response) {
-
 
356
		if (response == "true") {
-
 
357
			alert("Position removed successfully");
-
 
358
			loadCreatePosition("main-content");
-
 
359
		}
-
 
360
	});
-
 
361
}
327
 
362
 
328
function loadCreateRegion(domId) {
363
function loadCreateRegion(domId) {
329
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
364
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
330
		$('#' + domId).html(response);
365
		$('#' + domId).html(response);
331
	});
366
	});
Line 363... Line 398...
363
			function(response) {
398
			function(response) {
364
				alert("Category created successfully");
399
				alert("Category created successfully");
365
				loadCreateCategory(domId);
400
				loadCreateCategory(domId);
366
			});
401
			});
367
}
402
}
368
function changeTicket(ticketId,subCategoryId,authUserId)
403
function changeTicket(ticketId, subCategoryId, authUserId) {
369
{
-
 
370
	var params = {
404
	var params = {
371
			"ticketId" : ticketId,
405
		"ticketId" : ticketId,
372
			"subCategoryId" : subCategoryId,
406
		"subCategoryId" : subCategoryId,
373
			"authUserId":authUserId
407
		"authUserId" : authUserId
374
		}
408
	}
375
		doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
409
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
376
				function(response) {
410
			function(response) {
377
					if (response == "true") {
411
				if (response == "true") {
378
						alert("Ticket changed successfully");
412
					alert("Ticket changed successfully");
379
						loadManagerTicket("main-content");
413
					loadManagerTicket("main-content");
380
					}
414
				}
381
				});
415
			});
382
}
416
}
383
function createRegion(domId, name, description) {
417
function createRegion(domId, name, description) {
384
	var params = {
418
	var params = {
385
		"name" : name,
419
		"name" : name,
386
		"description" : description
420
		"description" : description
Line 397... Line 431...
397
	doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
431
	doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
398
			response) {
432
			response) {
399
		$('#' + domId).html(response);
433
		$('#' + domId).html(response);
400
	});
434
	});
401
}
435
}
402
function loadManagerTicket(domId){
436
function loadManagerTicket(domId) {
403
	doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
437
	doGetAjaxRequestHandler(context + "/cs/managerTicket", function(response) {
404
			response) {
-
 
405
		$('#' + domId).html(response);
438
		$('#' + domId).html(response);
406
	});
439
	});
407
}
440
}
408
function loadCreateTicket(domId) {
441
function loadCreateTicket(domId) {
409
	doGetAjaxRequestHandler(context + "/cs/createTicket", function(response) {
442
	doGetAjaxRequestHandler(context + "/cs/createTicket", function(response) {
Line 506... Line 539...
506
				response = JSON.parse(response);
539
				response = JSON.parse(response);
507
				var assigneeName = response.firstName;
540
				var assigneeName = response.firstName;
508
				loadActivities(ticketId, assigneeName)
541
				loadActivities(ticketId, assigneeName)
509
			});
542
			});
510
}
543
}
511
function loadEditTicket(ticketId)
544
function loadEditTicket(ticketId) {
512
{
-
 
513
	doGetAjaxRequestHandler(context
545
	doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
514
			+ "/cs/edit-ticket?ticketId="
-
 
515
			+ ticketId, function(response) {
546
			function(response) {
516
		$(".modal-content").html(response);
547
				$(".modal-content").html(response);
517
	});
548
			});
518
}
549
}
519
function loadActivities(ticketId, assignee) {
550
function loadActivities(ticketId, assignee) {
520
 
551
 
521
	$(".activity-container .modal-body").empty();
552
	$(".activity-container .modal-body").empty();
522
	$("#activityMessage").val("");
553
	$("#activityMessage").val("");
Line 543... Line 574...
543
								+ response[i].createTimestamp.minute + "|"
574
								+ response[i].createTimestamp.minute + "|"
544
								+ response[i].createTimestamp.dayOfMonth + "/"
575
								+ response[i].createTimestamp.dayOfMonth + "/"
545
								+ response[i].createTimestamp.monthValue + "/"
576
								+ response[i].createTimestamp.monthValue + "/"
546
								+ response[i].createTimestamp.year
577
								+ response[i].createTimestamp.year
547
								+ "</span></div>" + "</div>" + "</div>";
578
								+ "</span></div>" + "</div>" + "</div>";
548
						$(".activity-container .modal-body").append(partnerMessage);
579
						$(".activity-container .modal-body").append(
-
 
580
								partnerMessage);
549
					}
581
					}
550
					if (response[i].type = "COMMUNICATION_OUT"
582
					if (response[i].type = "COMMUNICATION_OUT"
551
							&& response[i].createdBy > 0) {
583
							&& response[i].createdBy > 0) {
552
 
584
 
553
						var assigneeMessage = "<div class=\"outgoing_msg\">"
585
						var assigneeMessage = "<div class=\"outgoing_msg\">"
Line 558... Line 590...
558
								+ response[i].createTimestamp.minute + "|"
590
								+ response[i].createTimestamp.minute + "|"
559
								+ response[i].createTimestamp.dayOfMonth + "/"
591
								+ response[i].createTimestamp.dayOfMonth + "/"
560
								+ response[i].createTimestamp.monthValue + "/"
592
								+ response[i].createTimestamp.monthValue + "/"
561
								+ response[i].createTimestamp.year
593
								+ response[i].createTimestamp.year
562
								+ "</span> </div>" + "</div>";
594
								+ "</span> </div>" + "</div>";
563
						
-
 
564
						
595
 
565
						$(".activity-container .modal-body").append(assigneeMessage);
596
						$(".activity-container .modal-body").append(
-
 
597
								assigneeMessage);
566
					}
598
					}
567
				}
599
				}
568
			});
600
			});
569
}
601
}