| 24417 |
govind |
1 |
$(function() {
|
|
|
2 |
|
|
|
3 |
$(".create-ticket-category").live('click', function() {
|
|
|
4 |
console.log("create ticket category clicked......");
|
|
|
5 |
loadCreateCategory("main-content");
|
|
|
6 |
});
|
|
|
7 |
$(".create-region").live('click', function() {
|
|
|
8 |
loadCreateRegion("main-content");
|
|
|
9 |
});
|
| 24748 |
govind |
10 |
$("#manager-ticket-search-by-partner-name").live(
|
| 24747 |
govind |
11 |
'click',
|
|
|
12 |
function() {
|
|
|
13 |
var searchContent = $(this).data('id');
|
| 24748 |
govind |
14 |
var searchValue = $("#typeaheadpartnername").val();
|
| 24747 |
govind |
15 |
var searchType = $("#managersearchType").val();
|
|
|
16 |
var managerTicketStatus = $("#managerTicketStatus").val();
|
|
|
17 |
var managerTicketorderBy = $("#managerTicketorderBy").val();
|
|
|
18 |
if (typeof (searchContent) == "undefined" || !searchContent) {
|
|
|
19 |
searchContent = "";
|
|
|
20 |
}
|
|
|
21 |
|
|
|
22 |
loadManagerTicket("main-content", managerTicketStatus,
|
|
|
23 |
managerTicketorderBy, searchType, searchContent,
|
|
|
24 |
searchValue);
|
|
|
25 |
|
|
|
26 |
});
|
|
|
27 |
$("#retailer-details-search-button-by-ticketId").live(
|
|
|
28 |
'click',
|
|
|
29 |
function() {
|
|
|
30 |
var searchContent = $("#search-by-ticketId").val();
|
|
|
31 |
var searchType = $("#managersearchType").val();
|
|
|
32 |
var managerTicketStatus = $("#managerTicketStatus").val();
|
|
|
33 |
var managerTicketorderBy = $("#managerTicketorderBy").val();
|
|
|
34 |
if (typeof (searchContent) == "undefined" || !searchContent) {
|
|
|
35 |
searchContent = "";
|
|
|
36 |
}
|
|
|
37 |
if (searchContent == "" || searchContent == undefined
|
|
|
38 |
|| searchContent == null) {
|
|
|
39 |
alert("Input field can't be empty");
|
|
|
40 |
return false;
|
|
|
41 |
}
|
|
|
42 |
loadManagerTicket("main-content", managerTicketStatus,
|
|
|
43 |
managerTicketorderBy, searchType, searchContent, null);
|
|
|
44 |
|
|
|
45 |
});
|
|
|
46 |
|
| 24620 |
govind |
47 |
$("#ticket-last-activity").live('click', function() {
|
|
|
48 |
var ticketId = $(this).data('ticketid');
|
|
|
49 |
var activity = $(this).data('activity');
|
|
|
50 |
console.log(ticketId);
|
|
|
51 |
console.log(activity);
|
| 24699 |
govind |
52 |
if (confirm("Are you sure!") == true) {
|
| 24620 |
govind |
53 |
createLastActivity(ticketId, activity);
|
|
|
54 |
}
|
|
|
55 |
});
|
| 24471 |
govind |
56 |
|
| 24557 |
govind |
57 |
$("#region").live('change', function() {
|
| 24620 |
govind |
58 |
var regionId = $("#region").val();
|
| 24557 |
govind |
59 |
console.log(regionId);
|
|
|
60 |
loadPartnerForRegion(regionId);
|
|
|
61 |
});
|
| 24747 |
govind |
62 |
$("#managersearchType").live('change', function() {
|
|
|
63 |
var searchType = $("#managersearchType").val();
|
|
|
64 |
console.log(searchType);
|
|
|
65 |
var html;
|
|
|
66 |
if (searchType == "PARTNER_NAME") {
|
|
|
67 |
$('.byPartnerName').css('display', 'inline-block');
|
|
|
68 |
$('.byTicketId').css('display', 'none');
|
|
|
69 |
$("#search-by-ticketId").val("");
|
|
|
70 |
} else {
|
|
|
71 |
$('.byPartnerName').css('display', 'none');
|
|
|
72 |
$('.byTicketId').css('display', 'inline-block');
|
| 24748 |
govind |
73 |
$('#manager-ticket-search-by-partner-name').data('id',"");
|
| 24747 |
govind |
74 |
}
|
|
|
75 |
$("#searchTextInput").html(html);
|
| 24557 |
govind |
76 |
|
| 24747 |
govind |
77 |
});
|
|
|
78 |
|
| 24471 |
govind |
79 |
$(".change-ticket-button")
|
|
|
80 |
.live(
|
|
|
81 |
'click',
|
|
|
82 |
function() {
|
|
|
83 |
var ticketId = $("#ticketId").val();
|
|
|
84 |
var subCategory = $("#subCategory").val();
|
|
|
85 |
var authUserId = $("#authUser").val();
|
| 24534 |
govind |
86 |
var categoryId = $("#category").val();
|
| 24471 |
govind |
87 |
console.log(ticketId);
|
|
|
88 |
if (subCategory == null || subCategory == ""
|
|
|
89 |
|| subCategory == undefined) {
|
|
|
90 |
alert("Choose appropriate subCategory");
|
| 24500 |
govind |
91 |
return false;
|
| 24471 |
govind |
92 |
}
|
| 24500 |
govind |
93 |
console.log(authUserId);
|
| 24471 |
govind |
94 |
if (confirm("Are you sure you want to change ticket!") == true) {
|
| 24534 |
govind |
95 |
changeTicket(ticketId, subCategory, authUserId,
|
|
|
96 |
categoryId);
|
| 24471 |
govind |
97 |
}
|
|
|
98 |
});
|
| 24439 |
govind |
99 |
$("#edit-ticket").live('click', function() {
|
| 24471 |
govind |
100 |
|
|
|
101 |
var ticketId = $(this).data('ticketid1');
|
| 24467 |
govind |
102 |
console.log(ticketId);
|
|
|
103 |
loadEditTicket(ticketId);
|
| 24439 |
govind |
104 |
});
|
|
|
105 |
$(".manager-ticket").live('click', function() {
|
| 24747 |
govind |
106 |
loadManagerTicket("main-content", null, null);
|
| 24439 |
govind |
107 |
});
|
| 24417 |
govind |
108 |
$(".ticketType").live('click', function() {
|
| 24534 |
govind |
109 |
console.log("create Region");
|
| 24417 |
govind |
110 |
loadCreateRegion("main-content");
|
|
|
111 |
});
|
| 24469 |
govind |
112 |
$("#activities").live('click', function() {
|
| 24417 |
govind |
113 |
var ticketId = $(this).data('ticketid');
|
|
|
114 |
var assignee = $(this).data('assignee');
|
|
|
115 |
console.log(assignee);
|
|
|
116 |
loadActivities(ticketId, assignee);
|
|
|
117 |
});
|
|
|
118 |
$(".my-ticket").live('click', function() {
|
| 24699 |
govind |
119 |
loadMyTicket("main-content", null, null);
|
| 24417 |
govind |
120 |
});
|
|
|
121 |
$("#close-ticket").live('click', function() {
|
|
|
122 |
var ticketId = $(this).data('ticketid');
|
| 24439 |
govind |
123 |
closeTicket(ticketId);
|
| 24417 |
govind |
124 |
});
|
|
|
125 |
$(".submit-message-button").live('click', function() {
|
|
|
126 |
var message = $("#activityMessage").val();
|
|
|
127 |
if (message == "" || message == null || message == undefined) {
|
|
|
128 |
alert("message field can't be empty");
|
| 24500 |
govind |
129 |
return false;
|
| 24417 |
govind |
130 |
}
|
|
|
131 |
var ticketId = $("#ticketIdforactivity").val();
|
|
|
132 |
var assignee = $("#assigneeUser").val();
|
|
|
133 |
console.log(message, ticketId, assignee);
|
|
|
134 |
createActivity(message, ticketId, assignee);
|
|
|
135 |
});
|
|
|
136 |
|
|
|
137 |
$("#tickets-paginated .next").live(
|
|
|
138 |
'click',
|
|
|
139 |
function() {
|
| 24699 |
govind |
140 |
var ticketStatus = $("#ticketStatus").val();
|
|
|
141 |
var orderBy = $("#orderBy").val();
|
|
|
142 |
var params = {
|
| 24747 |
govind |
143 |
"ticketStatus" : ticketStatus,
|
|
|
144 |
"orderby" : orderBy
|
|
|
145 |
};
|
|
|
146 |
loadPaginatedNextItems('/cs/myticketPaginated', params,
|
| 24417 |
govind |
147 |
'tickets-paginated', 'my-ticket-table',
|
|
|
148 |
'ticket-details-container');
|
|
|
149 |
$(this).blur();
|
|
|
150 |
});
|
|
|
151 |
|
| 24467 |
govind |
152 |
$("#manager-tickets-paginated .previous").live(
|
|
|
153 |
'click',
|
|
|
154 |
function() {
|
| 24747 |
govind |
155 |
|
|
|
156 |
var ticketStatus = $("#managerTicketStatus").val();
|
|
|
157 |
var orderBy = $("#managerTicketorderBy").val();
|
|
|
158 |
var searchType = $("#managersearchType").val();
|
|
|
159 |
var params;
|
|
|
160 |
if (searchType == "" && searchType == undefined
|
|
|
161 |
&& searchType == null || searchType == "TICKET_ID") {
|
|
|
162 |
params = {
|
|
|
163 |
"ticketStatus" : ticketStatus,
|
|
|
164 |
"orderby" : orderBy
|
|
|
165 |
};
|
|
|
166 |
} else {
|
|
|
167 |
var searchTerm = $("#partner-name-input").val();
|
|
|
168 |
console.log(searchTerm);
|
|
|
169 |
params = {
|
|
|
170 |
"ticketStatus" : ticketStatus,
|
|
|
171 |
"orderby" : orderBy,
|
|
|
172 |
"ticketSearchType" : searchType,
|
|
|
173 |
"searchTerm" : searchTerm
|
|
|
174 |
};
|
|
|
175 |
}
|
|
|
176 |
loadPaginatedPreviousItems('/cs/managerTicket-paginated',
|
|
|
177 |
params, 'manager-tickets-paginated',
|
|
|
178 |
'manager-ticket-table',
|
| 24467 |
govind |
179 |
'manager-ticket-details-container');
|
|
|
180 |
$(this).blur();
|
|
|
181 |
});
|
|
|
182 |
$("#manager-tickets-paginated .next").live(
|
|
|
183 |
'click',
|
|
|
184 |
function() {
|
| 24747 |
govind |
185 |
var ticketStatus = $("#managerTicketStatus").val();
|
|
|
186 |
var orderBy = $("#managerTicketorderBy").val();
|
|
|
187 |
var searchType = $("#managersearchType").val();
|
|
|
188 |
var params;
|
|
|
189 |
if (searchType == "" && searchType == undefined
|
|
|
190 |
&& searchType == null || searchType == "TICKET_ID") {
|
|
|
191 |
params = {
|
|
|
192 |
"ticketStatus" : ticketStatus,
|
|
|
193 |
"orderby" : orderBy
|
|
|
194 |
};
|
|
|
195 |
} else {
|
|
|
196 |
var searchTerm = $("#partner-name-input").val();
|
|
|
197 |
console.log(searchTerm);
|
|
|
198 |
params = {
|
|
|
199 |
"ticketStatus" : ticketStatus,
|
|
|
200 |
"orderby" : orderBy,
|
|
|
201 |
"ticketSearchType" : searchType,
|
|
|
202 |
"searchTerm" : searchTerm
|
|
|
203 |
};
|
|
|
204 |
}
|
| 24699 |
govind |
205 |
|
| 24747 |
govind |
206 |
loadPaginatedNextItems('/cs/managerTicket-paginated', params,
|
| 24467 |
govind |
207 |
'manager-tickets-paginated', 'manager-ticket-table',
|
|
|
208 |
'manager-ticket-details-container');
|
|
|
209 |
$(this).blur();
|
|
|
210 |
});
|
|
|
211 |
|
| 24417 |
govind |
212 |
$("#tickets-paginated .previous").live(
|
|
|
213 |
'click',
|
|
|
214 |
function() {
|
| 24699 |
govind |
215 |
var ticketStatus = $("#ticketStatus").val();
|
|
|
216 |
var orderBy = $("#orderBy").val();
|
|
|
217 |
var params = {
|
| 24747 |
govind |
218 |
"ticketStatus" : ticketStatus,
|
|
|
219 |
"orderby" : orderBy
|
|
|
220 |
};
|
|
|
221 |
loadPaginatedPreviousItems('/cs/myticketPaginated', params,
|
| 24417 |
govind |
222 |
'tickets-paginated', 'my-ticket-table',
|
|
|
223 |
'ticket-details-container');
|
| 24467 |
govind |
224 |
$(this).blur();
|
| 24417 |
govind |
225 |
});
|
| 24471 |
govind |
226 |
$("#positions-paginated .next").live(
|
|
|
227 |
'click',
|
|
|
228 |
function() {
|
|
|
229 |
loadPaginatedNextItems('/cs/position-paginated', null,
|
|
|
230 |
'positions-paginated', 'position-table',
|
|
|
231 |
'position-details-container');
|
|
|
232 |
$(this).blur();
|
|
|
233 |
});
|
| 24417 |
govind |
234 |
|
| 24471 |
govind |
235 |
$("#positions-paginated .previous").live(
|
|
|
236 |
'click',
|
|
|
237 |
function() {
|
|
|
238 |
loadPaginatedPreviousItems('/cs/position-paginated', null,
|
|
|
239 |
'positions-paginated', 'position-table',
|
|
|
240 |
'position-details-container');
|
|
|
241 |
$(this).blur();
|
|
|
242 |
});
|
|
|
243 |
|
| 24417 |
govind |
244 |
$(".create-partner-region").live('click', function() {
|
|
|
245 |
loadCreatePartnerRegion("main-content");
|
|
|
246 |
});
|
|
|
247 |
$(".create-ticket").live('click', function() {
|
|
|
248 |
loadCreateTicket("main-content");
|
|
|
249 |
});
|
|
|
250 |
$(".create-ticket-button")
|
|
|
251 |
.live(
|
|
|
252 |
'click',
|
|
|
253 |
function() {
|
|
|
254 |
var categoryId = $('#category').val();
|
|
|
255 |
var subCategoryId = $('#subCategory').val();
|
|
|
256 |
if (categoryId == "" || categoryId == null
|
|
|
257 |
|| categoryId == undefined) {
|
|
|
258 |
alert("select appropriate category");
|
|
|
259 |
return false;
|
|
|
260 |
}
|
|
|
261 |
if (subCategoryId == "" || subCategoryId == null
|
|
|
262 |
|| subCategoryId == undefined) {
|
|
|
263 |
alert("select appropriate subCategoryId");
|
|
|
264 |
return false;
|
|
|
265 |
}
|
|
|
266 |
var dialog = bootbox
|
|
|
267 |
.dialog({
|
|
|
268 |
title : "Are you sure want to change create ticket!",
|
|
|
269 |
message : "<div class=form-inline'>"
|
|
|
270 |
+ "<label for='message'>Message:</label>"
|
|
|
271 |
+ "<textarea class='form-control' rows='2' id='message'></textarea>"
|
|
|
272 |
+ "</div>",
|
|
|
273 |
buttons : {
|
|
|
274 |
cancel : {
|
|
|
275 |
label : "cancel",
|
|
|
276 |
className : 'btn-danger',
|
|
|
277 |
callback : function() {
|
|
|
278 |
loadCreateTicket("main-content");
|
|
|
279 |
}
|
|
|
280 |
},
|
|
|
281 |
ok : {
|
|
|
282 |
label : "ok",
|
|
|
283 |
className : 'btn-info',
|
|
|
284 |
callback : function() {
|
|
|
285 |
message = $('#message').val();
|
|
|
286 |
console.log(message);
|
|
|
287 |
if (message == ""
|
|
|
288 |
|| message == null
|
|
|
289 |
|| message == undefined) {
|
|
|
290 |
alert("message field can't be empty");
|
|
|
291 |
return false;
|
|
|
292 |
}
|
|
|
293 |
var params = {
|
|
|
294 |
"categoryId" : categoryId,
|
|
|
295 |
"subCategoryId" : subCategoryId,
|
|
|
296 |
"message" : message
|
|
|
297 |
}
|
|
|
298 |
doPostAjaxRequestWithParamsHandler(
|
|
|
299 |
context
|
|
|
300 |
+ "/cs/createTicket",
|
|
|
301 |
params,
|
|
|
302 |
function(response) {
|
|
|
303 |
if (response == "true") {
|
|
|
304 |
alert("successfully created");
|
|
|
305 |
loadCreateTicket("main-content");
|
| 24620 |
govind |
306 |
} else {
|
|
|
307 |
alert("You have reached maximum number of tickets , pls click on Resolved for the resolved tickets to create new.");
|
| 24417 |
govind |
308 |
}
|
|
|
309 |
});
|
|
|
310 |
|
|
|
311 |
}
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
});
|
|
|
315 |
|
|
|
316 |
});
|
|
|
317 |
$(".create-position").live('click', function() {
|
|
|
318 |
loadCreatePosition("main-content");
|
|
|
319 |
});
|
|
|
320 |
|
| 24534 |
govind |
321 |
$("#ticketStatus").live('change', function() {
|
| 24699 |
govind |
322 |
var ticketStatus = $("#ticketStatus").val();
|
|
|
323 |
var orderBy = $("#orderBy").val();
|
|
|
324 |
console.log(ticketStatus);
|
|
|
325 |
console.log(orderBy);
|
|
|
326 |
loadMyTicket("main-content", ticketStatus, orderBy);
|
| 24534 |
govind |
327 |
});
|
| 24699 |
govind |
328 |
$("#orderBy").live('change', function() {
|
|
|
329 |
var ticketStatus = $("#ticketStatus").val();
|
|
|
330 |
var orderBy = $("#orderBy").val();
|
|
|
331 |
console.log(ticketStatus);
|
|
|
332 |
console.log(orderBy);
|
|
|
333 |
loadMyTicket("main-content", ticketStatus, orderBy);
|
| 24534 |
govind |
334 |
});
|
| 24747 |
govind |
335 |
$("#managerTicketStatus").live(
|
|
|
336 |
'change',
|
|
|
337 |
function() {
|
|
|
338 |
var ticketStatus = $("#managerTicketStatus").val();
|
|
|
339 |
var orderBy = $("#managerTicketorderBy").val();
|
|
|
340 |
var searchType = $("#managersearchType").val();
|
|
|
341 |
if (searchType == "" || searchType == undefined
|
|
|
342 |
|| searchType == null) {
|
|
|
343 |
loadManagerTicket("main-content", ticketStatus, orderBy,
|
|
|
344 |
null, null, null);
|
|
|
345 |
} else {
|
|
|
346 |
if (searchType == "PARTNER_NAME") {
|
|
|
347 |
var searchTerm = $("#partner-name-input").val();
|
| 24748 |
govind |
348 |
var searchValue = $("#typeaheadpartnername").val();
|
| 24747 |
govind |
349 |
loadManagerTicket("main-content", ticketStatus,
|
|
|
350 |
orderBy, searchType, searchTerm, searchValue);
|
|
|
351 |
} else {
|
|
|
352 |
var searchTerm = $("#search-by-ticketId").val();
|
|
|
353 |
loadManagerTicket("main-content", ticketStatus,
|
|
|
354 |
orderBy, searchType, searchTerm, null);
|
|
|
355 |
}
|
|
|
356 |
}
|
|
|
357 |
|
|
|
358 |
});
|
|
|
359 |
$("#managerTicketorderBy").live(
|
|
|
360 |
'change',
|
|
|
361 |
function() {
|
|
|
362 |
var ticketStatus = $("#managerTicketStatus").val();
|
|
|
363 |
var orderBy = $("#managerTicketorderBy").val();
|
|
|
364 |
var searchType = $("#managersearchType").val();
|
|
|
365 |
var searchType = $("#managersearchType").val();
|
|
|
366 |
if (searchType == "" || searchType == undefined
|
|
|
367 |
|| searchType == null) {
|
|
|
368 |
loadManagerTicket("main-content", ticketStatus, orderBy,
|
|
|
369 |
null, null, null);
|
|
|
370 |
} else {
|
|
|
371 |
if (searchType == "PARTNER_NAME") {
|
|
|
372 |
var searchTerm = $("#partner-name-input").val();
|
| 24748 |
govind |
373 |
var searchValue = $("#typeaheadpartnername").val();
|
| 24747 |
govind |
374 |
loadManagerTicket("main-content", ticketStatus,
|
|
|
375 |
orderBy, searchType, searchTerm, searchValue);
|
|
|
376 |
} else {
|
|
|
377 |
var searchTerm = $("#search-by-ticketId").val();
|
|
|
378 |
loadManagerTicket("main-content", ticketStatus,
|
|
|
379 |
orderBy, searchType, searchTerm, null);
|
|
|
380 |
}
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
});
|
| 24417 |
govind |
384 |
$("#category").live('change', function() {
|
|
|
385 |
var categoryId = $("#category").val();
|
| 24500 |
govind |
386 |
$("#auth-user-for-category").hide();
|
| 24417 |
govind |
387 |
loadSubCategories(categoryId);
|
|
|
388 |
});
|
|
|
389 |
$(".create-ticket-category-button")
|
|
|
390 |
.live(
|
|
|
391 |
'click',
|
|
|
392 |
function() {
|
|
|
393 |
console
|
|
|
394 |
.log("create-ticket-category-button clicked......");
|
|
|
395 |
var name = $("#categoryName").val();
|
|
|
396 |
var description = $("#categorydescription").val();
|
|
|
397 |
console.log(name, description);
|
|
|
398 |
if (name == "" || name == null || name == undefined) {
|
|
|
399 |
alert("Name field can't be empty");
|
|
|
400 |
return false;
|
|
|
401 |
}
|
|
|
402 |
if (description == "" || description == null
|
|
|
403 |
|| description == undefined) {
|
|
|
404 |
alert("Description field can't be empty");
|
|
|
405 |
return false;
|
|
|
406 |
}
|
|
|
407 |
if (confirm("Are you sure you want to create ticket category!") == true) {
|
|
|
408 |
createCategory("main-content", name, description);
|
|
|
409 |
}
|
|
|
410 |
});
|
|
|
411 |
$(".create-region-button")
|
|
|
412 |
.live(
|
|
|
413 |
'click',
|
|
|
414 |
function() {
|
|
|
415 |
var name = $("#regionName").val();
|
|
|
416 |
var description = $("#regiondescription").val();
|
|
|
417 |
if (name == "" || name == null || name == undefined) {
|
|
|
418 |
alert("Name field can't be empty");
|
|
|
419 |
return false;
|
|
|
420 |
}
|
|
|
421 |
if (description == "" || description == null
|
|
|
422 |
|| description == undefined) {
|
|
|
423 |
alert("Description field can't be empty");
|
|
|
424 |
return false;
|
|
|
425 |
}
|
|
|
426 |
if (confirm("Are you sure you want to create region!") == true) {
|
|
|
427 |
createRegion("main-content", name, description);
|
|
|
428 |
}
|
|
|
429 |
});
|
|
|
430 |
|
|
|
431 |
$(".create-partner-region-button")
|
|
|
432 |
.live(
|
|
|
433 |
'click',
|
|
|
434 |
function() {
|
|
|
435 |
|
|
|
436 |
var regionId = $("#region").val();
|
|
|
437 |
var fofoIds = $("#partner").val();
|
|
|
438 |
console.log(regionId, fofoIds);
|
|
|
439 |
if (regionId == "" || regionId == null
|
|
|
440 |
|| regionId == undefined) {
|
|
|
441 |
alert("regionId field can't be empty");
|
|
|
442 |
return false;
|
|
|
443 |
}
|
|
|
444 |
if (fofoIds == "" || fofoIds == null
|
|
|
445 |
|| fofoIds == undefined) {
|
|
|
446 |
alert("select appropriate partner");
|
|
|
447 |
return false;
|
|
|
448 |
}
|
|
|
449 |
if (confirm("Are you sure you want to create partner region!") == true) {
|
|
|
450 |
createPartnerRegion("main-content", regionId,
|
|
|
451 |
fofoIds);
|
|
|
452 |
}
|
|
|
453 |
});
|
|
|
454 |
$(".create-position-button")
|
|
|
455 |
.live(
|
|
|
456 |
'click',
|
|
|
457 |
function() {
|
|
|
458 |
|
|
|
459 |
var authUser = $("#authUser").val();
|
|
|
460 |
var ticketCategoryPosition = $(
|
|
|
461 |
"#ticketCategoryPosition").val();
|
|
|
462 |
var escalationType = $("#escalationType").val();
|
|
|
463 |
var regionPosition = $("#regionPosition").val();
|
|
|
464 |
console.log(authUser, ticketCategoryPosition,
|
|
|
465 |
escalationType, regionPosition);
|
|
|
466 |
if (authUser == "" || authUser == null
|
|
|
467 |
|| authUser == undefined) {
|
|
|
468 |
alert("select appropriate authUser");
|
|
|
469 |
return false;
|
|
|
470 |
}
|
|
|
471 |
if (ticketCategoryPosition == ""
|
|
|
472 |
|| ticketCategoryPosition == null
|
|
|
473 |
|| ticketCategoryPosition == undefined) {
|
|
|
474 |
alert("select appropriate category");
|
|
|
475 |
return false;
|
|
|
476 |
}
|
|
|
477 |
if (escalationType == "" || escalationType == null
|
|
|
478 |
|| escalationType == undefined) {
|
|
|
479 |
alert("select appropriate escalationType");
|
|
|
480 |
return false;
|
|
|
481 |
}
|
|
|
482 |
if (regionPosition == "" || regionPosition == null
|
|
|
483 |
|| regionPosition == undefined) {
|
|
|
484 |
alert("select appropriate Region");
|
|
|
485 |
return false;
|
|
|
486 |
}
|
|
|
487 |
if (confirm("Are you sure you want to create Position!") == true) {
|
|
|
488 |
createPosition("main-content", authUser,
|
|
|
489 |
ticketCategoryPosition, escalationType,
|
|
|
490 |
regionPosition);
|
|
|
491 |
}
|
|
|
492 |
});
|
|
|
493 |
|
|
|
494 |
$("#ticketCategory").live('change', function() {
|
|
|
495 |
console.log("change ticket category clicked......");
|
|
|
496 |
var ticketCategoryId = $(this).val();
|
|
|
497 |
console.log(ticketCategoryId);
|
|
|
498 |
loadticketSubCategoryById(ticketCategoryId);
|
|
|
499 |
});
|
|
|
500 |
$(".create-ticket-sub-category").live('click', function() {
|
|
|
501 |
console.log("create ticket category clicked......");
|
|
|
502 |
loadCreateSubCategory("main-content");
|
|
|
503 |
});
|
|
|
504 |
|
|
|
505 |
$(".create-ticket-sub-category-button")
|
|
|
506 |
.live(
|
|
|
507 |
'click',
|
|
|
508 |
function() {
|
|
|
509 |
console
|
|
|
510 |
.log("create-ticket-category-button clicked......");
|
|
|
511 |
var name = $("#subcategoryName").val();
|
|
|
512 |
var description = $("#subcategorydescription").val();
|
|
|
513 |
var ticketCategoryId = $("#ticketCategory").val();
|
|
|
514 |
console.log(name, description);
|
|
|
515 |
if (name == "" || name == null || name == undefined) {
|
|
|
516 |
alert("Name field can't be empty");
|
|
|
517 |
return false;
|
|
|
518 |
}
|
|
|
519 |
if (description == "" || description == null
|
|
|
520 |
|| description == undefined) {
|
|
|
521 |
alert("Description field can't be empty");
|
|
|
522 |
return false;
|
|
|
523 |
}
|
|
|
524 |
if (ticketCategoryId == "" || ticketCategoryId == null
|
|
|
525 |
|| ticketCategoryId == undefined) {
|
|
|
526 |
alert("select appropriate category name");
|
|
|
527 |
return false;
|
|
|
528 |
}
|
|
|
529 |
if (confirm("Are you sure you want to create ticket category!") == true) {
|
|
|
530 |
createSubCategory("main-content", name,
|
|
|
531 |
description, ticketCategoryId);
|
|
|
532 |
}
|
|
|
533 |
});
|
| 24471 |
govind |
534 |
$(".remove-position").live('click', function() {
|
|
|
535 |
var positionId = $(this).data('positionid');
|
|
|
536 |
if (confirm("Are you sure you want to remove position!") == true) {
|
| 24534 |
govind |
537 |
removePosition(positionId);
|
| 24471 |
govind |
538 |
}
|
|
|
539 |
});
|
| 24417 |
govind |
540 |
|
|
|
541 |
});
|
|
|
542 |
|
|
|
543 |
function loadCreateCategory(domId) {
|
|
|
544 |
doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
|
|
|
545 |
$('#' + domId).html(response);
|
|
|
546 |
});
|
|
|
547 |
}
|
| 24534 |
govind |
548 |
function removePosition(positionId) {
|
|
|
549 |
doDeleteAjaxRequestHandler(context + "/cs/removePosition?positionId="
|
|
|
550 |
+ positionId, function(response) {
|
| 24471 |
govind |
551 |
if (response == "true") {
|
|
|
552 |
alert("Position removed successfully");
|
|
|
553 |
loadCreatePosition("main-content");
|
|
|
554 |
}
|
|
|
555 |
});
|
|
|
556 |
}
|
| 24417 |
govind |
557 |
|
|
|
558 |
function loadCreateRegion(domId) {
|
|
|
559 |
doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
|
|
|
560 |
$('#' + domId).html(response);
|
|
|
561 |
});
|
|
|
562 |
}
|
| 24699 |
govind |
563 |
function loadMyTicket(domId, ticketStatus, sortOrder) {
|
| 24620 |
govind |
564 |
|
| 24699 |
govind |
565 |
if (ticketStatus == null && sortOrder == null) {
|
|
|
566 |
doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
|
|
|
567 |
$('#' + domId).html(response);
|
|
|
568 |
});
|
|
|
569 |
} else {
|
|
|
570 |
doGetAjaxRequestHandler(context + "/cs/myticket?ticketStatus="
|
|
|
571 |
+ ticketStatus + "&orderby=" + sortOrder, function(response) {
|
|
|
572 |
$('#' + domId).html(response);
|
|
|
573 |
});
|
|
|
574 |
}
|
| 24417 |
govind |
575 |
}
|
|
|
576 |
|
|
|
577 |
function loadCreatePartnerRegion(domId) {
|
|
|
578 |
doGetAjaxRequestHandler(context + "/cs/createPartnerRegion", function(
|
|
|
579 |
response) {
|
|
|
580 |
$('#' + domId).html(response);
|
|
|
581 |
});
|
|
|
582 |
}
|
|
|
583 |
function loadCreatePosition(domId) {
|
|
|
584 |
doGetAjaxRequestHandler(context + "/cs/createPosition", function(response) {
|
|
|
585 |
$('#' + domId).html(response);
|
|
|
586 |
});
|
|
|
587 |
}
|
|
|
588 |
function loadSubCategories(categoryId) {
|
|
|
589 |
doGetAjaxRequestHandler(context
|
|
|
590 |
+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
|
|
|
591 |
function(response) {
|
|
|
592 |
$('#' + "create-ticket-sub-categories").html(response);
|
|
|
593 |
});
|
|
|
594 |
}
|
|
|
595 |
function createCategory(domId, name, description) {
|
|
|
596 |
var params = {
|
|
|
597 |
"name" : name,
|
|
|
598 |
"description" : description
|
|
|
599 |
}
|
|
|
600 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createCategory", params,
|
|
|
601 |
function(response) {
|
|
|
602 |
alert("Category created successfully");
|
|
|
603 |
loadCreateCategory(domId);
|
|
|
604 |
});
|
|
|
605 |
}
|
| 24534 |
govind |
606 |
function changeTicket(ticketId, subCategoryId, authUserId, categoryId) {
|
| 24467 |
govind |
607 |
var params = {
|
| 24471 |
govind |
608 |
"ticketId" : ticketId,
|
|
|
609 |
"subCategoryId" : subCategoryId,
|
| 24500 |
govind |
610 |
"authUserId" : authUserId,
|
| 24534 |
govind |
611 |
"categoryId" : categoryId
|
| 24471 |
govind |
612 |
}
|
|
|
613 |
doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
|
|
|
614 |
function(response) {
|
|
|
615 |
if (response == "true") {
|
|
|
616 |
alert("Ticket changed successfully");
|
| 24747 |
govind |
617 |
loadManagerTicket("main-content", null, null);
|
| 24471 |
govind |
618 |
}
|
|
|
619 |
});
|
| 24467 |
govind |
620 |
}
|
| 24417 |
govind |
621 |
function createRegion(domId, name, description) {
|
|
|
622 |
var params = {
|
|
|
623 |
"name" : name,
|
|
|
624 |
"description" : description
|
|
|
625 |
}
|
|
|
626 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createRegion", params,
|
|
|
627 |
function(response) {
|
|
|
628 |
if (response == "true") {
|
|
|
629 |
alert("Region created successfully");
|
|
|
630 |
loadCreateRegion(domId);
|
|
|
631 |
}
|
|
|
632 |
});
|
|
|
633 |
}
|
|
|
634 |
function loadCreateSubCategory(domId) {
|
|
|
635 |
doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
|
|
|
636 |
response) {
|
|
|
637 |
$('#' + domId).html(response);
|
|
|
638 |
});
|
|
|
639 |
}
|
| 24747 |
govind |
640 |
function loadManagerTicket(domId, ticketStatus, sortOrder, ticketSearchType,
|
|
|
641 |
searchTerm, searchValue) {
|
|
|
642 |
if (ticketStatus == null && sortOrder == null && ticketSearchType == null
|
|
|
643 |
&& searchTerm == null) {
|
|
|
644 |
doGetAjaxRequestHandler(context + "/cs/managerTicket", function(
|
|
|
645 |
response) {
|
| 24699 |
govind |
646 |
$('#' + domId).html(response);
|
|
|
647 |
});
|
| 24747 |
govind |
648 |
} else {
|
|
|
649 |
doGetAjaxRequestHandler(context + "/cs/managerTicket?ticketStatus="
|
|
|
650 |
+ ticketStatus + "&orderby=" + sortOrder + "&ticketSearchType="
|
|
|
651 |
+ ticketSearchType + "&searchTerm=" + searchTerm, function(
|
|
|
652 |
response) {
|
|
|
653 |
$('#' + domId).html(response);
|
|
|
654 |
if (ticketSearchType == "PARTNER_NAME") {
|
|
|
655 |
$('.byPartnerName').css('display', 'inline-block');
|
|
|
656 |
$('.byTicketId').css('display', 'none');
|
| 24748 |
govind |
657 |
$("#typeaheadpartnername").val(searchValue);
|
| 24747 |
govind |
658 |
$("#partner-name-input").val(searchTerm);
|
|
|
659 |
} else {
|
|
|
660 |
$('.byPartnerName').css('display', 'none');
|
|
|
661 |
$('.byTicketId').css('display', 'inline-block');
|
|
|
662 |
$("#search-by-ticketId").val(searchTerm);
|
|
|
663 |
}
|
|
|
664 |
});
|
|
|
665 |
}
|
| 24439 |
govind |
666 |
}
|
| 24417 |
govind |
667 |
function loadCreateTicket(domId) {
|
|
|
668 |
doGetAjaxRequestHandler(context + "/cs/createTicket", function(response) {
|
|
|
669 |
$('#' + domId).html(response);
|
|
|
670 |
});
|
|
|
671 |
}
|
|
|
672 |
function loadticketSubCategoryById(ticketCategoryId) {
|
|
|
673 |
doGetAjaxRequestHandler(context
|
|
|
674 |
+ "/cs/getSubCategoryByCategoryId?ticketCategoryId="
|
|
|
675 |
+ ticketCategoryId, function(response) {
|
|
|
676 |
$(".ticket-sub-category-container").html(response);
|
|
|
677 |
});
|
|
|
678 |
}
|
|
|
679 |
function createPartnerRegion(domId, regionId, fofoIds) {
|
|
|
680 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
681 |
+ "/cs/createPartnerRegion?regionId=" + regionId, JSON
|
|
|
682 |
.stringify(fofoIds), function(response) {
|
|
|
683 |
if (response == "true") {
|
|
|
684 |
alert("added region to partner successfully");
|
|
|
685 |
loadCreatePartnerRegion(domId);
|
|
|
686 |
}
|
|
|
687 |
});
|
|
|
688 |
}
|
|
|
689 |
function createSubCategory(domId, name, description, categoryId) {
|
|
|
690 |
var params = {
|
|
|
691 |
"categoryId" : categoryId,
|
|
|
692 |
"name" : name,
|
|
|
693 |
"description" : description
|
|
|
694 |
}
|
|
|
695 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createSubCategory",
|
|
|
696 |
params, function(response) {
|
|
|
697 |
alert("Sub Category created successfully");
|
|
|
698 |
loadCreateSubCategory(domId);
|
|
|
699 |
});
|
|
|
700 |
}
|
| 24620 |
govind |
701 |
function createLastActivity(ticketId, activity) {
|
|
|
702 |
var params = {
|
|
|
703 |
"ticketId" : ticketId,
|
|
|
704 |
"lastactivity" : activity
|
|
|
705 |
}
|
|
|
706 |
doPostAjaxRequestWithParamsHandler(context + "/cs/create-last-activity",
|
|
|
707 |
params, function(response) {
|
|
|
708 |
if (response == "true") {
|
|
|
709 |
alert("successfully mark last activity");
|
| 24699 |
govind |
710 |
loadMyTicket("main-content", null, null);
|
| 24620 |
govind |
711 |
}
|
|
|
712 |
});
|
|
|
713 |
}
|
| 24439 |
govind |
714 |
|
| 24417 |
govind |
715 |
function createPosition(domId, authUserId, categoryId, escalationType, regionId) {
|
|
|
716 |
var params = {
|
|
|
717 |
"authUserId" : authUserId,
|
|
|
718 |
"categoryId" : categoryId,
|
|
|
719 |
"escalationType" : escalationType,
|
|
|
720 |
"regionId" : regionId
|
|
|
721 |
}
|
|
|
722 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createPosition", params,
|
|
|
723 |
function(response) {
|
|
|
724 |
if (response == "true") {
|
|
|
725 |
alert("Position created successfully");
|
|
|
726 |
loadCreatePosition(domId);
|
|
|
727 |
}
|
|
|
728 |
});
|
|
|
729 |
}
|
|
|
730 |
function createActivity(message, ticketId, assigneeId) {
|
|
|
731 |
var params = {
|
|
|
732 |
"message" : message,
|
|
|
733 |
"ticketId" : ticketId,
|
| 24534 |
govind |
734 |
"assigneeId" : assigneeId,
|
| 24417 |
govind |
735 |
}
|
|
|
736 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createActivity", params,
|
|
|
737 |
function(response) {
|
|
|
738 |
response = JSON.parse(response);
|
|
|
739 |
var assigneeName = response.firstName;
|
|
|
740 |
loadActivities(ticketId, assigneeName)
|
|
|
741 |
});
|
|
|
742 |
}
|
| 24471 |
govind |
743 |
function loadEditTicket(ticketId) {
|
|
|
744 |
doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
|
|
|
745 |
function(response) {
|
|
|
746 |
$(".modal-content").html(response);
|
|
|
747 |
});
|
| 24467 |
govind |
748 |
}
|
| 24557 |
govind |
749 |
function loadPartnerForRegion(regionId) {
|
|
|
750 |
doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
|
|
|
751 |
function(response) {
|
|
|
752 |
$("#partner-region-container").html(response);
|
|
|
753 |
});
|
|
|
754 |
}
|
| 24417 |
govind |
755 |
function loadActivities(ticketId, assignee) {
|
|
|
756 |
|
| 24469 |
govind |
757 |
$(".activity-container .modal-body").empty();
|
| 24417 |
govind |
758 |
$("#activityMessage").val("");
|
|
|
759 |
$("#ticketIdforactivity").val(ticketId);
|
|
|
760 |
console.log(ticketId);
|
|
|
761 |
doGetAjaxRequestHandler(
|
|
|
762 |
context + "/cs/getActivities?ticketId=" + ticketId,
|
|
|
763 |
function(response) {
|
|
|
764 |
response = JSON.parse(response);
|
|
|
765 |
console.log(response);
|
|
|
766 |
for (var i = 0; i < response.length; i++) {
|
|
|
767 |
if ((response[i].type == "OPENED" || response[i].type == "COMMUNICATION_IN")
|
|
|
768 |
&& response[i].createdBy == 0) {
|
|
|
769 |
|
|
|
770 |
var partnerMessage = "<div class=\"incoming_msg\">"
|
|
|
771 |
+ "<div class=\"received_msg\">"
|
|
|
772 |
+ "<div class=\"received_withd_msg\">" + "<p>"
|
|
|
773 |
+ response[i].message + "</p>"
|
|
|
774 |
+ "<span class=\"time_date\"> "
|
|
|
775 |
+ response[i].createTimestamp.hour + ":"
|
|
|
776 |
+ response[i].createTimestamp.minute + "|"
|
|
|
777 |
+ response[i].createTimestamp.dayOfMonth + "/"
|
|
|
778 |
+ response[i].createTimestamp.monthValue + "/"
|
|
|
779 |
+ response[i].createTimestamp.year
|
|
|
780 |
+ "</span></div>" + "</div>" + "</div>";
|
| 24471 |
govind |
781 |
$(".activity-container .modal-body").append(
|
|
|
782 |
partnerMessage);
|
| 24417 |
govind |
783 |
}
|
|
|
784 |
if (response[i].type = "COMMUNICATION_OUT"
|
|
|
785 |
&& response[i].createdBy > 0) {
|
| 24620 |
govind |
786 |
if (response[i].name) {
|
| 24574 |
govind |
787 |
var assigneeMessage = "<div class=\"outgoing_msg\">"
|
| 24620 |
govind |
788 |
+ "<div class=\"sent_msg\">"
|
|
|
789 |
+ "<span style=color:green>"
|
|
|
790 |
+ "~"
|
|
|
791 |
+ response[i].name
|
|
|
792 |
+ "<p>"
|
|
|
793 |
+ response[i].message
|
|
|
794 |
+ "</span></p>"
|
|
|
795 |
+ "<span class=\"time_date\">"
|
|
|
796 |
+ response[i].createTimestamp.hour
|
|
|
797 |
+ ":"
|
|
|
798 |
+ response[i].createTimestamp.minute
|
|
|
799 |
+ "|"
|
|
|
800 |
+ response[i].createTimestamp.dayOfMonth
|
|
|
801 |
+ "/"
|
|
|
802 |
+ response[i].createTimestamp.monthValue
|
|
|
803 |
+ "/"
|
|
|
804 |
+ response[i].createTimestamp.year
|
|
|
805 |
+ "</span> </div>" + "</div>";
|
|
|
806 |
} else {
|
|
|
807 |
var assigneeMessage = "<div class=\"outgoing_msg\">"
|
|
|
808 |
+ "<div class=\"sent_msg\">"
|
|
|
809 |
+ "<p>"
|
|
|
810 |
+ response[i].message
|
|
|
811 |
+ "</span></p>"
|
|
|
812 |
+ "<span class=\"time_date\">"
|
|
|
813 |
+ response[i].createTimestamp.hour
|
|
|
814 |
+ ":"
|
|
|
815 |
+ response[i].createTimestamp.minute
|
|
|
816 |
+ "|"
|
|
|
817 |
+ response[i].createTimestamp.dayOfMonth
|
|
|
818 |
+ "/"
|
|
|
819 |
+ response[i].createTimestamp.monthValue
|
|
|
820 |
+ "/"
|
|
|
821 |
+ response[i].createTimestamp.year
|
|
|
822 |
+ "</span> </div>" + "</div>";
|
|
|
823 |
}
|
| 24471 |
govind |
824 |
$(".activity-container .modal-body").append(
|
|
|
825 |
assigneeMessage);
|
| 24417 |
govind |
826 |
}
|
|
|
827 |
}
|
|
|
828 |
});
|
|
|
829 |
}
|