Subversion Repositories SmartDukaan

Rev

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

Rev 24787 Rev 24824
Line 56... Line 56...
56
				console.log(searchValue);
56
				console.log(searchValue);
57
				if (typeof (searchContent) == "undefined" || !searchContent) {
57
				if (typeof (searchContent) == "undefined" || !searchContent) {
58
					searchContent = "";
58
					searchContent = "";
59
				}
59
				}
60
 
60
 
61
				loadMyTicket("main-content", ticketStatus,
61
				loadMyTicket("main-content", ticketStatus, ticketorderBy,
62
						ticketorderBy, searchType, searchContent,
62
						searchType, searchContent, searchValue);
63
						searchValue);
-
 
64
 
63
 
65
			});
64
			});
66
	$("#assignee-retailer-details-search-button-by-ticketId").live(
65
	$("#assignee-retailer-details-search-button-by-ticketId").live(
67
			'click',
66
			'click',
68
			function() {
67
			function() {
Line 78... Line 77...
78
					alert("Input field can't be empty");
77
					alert("Input field can't be empty");
79
					return false;
78
					return false;
80
				}
79
				}
81
				console.log(ticketStatus);
80
				console.log(ticketStatus);
82
				console.log(ticketorderBy);
81
				console.log(ticketorderBy);
83
				loadMyTicket("main-content", ticketStatus,
82
				loadMyTicket("main-content", ticketStatus, ticketorderBy,
84
						ticketorderBy, searchType, searchContent, null);
83
						searchType, searchContent, null);
85
 
84
 
86
			});
85
			});
87
 
86
 
88
	$("#ticket-last-activity").live('click', function() {
87
	$("#ticket-last-activity").live('click', function() {
89
		var ticketId = $(this).data('ticketid');
88
		var ticketId = $(this).data('ticketid');
Line 109... Line 108...
109
			$('.byTicketId').css('display', 'none');
108
			$('.byTicketId').css('display', 'none');
110
			$("#search-by-ticketId").val("");
109
			$("#search-by-ticketId").val("");
111
		} else {
110
		} else {
112
			$('.byPartnerName').css('display', 'none');
111
			$('.byPartnerName').css('display', 'none');
113
			$('.byTicketId').css('display', 'inline-block');
112
			$('.byTicketId').css('display', 'inline-block');
114
			$('#manager-ticket-search-by-partner-name').data('id',"");
113
			$('#manager-ticket-search-by-partner-name').data('id', "");
115
		}
114
		}
116
 
115
 
117
	});
116
	});
118
	$("#assigneesearchType").live('change', function() {
117
	$("#assigneesearchType").live('change', function() {
119
		var searchType = $("#assigneesearchType").val();
118
		var searchType = $("#assigneesearchType").val();
Line 124... Line 123...
124
			$('.assigneebyTicketId').css('display', 'none');
123
			$('.assigneebyTicketId').css('display', 'none');
125
			$("#assignee-search-by-ticketId").val("");
124
			$("#assignee-search-by-ticketId").val("");
126
		} else {
125
		} else {
127
			$('.assigneebyPartnerName').css('display', 'none');
126
			$('.assigneebyPartnerName').css('display', 'none');
128
			$('.assigneebyTicketId').css('display', 'inline-block');
127
			$('.assigneebyTicketId').css('display', 'inline-block');
129
			$("#assignee-ticket-search-by-partner-name").data('id','');
128
			$("#assignee-ticket-search-by-partner-name").data('id', '');
130
		}
129
		}
131
 
130
 
132
	});
131
	});
133
 
132
 
134
	$(".change-ticket-button")
133
	$(".change-ticket-button")
Line 165... Line 164...
165
		loadCreateRegion("main-content");
164
		loadCreateRegion("main-content");
166
	});
165
	});
