| 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 |
});
|
| 24471 |
govind |
10 |
|
| 24557 |
govind |
11 |
$("#region").live('change', function() {
|
|
|
12 |
var regionId=$("#region").val();
|
|
|
13 |
console.log(regionId);
|
|
|
14 |
loadPartnerForRegion(regionId);
|
|
|
15 |
});
|
|
|
16 |
|
| 24471 |
govind |
17 |
$(".change-ticket-button")
|
|
|
18 |
.live(
|
|
|
19 |
'click',
|
|
|
20 |
function() {
|
|
|
21 |
var ticketId = $("#ticketId").val();
|
|
|
22 |
var subCategory = $("#subCategory").val();
|
|
|
23 |
var authUserId = $("#authUser").val();
|
| 24534 |
govind |
24 |
var categoryId = $("#category").val();
|
| 24471 |
govind |
25 |
console.log(ticketId);
|
|
|
26 |
if (subCategory == null || subCategory == ""
|
|
|
27 |
|| subCategory == undefined) {
|
|
|
28 |
alert("Choose appropriate subCategory");
|
| 24500 |
govind |
29 |
return false;
|
| 24471 |
govind |
30 |
}
|
| 24500 |
govind |
31 |
console.log(authUserId);
|
| 24471 |
govind |
32 |
if (confirm("Are you sure you want to change ticket!") == true) {
|
| 24534 |
govind |
33 |
changeTicket(ticketId, subCategory, authUserId,
|
|
|
34 |
categoryId);
|
| 24471 |
govind |
35 |
}
|
|
|
36 |
});
|
| 24439 |
govind |
37 |
$("#edit-ticket").live('click', function() {
|
| 24471 |
govind |
38 |
|
|
|
39 |
var ticketId = $(this).data('ticketid1');
|
| 24467 |
govind |
40 |
console.log(ticketId);
|
|
|
41 |
loadEditTicket(ticketId);
|
| 24439 |
govind |
42 |
});
|
|
|
43 |
$(".manager-ticket").live('click', function() {
|
|
|
44 |
loadManagerTicket("main-content");
|
|
|
45 |
});
|
| 24417 |
govind |
46 |
$(".ticketType").live('click', function() {
|
| 24534 |
govind |
47 |
console.log("create Region");
|
| 24417 |
govind |
48 |
loadCreateRegion("main-content");
|
|
|
49 |
});
|
| 24469 |
govind |
50 |
$("#activities").live('click', function() {
|
| 24417 |
govind |
51 |
var ticketId = $(this).data('ticketid');
|
|
|
52 |
var assignee = $(this).data('assignee');
|
|
|
53 |
console.log(assignee);
|
|
|
54 |
loadActivities(ticketId, assignee);
|
|
|
55 |
});
|
|
|
56 |
$(".my-ticket").live('click', function() {
|
| 24534 |
govind |
57 |
loadMyTicket("main-content", null, null);
|
| 24417 |
govind |
58 |
});
|
|
|
59 |
$("#close-ticket").live('click', function() {
|
|
|
60 |
var ticketId = $(this).data('ticketid');
|
| 24439 |
govind |
61 |
closeTicket(ticketId);
|
| 24417 |
govind |
62 |
});
|
|
|
63 |
$(".submit-message-button").live('click', function() {
|
|
|
64 |
var message = $("#activityMessage").val();
|
|
|
65 |
if (message == "" || message == null || message == undefined) {
|
|
|
66 |
alert("message field can't be empty");
|
| 24500 |
govind |
67 |
return false;
|
| 24417 |
govind |
68 |
}
|
|
|
69 |
var ticketId = $("#ticketIdforactivity").val();
|
|
|
70 |
var assignee = $("#assigneeUser").val();
|
|
|
71 |
console.log(message, ticketId, assignee);
|
|
|
72 |
createActivity(message, ticketId, assignee);
|
|
|
73 |
});
|
|
|
74 |
|
|
|
75 |
$("#tickets-paginated .next").live(
|
|
|
76 |
'click',
|
|
|
77 |
function() {
|
|
|
78 |
loadPaginatedNextItems('/cs/myticketPaginated', null,
|
|
|
79 |
'tickets-paginated', 'my-ticket-table',
|
|
|
80 |
'ticket-details-container');
|
|
|
81 |
$(this).blur();
|
|
|
82 |
});
|
|
|
83 |
|
| 24467 |
govind |
84 |
$("#manager-tickets-paginated .previous").live(
|
|
|
85 |
'click',
|
|
|
86 |
function() {
|
|
|
87 |
loadPaginatedPreviousItems('/cs/managerTicket-paginated', null,
|
|
|
88 |
'manager-tickets-paginated', 'manager-ticket-table',
|
|
|
89 |
'manager-ticket-details-container');
|
|
|
90 |
$(this).blur();
|
|
|
91 |
});
|
|
|
92 |
$("#manager-tickets-paginated .next").live(
|
|
|
93 |
'click',
|
|
|
94 |
function() {
|
|
|
95 |
loadPaginatedNextItems('/cs/managerTicket-paginated', null,
|
|
|
96 |
'manager-tickets-paginated', 'manager-ticket-table',
|
|
|
97 |
'manager-ticket-details-container');
|
|
|
98 |
$(this).blur();
|
|
|
99 |
});
|
|
|
100 |
|
| 24417 |
govind |
101 |
$("#tickets-paginated .previous").live(
|
|
|
102 |
'click',
|
|
|
103 |
function() {
|
|
|
104 |
loadPaginatedPreviousItems('/cs/myticketPaginated', null,
|
|
|
105 |
'tickets-paginated', 'my-ticket-table',
|
|
|
106 |
'ticket-details-container');
|
| 24467 |
govind |
107 |
$(this).blur();
|
| 24417 |
govind |
108 |
});
|
| 24471 |
govind |
109 |
$("#positions-paginated .next").live(
|
|
|
110 |
'click',
|
|
|
111 |
function() {
|
|
|
112 |
loadPaginatedNextItems('/cs/position-paginated', null,
|
|
|
113 |
'positions-paginated', 'position-table',
|
|
|
114 |
'position-details-container');
|
|
|
115 |
$(this).blur();
|
|
|
116 |
});
|
| 24417 |
govind |
117 |
|
| 24471 |
govind |
118 |
$("#positions-paginated .previous").live(
|
|
|
119 |
'click',
|
|
|
120 |
function() {
|
|
|
121 |
loadPaginatedPreviousItems('/cs/position-paginated', null,
|
|
|
122 |
'positions-paginated', 'position-table',
|
|
|
123 |
'position-details-container');
|
|
|
124 |
$(this).blur();
|
|
|
125 |
});
|
|
|
126 |
|
| 24417 |
govind |
127 |
$(".create-partner-region").live('click', function() {
|
|
|
128 |
loadCreatePartnerRegion("main-content");
|
|
|
129 |
});
|
|
|
130 |
$(".create-ticket").live('click', function() {
|
|
|
131 |
loadCreateTicket("main-content");
|
|
|
132 |
});
|
|
|
133 |
$(".create-ticket-button")
|
|
|
134 |
.live(
|
|
|
135 |
'click',
|
|
|
136 |
function() {
|
|
|
137 |
var categoryId = $('#category').val();
|
|
|
138 |
var subCategoryId = $('#subCategory').val();
|
|
|
139 |
if (categoryId == "" || categoryId == null
|
|
|
140 |
|| categoryId == undefined) {
|
|
|
141 |
alert("select appropriate category");
|
|
|
142 |
return false;
|
|
|
143 |
}
|
|
|
144 |
if (subCategoryId == "" || subCategoryId == null
|
|
|
145 |
|| subCategoryId == undefined) {
|
|
|
146 |
alert("select appropriate subCategoryId");
|
|
|
147 |
return false;
|
|
|
148 |
}
|
|
|
149 |
var dialog = bootbox
|
|
|
150 |
.dialog({
|
|
|
151 |
title : "Are you sure want to change create ticket!",
|
|
|
152 |
message : "<div class=form-inline'>"
|
|
|
153 |
+ "<label for='message'>Message:</label>"
|
|
|
154 |
+ "<textarea class='form-control' rows='2' id='message'></textarea>"
|
|
|
155 |
+ "</div>",
|
|
|
156 |
buttons : {
|
|
|
157 |
cancel : {
|
|
|
158 |
label : "cancel",
|
|
|
159 |
className : 'btn-danger',
|
|
|
160 |
callback : function() {
|
|
|
161 |
loadCreateTicket("main-content");
|
|
|
162 |
}
|
|
|
163 |
},
|
|
|
164 |
ok : {
|
|
|
165 |
label : "ok",
|
|
|
166 |
className : 'btn-info',
|
|
|
167 |
callback : function() {
|
|
|
168 |
message = $('#message').val();
|
|
|
169 |
console.log(message);
|
|
|
170 |
if (message == ""
|
|
|
171 |
|| message == null
|
|
|
172 |
|| message == undefined) {
|
|
|
173 |
alert("message field can't be empty");
|
|
|
174 |
return false;
|
|
|
175 |
}
|
|
|
176 |
var params = {
|
|
|
177 |
"categoryId" : categoryId,
|
|
|
178 |
"subCategoryId" : subCategoryId,
|
|
|
179 |
"message" : message
|
|
|
180 |
}
|
|
|
181 |
doPostAjaxRequestWithParamsHandler(
|
|
|
182 |
context
|
|
|
183 |
+ "/cs/createTicket",
|
|
|
184 |
params,
|
|
|
185 |
function(response) {
|
|
|
186 |
if (response == "true") {
|
|
|
187 |
alert("successfully created");
|
|
|
188 |
loadCreateTicket("main-content");
|
|
|
189 |
}
|
|
|
190 |
});
|
|
|
191 |
|
|
|
192 |
}
|
|
|
193 |
}
|
|
|
194 |
}
|
|
|
195 |
});
|
|
|
196 |
|
|
|
197 |
});
|
|
|
198 |
$(".create-position").live('click', function() {
|
|
|
199 |
loadCreatePosition("main-content");
|
|
|
200 |
});
|
|
|
201 |
|
| 24534 |
govind |
202 |
$("#ticketStatus").live('change', function() {
|
|
|
203 |
var status = $("#ticketStatus").val();
|
|
|
204 |
var sortOrder = $("#sortOrder").val();
|
|
|
205 |
console.log(status);
|
|
|
206 |
console.log(sortOrder);
|
|
|
207 |
loadMyTicket("main-content", status, sortOrder);
|
|
|
208 |
});
|
|
|
209 |
$("#sortOrder").live('change', function() {
|
|
|
210 |
var status = $("#ticketStatus").val();
|
|
|
211 |
var sortOrder = $("#sortOrder").val();
|
|
|
212 |
console.log(status);
|
|
|
213 |
console.log(sortOrder);
|
|
|
214 |
loadMyTicket("main-content", status, sortOrder);
|
|
|
215 |
});
|
| 24417 |
govind |
216 |
$("#category").live('change', function() {
|
|
|
217 |
var categoryId = $("#category").val();
|
| 24500 |
govind |
218 |
$("#auth-user-for-category").hide();
|
| 24417 |
govind |
219 |
loadSubCategories(categoryId);
|
|
|
220 |
});
|
|
|
221 |
$(".create-ticket-category-button")
|
|
|
222 |
.live(
|
|
|
223 |
'click',
|
|
|
224 |
function() {
|
|
|
225 |
console
|
|
|
226 |
.log("create-ticket-category-button clicked......");
|
|
|
227 |
var name = $("#categoryName").val();
|
|
|
228 |
var description = $("#categorydescription").val();
|
|
|
229 |
console.log(name, description);
|
|
|
230 |
if (name == "" || name == null || name == undefined) {
|
|
|
231 |
alert("Name field can't be empty");
|
|
|
232 |
return false;
|
|
|
233 |
}
|
|
|
234 |
if (description == "" || description == null
|
|
|
235 |
|| description == undefined) {
|
|
|
236 |
alert("Description field can't be empty");
|
|
|
237 |
return false;
|
|
|
238 |
}
|
|
|
239 |
if (confirm("Are you sure you want to create ticket category!") == true) {
|
|
|
240 |
createCategory("main-content", name, description);
|
|
|
241 |
}
|
|
|
242 |
});
|
|
|
243 |
$(".create-region-button")
|
|
|
244 |
.live(
|
|
|
245 |
'click',
|
|
|
246 |
function() {
|
|
|
247 |
var name = $("#regionName").val();
|
|
|
248 |
var description = $("#regiondescription").val();
|
|
|
249 |
if (name == "" || name == null || name == undefined) {
|
|
|
250 |
alert("Name field can't be empty");
|
|
|
251 |
return false;
|
|
|
252 |
}
|
|
|
253 |
if (description == "" || description == null
|
|
|
254 |
|| description == undefined) {
|
|
|
255 |
alert("Description field can't be empty");
|
|
|
256 |
return false;
|
|
|
257 |
}
|
|
|
258 |
if (confirm("Are you sure you want to create region!") == true) {
|
|
|
259 |
createRegion("main-content", name, description);
|
|
|
260 |
}
|
|
|
261 |
});
|
|
|
262 |
|
|
|
263 |
$(".create-partner-region-button")
|
|
|
264 |
.live(
|
|
|
265 |
'click',
|
|
|
266 |
function() {
|
|
|
267 |
|
|
|
268 |
var regionId = $("#region").val();
|
|
|
269 |
var fofoIds = $("#partner").val();
|
|
|
270 |
console.log(regionId, fofoIds);
|
|
|
271 |
if (regionId == "" || regionId == null
|
|
|
272 |
|| regionId == undefined) {
|
|
|
273 |
alert("regionId field can't be empty");
|
|
|
274 |
return false;
|
|
|
275 |
}
|
|
|
276 |
if (fofoIds == "" || fofoIds == null
|
|
|
277 |
|| fofoIds == undefined) {
|
|
|
278 |
alert("select appropriate partner");
|
|
|
279 |
return false;
|
|
|
280 |
}
|
|
|
281 |
if (confirm("Are you sure you want to create partner region!") == true) {
|
|
|
282 |
createPartnerRegion("main-content", regionId,
|
|
|
283 |
fofoIds);
|
|
|
284 |
}
|
|
|
285 |
});
|
|
|
286 |
$(".create-position-button")
|
|
|
287 |
.live(
|
|
|
288 |
'click',
|
|
|
289 |
function() {
|
|
|
290 |
|
|
|
291 |
var authUser = $("#authUser").val();
|
|
|
292 |
var ticketCategoryPosition = $(
|
|
|
293 |
"#ticketCategoryPosition").val();
|
|
|
294 |
var escalationType = $("#escalationType").val();
|
|
|
295 |
var regionPosition = $("#regionPosition").val();
|
|
|
296 |
console.log(authUser, ticketCategoryPosition,
|
|
|
297 |
escalationType, regionPosition);
|
|
|
298 |
if (authUser == "" || authUser == null
|
|
|
299 |
|| authUser == undefined) {
|
|
|
300 |
alert("select appropriate authUser");
|
|
|
301 |
return false;
|
|
|
302 |
}
|
|
|
303 |
if (ticketCategoryPosition == ""
|
|
|
304 |
|| ticketCategoryPosition == null
|
|
|
305 |
|| ticketCategoryPosition == undefined) {
|
|
|
306 |
alert("select appropriate category");
|
|
|
307 |
return false;
|
|
|
308 |
}
|
|
|
309 |
if (escalationType == "" || escalationType == null
|
|
|
310 |
|| escalationType == undefined) {
|
|
|
311 |
alert("select appropriate escalationType");
|
|
|
312 |
return false;
|
|
|
313 |
}
|
|
|
314 |
if (regionPosition == "" || regionPosition == null
|
|
|
315 |
|| regionPosition == undefined) {
|
|
|
316 |
alert("select appropriate Region");
|
|
|
317 |
return false;
|
|
|
318 |
}
|
|
|
319 |
if (confirm("Are you sure you want to create Position!") == true) {
|
|
|
320 |
createPosition("main-content", authUser,
|
|
|
321 |
ticketCategoryPosition, escalationType,
|
|
|
322 |
regionPosition);
|
|
|
323 |
}
|
|
|
324 |
});
|
|
|
325 |
|
|
|
326 |
$("#ticketCategory").live('change', function() {
|
|
|
327 |
console.log("change ticket category clicked......");
|
|
|
328 |
var ticketCategoryId = $(this).val();
|
|
|
329 |
console.log(ticketCategoryId);
|
|
|
330 |
loadticketSubCategoryById(ticketCategoryId);
|
|
|
331 |
});
|
|
|
332 |
$(".create-ticket-sub-category").live('click', function() {
|
|
|
333 |
console.log("create ticket category clicked......");
|
|
|
334 |
loadCreateSubCategory("main-content");
|
|
|
335 |
});
|
|
|
336 |
|
|
|
337 |
$(".create-ticket-sub-category-button")
|
|
|
338 |
.live(
|
|
|
339 |
'click',
|
|
|
340 |
function() {
|
|
|
341 |
console
|
|
|
342 |
.log("create-ticket-category-button clicked......");
|
|
|
343 |
var name = $("#subcategoryName").val();
|
|
|
344 |
var description = $("#subcategorydescription").val();
|
|
|
345 |
var ticketCategoryId = $("#ticketCategory").val();
|
|
|
346 |
console.log(name, description);
|
|
|
347 |
if (name == "" || name == null || name == undefined) {
|
|
|
348 |
alert("Name field can't be empty");
|
|
|
349 |
return false;
|
|
|
350 |
}
|
|
|
351 |
if (description == "" || description == null
|
|
|
352 |
|| description == undefined) {
|
|
|
353 |
alert("Description field can't be empty");
|
|
|
354 |
return false;
|
|
|
355 |
}
|
|
|
356 |
if (ticketCategoryId == "" || ticketCategoryId == null
|
|
|
357 |
|| ticketCategoryId == undefined) {
|
|
|
358 |
alert("select appropriate category name");
|
|
|
359 |
return false;
|
|
|
360 |
}
|
|
|
361 |
if (confirm("Are you sure you want to create ticket category!") == true) {
|
|
|
362 |
createSubCategory("main-content", name,
|
|
|
363 |
description, ticketCategoryId);
|
|
|
364 |
}
|
|
|
365 |
});
|
| 24471 |
govind |
366 |
$(".remove-position").live('click', function() {
|
|
|
367 |
var positionId = $(this).data('positionid');
|
|
|
368 |
if (confirm("Are you sure you want to remove position!") == true) {
|
| 24534 |
govind |
369 |
removePosition(positionId);
|
| 24471 |
govind |
370 |
}
|
|
|
371 |
});
|
| 24417 |
govind |
372 |
|
|
|
373 |
});
|
|
|
374 |
|
|
|
375 |
function loadCreateCategory(domId) {
|
|
|
376 |
doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
|
|
|
377 |
$('#' + domId).html(response);
|
|
|
378 |
});
|
|
|
379 |
}
|
| 24534 |
govind |
380 |
function removePosition(positionId) {
|
|
|
381 |
doDeleteAjaxRequestHandler(context + "/cs/removePosition?positionId="
|
|
|
382 |
+ positionId, function(response) {
|
| 24471 |
govind |
383 |
if (response == "true") {
|
|
|
384 |
alert("Position removed successfully");
|
|
|
385 |
loadCreatePosition("main-content");
|
|
|
386 |
}
|
|
|
387 |
});
|
|
|
388 |
}
|
| 24417 |
govind |
389 |
|
|
|
390 |
function loadCreateRegion(domId) {
|
|
|
391 |
doGetAjaxRequestHandler(context + "/cs/createRegion", function(response) {
|
|
|
392 |
$('#' + domId).html(response);
|
|
|
393 |
});
|
|
|
394 |
}
|
| 24534 |
govind |
395 |
function loadMyTicket(domId, status, orderBy) {
|
|
|
396 |
if (status == null && orderBy == null) {
|
|
|
397 |
doGetAjaxRequestHandler(context + "/cs/myticket", function(response) {
|
|
|
398 |
$('#' + domId).html(response);
|
|
|
399 |
});
|
|
|
400 |
} else {
|
|
|
401 |
doGetAjaxRequestHandler(context + "/cs/myticket?status=" + status
|
|
|
402 |
+ "&orderBy=" + orderBy, function(response) {
|
|
|
403 |
$('#' + domId).html(response);
|
|
|
404 |
});
|
|
|
405 |
}
|
| 24417 |
govind |
406 |
}
|
|
|
407 |
|
|
|
408 |
function loadCreatePartnerRegion(domId) {
|
|
|
409 |
doGetAjaxRequestHandler(context + "/cs/createPartnerRegion", function(
|
|
|
410 |
response) {
|
|
|
411 |
$('#' + domId).html(response);
|
|
|
412 |
});
|
|
|
413 |
}
|
|
|
414 |
function loadCreatePosition(domId) {
|
|
|
415 |
doGetAjaxRequestHandler(context + "/cs/createPosition", function(response) {
|
|
|
416 |
$('#' + domId).html(response);
|
|
|
417 |
});
|
|
|
418 |
}
|
|
|
419 |
function loadSubCategories(categoryId) {
|
|
|
420 |
doGetAjaxRequestHandler(context
|
|
|
421 |
+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
|
|
|
422 |
function(response) {
|
|
|
423 |
$('#' + "create-ticket-sub-categories").html(response);
|
|
|
424 |
});
|
|
|
425 |
}
|
|
|
426 |
function createCategory(domId, name, description) {
|
|
|
427 |
var params = {
|
|
|
428 |
"name" : name,
|
|
|
429 |
"description" : description
|
|
|
430 |
}
|
|
|
431 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createCategory", params,
|
|
|
432 |
function(response) {
|
|
|
433 |
alert("Category created successfully");
|
|
|
434 |
loadCreateCategory(domId);
|
|
|
435 |
});
|
|
|
436 |
}
|
| 24534 |
govind |
437 |
function changeTicket(ticketId, subCategoryId, authUserId, categoryId) {
|
| 24467 |
govind |
438 |
var params = {
|
| 24471 |
govind |
439 |
"ticketId" : ticketId,
|
|
|
440 |
"subCategoryId" : subCategoryId,
|
| 24500 |
govind |
441 |
"authUserId" : authUserId,
|
| 24534 |
govind |
442 |
"categoryId" : categoryId
|
| 24471 |
govind |
443 |
}
|
|
|
444 |
doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
|
|
|
445 |
function(response) {
|
|
|
446 |
if (response == "true") {
|
|
|
447 |
alert("Ticket changed successfully");
|
|
|
448 |
loadManagerTicket("main-content");
|
|
|
449 |
}
|
|
|
450 |
});
|
| 24467 |
govind |
451 |
}
|
| 24417 |
govind |
452 |
function createRegion(domId, name, description) {
|
|
|
453 |
var params = {
|
|
|
454 |
"name" : name,
|
|
|
455 |
"description" : description
|
|
|
456 |
}
|
|
|
457 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createRegion", params,
|
|
|
458 |
function(response) {
|
|
|
459 |
if (response == "true") {
|
|
|
460 |
alert("Region created successfully");
|
|
|
461 |
loadCreateRegion(domId);
|
|
|
462 |
}
|
|
|
463 |
});
|
|
|
464 |
}
|
|
|
465 |
function loadCreateSubCategory(domId) {
|
|
|
466 |
doGetAjaxRequestHandler(context + "/cs/createSubCategory", function(
|
|
|
467 |
response) {
|
|
|
468 |
$('#' + domId).html(response);
|
|
|
469 |
});
|
|
|
470 |
}
|
| 24471 |
govind |
471 |
function loadManagerTicket(domId) {
|
|
|
472 |
doGetAjaxRequestHandler(context + "/cs/managerTicket", function(response) {
|
| 24439 |
govind |
473 |
$('#' + domId).html(response);
|
|
|
474 |
});
|
|
|
475 |
}
|
| 24417 |
govind |
476 |
function loadCreateTicket(domId) {
|
|
|
477 |
doGetAjaxRequestHandler(context + "/cs/createTicket", function(response) {
|
|
|
478 |
$('#' + domId).html(response);
|
|
|
479 |
});
|
|
|
480 |
}
|
|
|
481 |
function loadticketSubCategoryById(ticketCategoryId) {
|
|
|
482 |
doGetAjaxRequestHandler(context
|
|
|
483 |
+ "/cs/getSubCategoryByCategoryId?ticketCategoryId="
|
|
|
484 |
+ ticketCategoryId, function(response) {
|
|
|
485 |
$(".ticket-sub-category-container").html(response);
|
|
|
486 |
});
|
|
|
487 |
}
|
|
|
488 |
function createPartnerRegion(domId, regionId, fofoIds) {
|
|
|
489 |
doPostAjaxRequestWithJsonHandler(context
|
|
|
490 |
+ "/cs/createPartnerRegion?regionId=" + regionId, JSON
|
|
|
491 |
.stringify(fofoIds), function(response) {
|
|
|
492 |
if (response == "true") {
|
|
|
493 |
alert("added region to partner successfully");
|
|
|
494 |
loadCreatePartnerRegion(domId);
|
|
|
495 |
}
|
|
|
496 |
});
|
|
|
497 |
}
|
|
|
498 |
function createSubCategory(domId, name, description, categoryId) {
|
|
|
499 |
var params = {
|
|
|
500 |
"categoryId" : categoryId,
|
|
|
501 |
"name" : name,
|
|
|
502 |
"description" : description
|
|
|
503 |
}
|
|
|
504 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createSubCategory",
|
|
|
505 |
params, function(response) {
|
|
|
506 |
alert("Sub Category created successfully");
|
|
|
507 |
loadCreateSubCategory(domId);
|
|
|
508 |
});
|
|
|
509 |
}
|
|
|
510 |
function closeTicket(ticketId) {
|
| 24439 |
govind |
511 |
var dialog = bootbox
|
|
|
512 |
.dialog({
|
|
|
513 |
title : "Are you sure want to close ticket!",
|
|
|
514 |
message : "<div class=\"col-lg-6 form-group\">"
|
|
|
515 |
+ "<input placeholder=\"Happy Code\" id=\"happyCode\" name=\"happyCode\" type=\"text\" class=\"form-control input-sm\">"
|
|
|
516 |
+ "</div>",
|
|
|
517 |
buttons : {
|
|
|
518 |
cancel : {
|
|
|
519 |
label : "cancel",
|
|
|
520 |
className : 'btn-danger',
|
|
|
521 |
callback : function() {
|
|
|
522 |
loadMyTicket("main-content");
|
|
|
523 |
}
|
|
|
524 |
},
|
|
|
525 |
ok : {
|
|
|
526 |
label : "ok",
|
|
|
527 |
className : 'btn-info',
|
|
|
528 |
callback : function() {
|
|
|
529 |
happyCode = $('#happyCode').val();
|
|
|
530 |
console.log(happyCode);
|
|
|
531 |
if (happyCode == "" || happyCode == null
|
|
|
532 |
|| happyCode == undefined) {
|
|
|
533 |
alert("happyCode field can't be empty");
|
|
|
534 |
return false;
|
|
|
535 |
}
|
|
|
536 |
var params = {
|
|
|
537 |
"ticketId" : ticketId,
|
|
|
538 |
"happyCode" : happyCode
|
|
|
539 |
}
|
|
|
540 |
doPostAjaxRequestWithParamsHandler(context
|
|
|
541 |
+ "/cs/closeTicket", params, function(
|
|
|
542 |
response) {
|
|
|
543 |
alert("Ticket close successfully");
|
|
|
544 |
loadMyTicket("main-content");
|
|
|
545 |
});
|
|
|
546 |
}
|
|
|
547 |
}
|
|
|
548 |
}
|
| 24417 |
govind |
549 |
});
|
| 24439 |
govind |
550 |
|
| 24417 |
govind |
551 |
}
|
|
|
552 |
function createPosition(domId, authUserId, categoryId, escalationType, regionId) {
|
|
|
553 |
var params = {
|
|
|
554 |
"authUserId" : authUserId,
|
|
|
555 |
"categoryId" : categoryId,
|
|
|
556 |
"escalationType" : escalationType,
|
|
|
557 |
"regionId" : regionId
|
|
|
558 |
}
|
|
|
559 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createPosition", params,
|
|
|
560 |
function(response) {
|
|
|
561 |
if (response == "true") {
|
|
|
562 |
alert("Position created successfully");
|
|
|
563 |
loadCreatePosition(domId);
|
|
|
564 |
}
|
|
|
565 |
});
|
|
|
566 |
}
|
|
|
567 |
function createActivity(message, ticketId, assigneeId) {
|
|
|
568 |
var params = {
|
|
|
569 |
"message" : message,
|
|
|
570 |
"ticketId" : ticketId,
|
| 24534 |
govind |
571 |
"assigneeId" : assigneeId,
|
| 24417 |
govind |
572 |
}
|
|
|
573 |
doPostAjaxRequestWithParamsHandler(context + "/cs/createActivity", params,
|
|
|
574 |
function(response) {
|
|
|
575 |
response = JSON.parse(response);
|
|
|
576 |
var assigneeName = response.firstName;
|
|
|
577 |
loadActivities(ticketId, assigneeName)
|
|
|
578 |
});
|
|
|
579 |
}
|
| 24471 |
govind |
580 |
function loadEditTicket(ticketId) {
|
|
|
581 |
doGetAjaxRequestHandler(context + "/cs/edit-ticket?ticketId=" + ticketId,
|
|
|
582 |
function(response) {
|
|
|
583 |
$(".modal-content").html(response);
|
|
|
584 |
});
|
| 24467 |
govind |
585 |
}
|
| 24557 |
govind |
586 |
function loadPartnerForRegion(regionId) {
|
|
|
587 |
doGetAjaxRequestHandler(context + "/cs/getPartners?regionId=" + regionId,
|
|
|
588 |
function(response) {
|
|
|
589 |
$("#partner-region-container").html(response);
|
|
|
590 |
});
|
|
|
591 |
}
|
| 24417 |
govind |
592 |
function loadActivities(ticketId, assignee) {
|
|
|
593 |
|
| 24469 |
govind |
594 |
$(".activity-container .modal-body").empty();
|
| 24417 |
govind |
595 |
$("#activityMessage").val("");
|
|
|
596 |
$("#ticketIdforactivity").val(ticketId);
|
|
|
597 |
console.log(ticketId);
|
|
|
598 |
doGetAjaxRequestHandler(
|
|
|
599 |
context + "/cs/getActivities?ticketId=" + ticketId,
|
|
|
600 |
function(response) {
|
|
|
601 |
response = JSON.parse(response);
|
|
|
602 |
console.log(response);
|
|
|
603 |
for (var i = 0; i < response.length; i++) {
|
|
|
604 |
if ((response[i].type == "OPENED" || response[i].type == "COMMUNICATION_IN")
|
|
|
605 |
&& response[i].createdBy == 0) {
|
|
|
606 |
|
|
|
607 |
var partnerMessage = "<div class=\"incoming_msg\">"
|
|
|
608 |
+ "<div class=\"received_msg\">"
|
|
|
609 |
+ "<div class=\"received_withd_msg\">" + "<p>"
|
|
|
610 |
+ response[i].message + "</p>"
|
|
|
611 |
+ "<span class=\"time_date\"> "
|
|
|
612 |
+ response[i].createTimestamp.hour + ":"
|
|
|
613 |
+ response[i].createTimestamp.minute + "|"
|
|
|
614 |
+ response[i].createTimestamp.dayOfMonth + "/"
|
|
|
615 |
+ response[i].createTimestamp.monthValue + "/"
|
|
|
616 |
+ response[i].createTimestamp.year
|
|
|
617 |
+ "</span></div>" + "</div>" + "</div>";
|
| 24471 |
govind |
618 |
$(".activity-container .modal-body").append(
|
|
|
619 |
partnerMessage);
|
| 24417 |
govind |
620 |
}
|
|
|
621 |
if (response[i].type = "COMMUNICATION_OUT"
|
|
|
622 |
&& response[i].createdBy > 0) {
|
|
|
623 |
|
|
|
624 |
var assigneeMessage = "<div class=\"outgoing_msg\">"
|
|
|
625 |
+ "<div class=\"sent_msg\">" + "<p>"
|
|
|
626 |
+ response[i].message + "</p>"
|
|
|
627 |
+ "<span class=\"time_date\">"
|
|
|
628 |
+ response[i].createTimestamp.hour + ":"
|
|
|
629 |
+ response[i].createTimestamp.minute + "|"
|
|
|
630 |
+ response[i].createTimestamp.dayOfMonth + "/"
|
|
|
631 |
+ response[i].createTimestamp.monthValue + "/"
|
|
|
632 |
+ response[i].createTimestamp.year
|
|
|
633 |
+ "</span> </div>" + "</div>";
|
| 24471 |
govind |
634 |
|
|
|
635 |
$(".activity-container .modal-body").append(
|
|
|
636 |
assigneeMessage);
|
| 24417 |
govind |
637 |
}
|
|
|
638 |
}
|
|
|
639 |
});
|
|
|
640 |
}
|