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