167
	$("#activities").live('click', function() {
166
	$("#activities").live('click', function() {
168
		var ticketId = $(this).data('ticketid');
167
		var ticketId = $(this).data('ticketid');
169
		var assignee = $(this).data('assignee');
168
		var assignee = $(this).data('assignee');
-
 
169
		var internal = $(this).data('internal');
-
 
170
		var roleType = $(this).data('role');
170
		console.log(assignee);
171
		console.log(assignee);
171
		loadActivities(ticketId, assignee);
172
		loadActivities(ticketId, assignee, internal, roleType);
172
	});
173
	});
173
	$(".my-ticket").live('click', function() {
174
	$(".my-ticket").live('click', function() {
174
		loadMyTicket("main-content", null, null,null,null,null);
175
		loadMyTicket("main-content", null, null, null, null, null);
175
	});
176
	});
176
	$("#close-ticket").live('click', function() {
177
	$("#close-ticket").live('click', function() {
177
		var ticketId = $(this).data('ticketid');
178
		var ticketId = $(this).data('ticketid');
178
		closeTicket(ticketId);
179
		closeTicket(ticketId);
179
	});
180
	});
180
	$(".submit-message-button").live('click', function() {
181
	$(".submit-message-button").live('click', function() {
181
		var message = $("#activityMessage").val();
182
		var message = $("#activityMessage").val();
-
 
183
		var internal = $("#internalCommunication").prop("checked");
182
		if (message == "" || message == null || message == undefined) {
184
		if (message == "" || message == null || message == undefined) {
183
			alert("message field can't be empty");
185
			alert("message field can't be empty");
184
			return false;
186
			return false;
185
		}
187
		}
186
		var ticketId = $("#ticketIdforactivity").val();
188
		var ticketId = $("#ticketIdforactivity").val();
187
		var assignee = $("#assigneeUser").val();
189
		var assignee = $("#assigneeUser").val();
-
 
190
		var roleType = $("#role").val();
188
		console.log(message, ticketId, assignee);
191
		console.log(message, ticketId, assignee);
189
		createActivity(message, ticketId, assignee);
192
		createActivity(message, ticketId, assignee, internal, roleType);
190
	});
193
	});
191
 
194
 
192
	$("#tickets-paginated .next").live(
195
	$("#tickets-paginated .next").live(
193
			'click',
196
			'click',
194
			function() {
197
			function() {
Line 401... Line 404...
401
					});
404
					});
402
	$(".create-position").live('click', function() {
405
	$(".create-position").live('click', function() {
403
		loadCreatePosition("main-content");
406
		loadCreatePosition("main-content");
404
	});
407
	});
405
 
408
 
406
	$("#ticketStatus").live('change', function() {
409
	$("#ticketStatus").live(
-
 
410
			'change',
-
 
411
			function() {
407
		var ticketStatus = $("#ticketStatus").val();
412
				var ticketStatus = $("#ticketStatus").val();
408
		var orderBy = $("#orderBy").val();
413
				var orderBy = $("#orderBy").val();
409
		var searchType = $("#assigneesearchType").val();
414
				var searchType = $("#assigneesearchType").val();
410
		if (searchType == "" || searchType == undefined
415
				if (searchType == "" || searchType == undefined
411
				|| searchType == null) {
416
						|| searchType == null) {
412
			loadMyTicket("main-content", ticketStatus, orderBy,
417
					loadMyTicket("main-content", ticketStatus, orderBy, null,
413
					null, null, null);
418
							null, null);
414
		} else {
419
				} else {
415
			if (searchType == "PARTNER_NAME") {
420
					if (searchType == "PARTNER_NAME") {
416
				var searchTerm = $("#assignee-partner-name-input").val();
421
						var searchTerm = $("#assignee-partner-name-input")
-
 
422
								.val();
417
				var searchValue = $("#typeaheadpartnernameforassignee").val();
423
						var searchValue = $("#typeaheadpartnernameforassignee")
-
 
424
								.val();
418
				loadMyTicket("main-content", ticketStatus,
425
						loadMyTicket("main-content", ticketStatus, orderBy,
419
						orderBy, searchType, searchTerm, searchValue);
426
								searchType, searchTerm, searchValue);
420
			} else {
427
					} else {
421
				var searchTerm = $("#assignee-search-by-ticketId").val();
428
						var searchTerm = $("#assignee-search-by-ticketId")
-
 
429
								.val();
422
						loadMyTicket("main-content", ticketStatus,
430
						loadMyTicket("main-content", ticketStatus, orderBy,
423
						orderBy, searchType, searchTerm, null);
431
								searchType, searchTerm, null);
424
			}
432
					}
425
		}
433
				}
426
	});
434
			});
