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