427
	$("#orderBy").live('change', function() {
435
	$("#orderBy").live(
-
 
436
			'change',
-
 
437
			function() {
428
		var ticketStatus = $("#ticketStatus").val();
438
				var ticketStatus = $("#ticketStatus").val();
429
		var orderBy = $("#orderBy").val();
439
				var orderBy = $("#orderBy").val();
430
		var searchType = $("#assigneesearchType").val();
440
				var searchType = $("#assigneesearchType").val();
431
		if (searchType == "" || searchType == undefined
441
				if (searchType == "" || searchType == undefined
432
				|| searchType == null) {
442
						|| searchType == null) {
433
			loadMyTicket("main-content", ticketStatus, orderBy,
443
					loadMyTicket("main-content", ticketStatus, orderBy, null,
434
					null, null, null);
444
							null, null);
435
		} else {
445
				} else {
436
			if (searchType == "PARTNER_NAME") {
446
					if (searchType == "PARTNER_NAME") {
437
				var searchTerm = $("#assignee-partner-name-input").val();
447
						var searchTerm = $("#assignee-partner-name-input")
-
 
448
								.val();
438
				var searchValue = $("#typeaheadpartnernameforassignee").val();
449
						var searchValue = $("#typeaheadpartnernameforassignee")
-
 
450
								.val();
439
				loadMyTicket("main-content", ticketStatus,
451
						loadMyTicket("main-content", ticketStatus, orderBy,
440
						orderBy, searchType, searchTerm, searchValue);
452
								searchType, searchTerm, searchValue);
441
			} else {
453
					} else {
442
				var searchTerm = $("#assignee-search-by-ticketId").val();
454
						var searchTerm = $("#assignee-search-by-ticketId")
-
 
455
								.val();
443
				loadMyTicket("main-content", ticketStatus,
456
						loadMyTicket("main-content", ticketStatus, orderBy,
444
						orderBy, searchType, searchTerm, null);
457
								searchType, searchTerm, null);
445
			}
458
					}
446
		}
459
				}
447
	});
460
			});
448
	$("#managerTicketStatus").live(
461
	$("#managerTicketStatus").live(
449
			'change',
462
			'change',
450
			function() {
463
			function() {
451
				var ticketStatus = $("#managerTicketStatus").val();
464
				var ticketStatus = $("#managerTicketStatus").val();
452
				var orderBy = $("#managerTicketorderBy").val();
465
				var orderBy = $("#managerTicketorderBy").val();
Line 671... Line 684...
671
function loadCreateRegion(domId) {
684
function loadCreateRegion(domId) {
672
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
685
	doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
673
		$('#' + domId).html(response);
686
		$('#' + domId).html(response);
674
	});
687
	});
675
}
688
}
676
function loadMyTicket(domId, ticketStatus, sortOrder,ticketSearchType,searchTerm,searchValue) {
689
function loadMyTicket(domId, ticketStatus, sortOrder, ticketSearchType,
-
 
690
		searchTerm, searchValue) {
677
 
691
 
678
	if (ticketStatus == null && sortOrder == null) {
692
	if (ticketStatus == null && sortOrder == null) {
679
		doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
693
		doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
680
			$('#' + domId).html(response);
694
			$('#' + domId).html(response);
681
		});
695
		});
682
	}
-
 
683
	else if(ticketSearchType == null)
696
	} else if (ticketSearchType == null) {
684
	{
-
 
685
	doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
-
 
686
			+ ticketStatus + "&orderby=" + sortOrder, function(
-
 
687
			response) {
-
 
688
		$('#' + domId).html(response);
-
 
689
	});
-
 
690
	}
-
 
691
	else {
-
 
692
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
697
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
-
 
698
				+ ticketStatus + "&orderby=" + sortOrder, function(response) {
-
 
699
			$('#' + domId).html(response);
-
 
700
		});
-
 
701
	} else {
-
 
702
		doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
693
				+ ticketStatus + "&orderby=" + sortOrder+ "&ticketSearchType="
703
				+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
694
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
704
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
695
						response) {
705
				response) {
696
					$('#' + domId).html(response);
706
			$('#' + domId).html(response);
697
					if (ticketSearchType == "PARTNER_NAME") {
707
			if (ticketSearchType == "PARTNER_NAME") {
698
						$('.assigneebyPartnerName').css('display', 'inline-block');
708
				$('.assigneebyPartnerName').css('display', 'inline-block');
699
						$('.assingeebyTicketId').css('display', 'none');
709
				$('.assingeebyTicketId').css('display', 'none');
700
						$("#typeaheadpartnernameforassignee").val(searchValue);
710
				$("#typeaheadpartnernameforassignee").val(searchValue);
701
						$("#assignee-partner-name-input").val(searchTerm);
711
				$("#assignee-partner-name-input").val(searchTerm);
702
					} else {
712
			} else {
703
						$('.assigneebyPartnerName').css('display', 'none');
713
				$('.assigneebyPartnerName').css('display', 'none');
704
						$('.assigneebyTicketId').css('display', 'inline-block');
714
				$('.assigneebyTicketId').css('display', 'inline-block');
705
						$("#assignee-search-by-ticketId").val(searchTerm);
715
				$("#assignee-search-by-ticketId").val(searchTerm);
706
					}
716
			}
707
		});
717
		});
708
	}
718
	}
709
}
719
}
710
 
720
 
711
function loadCreatePartnerRegion(domId) {
721
function loadCreatePartnerRegion(domId) {
Line 746... Line 756...
746
	}
756
	}
747
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
757
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
748
			function(response) {
758
			function(response) {
749
				if (response == "true") {
759
				if (response == "true") {
750
					alert("Ticket changed successfully");
760
					alert("Ticket changed successfully");
751
					loadManagerTicket("main-content", null, null,null,null,null);
761
					loadManagerTicket("main-content", null, null, null, null,
-
 
762
							null);
752
				}
763
				}
753
			});
764
			});
754
}
765
}
755
function createRegion(domId, name, description) {
766
function createRegion(domId, name, description) {
756
	var params = {
767
	var params = {
Line 776... Line 787...
776
	if (ticketStatus == null && sortOrder == null) {
787
	if (ticketStatus == null && sortOrder == null) {
777
		doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
788
		doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
778
				response) {
789
				response) {
779
			$('#' + domId).html(response);
790
			$('#' + domId).html(response);
780
		});
791
		});
781
	}
-
 
782
	else if(ticketSearchType == null)
792
	} else if (ticketSearchType == null) {
783
		{
-
 
784
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
793
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
785
				+ ticketStatus + "&orderby=" + sortOrder, function(
794
				+ ticketStatus + "&orderby=" + sortOrder, function(response) {
786
				response) {
-
 
787
			$('#' + domId).html(response);
795
			$('#' + domId).html(response);
788
		});
796
		});
789
		}
-
 
790
	else {
797
	} else {
791
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
798
		doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
792
				+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
799
				+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
793
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
800
				+ ticketSearchType + "&searchTerm=" + searchTerm, function(
794
				response) {
801
				response) {
795
			$('#' + domId).html(response);
802
			$('#' + domId).html(response);
Line 867... Line 874...
867
					alert("Position created successfully");
874
					alert("Position created successfully");
868
					loadCreatePosition(domId);
875
					loadCreatePosition(domId);
869
				}
876
				}
870
			});
877
			});
871
}
878
}
872
function createActivity(message, ticketId, assigneeId) {
879
function createActivity(message, ticketId, assigneeId, internal, roleType) {
873
	var params = {
880
	var params = {
874
		"message" : message,
881
		"message" : message,
875
		"ticketId" : ticketId,
882
		"ticketId" : ticketId,
876
		"assigneeId" : assigneeId,
883
		"assigneeId" : assigneeId,
-
 
884
		"internal" : internal,
877
	}
885
	}
878
	doPostAjaxRequestWithParamsHandler(context + "/cs/createActivity", params,
886
	doPostAjaxRequestWithParamsHandler(context + "/cs/createActivity", params,
879
			function(response) {
887
			function(response) {
880
				response = JSON.parse(response);
888
				response = JSON.parse(response);
881
				var assigneeName = response.firstName;
889
				var assigneeName = response.firstName;
882
				loadActivities(ticketId, assigneeName)
890
				loadActivities(ticketId, assigneeName, internal, roleType)
883
			});
891
			});
884
}
892
}
885
function loadEditTicket(ticketId) {
893
function loadEditTicket(ticketId) {
886
	doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
894
	doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
887
			function(response) {
895
			function(response) {
Line 892... Line 900...
892
	doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
900
	doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
893
			function(response) {
901
			function(response) {
894
				$("#partner-region-container").html(response);
902
				$("#partner-region-container").html(response);
895
			});
903
			});
896
}
904
}
897
function loadActivities(ticketId, assignee) {
905
function loadActivities(ticketId, assignee, internal, roleType) {
898
 
906
 
899
	$(".activity-container .modal-body").empty();
907
	$(".activity-container .modal-body").empty();
900
	$("#activityMessage").val("");
908
	$("#activityMessage").val("");
901
	$("#ticketIdforactivity").val(ticketId);
909
	$("#ticketIdforactivity").val(ticketId);
-
 
910
	$("#role").val(roleType);
902
	console.log(ticketId);
911
	console.log(ticketId);
903
	doGetAjaxRequestHandler(
912
	doGetAjaxRequestHandler(
904
			context + "/cs/getActivities?ticketId=" + ticketId,
913
			context + "/cs/getActivities?ticketId=" + ticketId,
905
			function(response) {
914
			function(response) {
906
				response = JSON.parse(response);
915
				response = JSON.parse(response);
Line 921... Line 930...
921
								+ response[i].createTimestamp.year
930
								+ response[i].createTimestamp.year
922
								+ "</span></div>" + "</div>" + "</div>";
931
								+ "</span></div>" + "</div>" + "</div>";
923
						$(".activity-container .modal-body").append(
932
						$(".activity-container .modal-body").append(
924
								partnerMessage);
933
								partnerMessage);
925
					}
934
					}
926
					if (response[i].type = "COMMUNICATION_OUT"
935
					if ((response[i].type == "COMMUNICATION_OUT" || response[i].type == "COMMUNICATION_INTERNAL")
927
							&& response[i].createdBy > 0) {
936
							&& response[i].createdBy > 0) {
928
						if (response[i].name) {
937
						if (response[i].name) {
929
							var assigneeMessage = "<div class=\"outgoing_msg\">"
938
							var assigneeMessage = "<div class=\"outgoing_msg\">"
930
									+ "<div class=\"sent_msg\">"
939
									+ "<div class=\"sent_msg\">"
931
									+ "<span style=color:green>"
940
									+ "<span style=color:green>"
Line 965... Line 974...
965
						}
974
						}
966
						$(".activity-container .modal-body").append(
975
						$(".activity-container .modal-body").append(
967
								assigneeMessage);
976
								assigneeMessage);
968
					}
977
					}
969
				}
978
				}
-
 
979
				if (roleType == "true" || roleType == true) {
-
 
980
					$('.internalCheckBox').css('display', 'block');
-
 
981
					if (internal == true || internal == "true") {
-
 
982
						$('#internalCommunication').prop('checked', true);
-
 
983
					} else {
-
 
984
						$('#internalCommunication').prop('checked', false);
-
 
985
					}
-
 
986
 
-
 
987
				} else {
-
 
988
					$('.internalCheckBox').css('display', 'none');
-
 
989
				}
970
			});
990
			});
971
}
991
}