Subversion Repositories SmartDukaan

Rev

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

Rev 31414 Rev 31762
Line 133... Line 133...
133
			$("#assignee-ticket-search-by-partner-name").data('id', '');
133
			$("#assignee-ticket-search-by-partner-name").data('id', '');
134
		}
134
		}
135
 
135
 
136
	});
136
	});
137
 
137
 
-
 
138
	$(document).on('click', ".change-ticket-auth-button",
-
 
139
		function() {
-
 
140
			var ticketId = $("#ticketId").val();
-
 
141
			var subCategory = $("#subCategory").val();
-
 
142
			var authUserId = $("#authUserCategory").val();
-
 
143
			var categoryId = $("#categoryAuth").val();
-
 
144
 
-
 
145
			var escalationType = $("#escalationType").val();
-
 
146
			console.log(ticketId);
-
 
147
			if (subCategory == null || subCategory == ""
-
 
148
				|| subCategory == undefined) {
-
 
149
				alert("Choose appropriate subCategory");
-
 
150
				return false;
-
 
151
			}
-
 
152
			console.log(subCategory);
-
 
153
			console.log(authUserId);
-
 
154
 
-
 
155
			console.log(categoryId);
-
 
156
 
-
 
157
			if (confirm("Are you sure you want to change ticket!") == true) {
-
 
158
				changeTicket(ticketId, subCategory, authUserId,
-
 
159
					categoryId, escalationType);
-
 
160
			}
-
 
161
		});
-
 
162
 
138
	$(document).on('click', ".change-ticket-button",
163
	$(document).on('click', ".change-ticket-button",
139
			function() {
164
		function() {
140
				var ticketId = $("#ticketId").val();
165
			var ticketId = $("#ticketId").val();
141
				var subCategory = $("#subCategory").val();
166
			var subCategory = $("#subCategory").val();
142
				var authUserId = $("#authUser").val();
167
			var authUserId;
143
				var categoryId = $("#category").val();
168
			var categoryId = $("#category").val();
-
 
169
 
-
 
170
			var escalationType = $("#escalationType").val();
144
				console.log(ticketId);
171
			console.log(ticketId);
145
				if (subCategory == null || subCategory == ""
172
			if (subCategory == null || subCategory == ""
146
					|| subCategory == undefined) {
173
				|| subCategory == undefined) {
147
					alert("Choose appropriate subCategory");
174
				alert("Choose appropriate subCategory");
148
					return false;
175
				return false;
149
				}
176
			}
-
 
177
 
-
 
178
			console.log(subCategory);
-
 
179
 
-
 
180
			console.log(categoryId);
150
				console.log(authUserId);
181
			console.log(authUserId);
151
				if (confirm("Are you sure you want to change ticket!") == true) {
182
			if (confirm("Are you sure you want to change ticket!") == true) {
152
					changeTicket(ticketId, subCategory, authUserId,
183
				changeTicket(ticketId, subCategory, authUserId,
153
						categoryId);
184
					categoryId, escalationType);
154
				}
185
			}
155
			});
186
		});
156
	$(document).on('click', "#edit-ticket", function() {
187
	$(document).on('click', "#edit-ticket", function() {
157
		var ticketId = $(this).data('ticketid1');
188
		var ticketId = $(this).data('ticketid1');
158
		loadEditTicket(ticketId);
189
		loadEditTicket(ticketId);
159
	});
190
	});
160
	$(document).on('click', ".manager-ticket", function() {
191
	$(document).on('click', ".manager-ticket", function() {
Line 210... Line 241...
210
	$(document).on('click', ".uploadFile", function() {
241
	$(document).on('click', ".uploadFile", function() {
211
		$("#file1").trigger('click');
242
		$("#file1").trigger('click');
212
	});
243
	});
213
 
244
 
214
	$(document).on('change', "input[name=file1]",
245
	$(document).on('change', "input[name=file1]",
215
			function(evt) {
246
		function(evt) {
216
				var output = [];
247
			var output = [];
217
				var fileBundle = [];
248
			var fileBundle = [];
218
				for (var i = 0, f; f = evt.target.files[i]; i++) {
249
			for (var i = 0, f; f = evt.target.files[i]; i++) {
219
					count++;
250
				count++;
220
					console.log(count);
251
				console.log(count);
221
					if (evt.target.files[i].size > 5000000) {
252
				if (evt.target.files[i].size > 5000000) {
222
						alert("Size should be less than 5MB");
253
					alert("Size should be less than 5MB");
223
						return false;
254
					return false;
224
					}
255
				}
225
 
256
 
226
					if (count > "5") {
257
				if (count > "5") {
227
						alert("five files send at a time");
258
					alert("five files send at a time");
228
						var lilength = $('.fileList li').size();
259
					var lilength = $('.fileList li').size();
229
						console.log(lilength);
260
					console.log(lilength);
230
						count = lilength;
261
					count = lilength;
231
						console.log(lilength)
262
					console.log(lilength)
232
						return false;
263
					return false;
233
					}
264
				}
234
 
265
 
235
					var file = evt.target.files[i];
266
				var file = evt.target.files[i];
236
					fileBundle.push(file);
267
				fileBundle.push(file);
237
					console.log(fileBundle);
268
				console.log(fileBundle);
238
 
269
 
239
					var removeLink = "<a class=\"removeFile\" href=\"#\" data-fileid=\""
270
				var removeLink = "<a class=\"removeFile\" href=\"#\" data-fileid=\""
240
						+ i + "\">Remove</a>";
271
					+ i + "\">Remove</a>";
241
 
272
 
242
					output.push("<li><strong>", file.name,
273
				output.push("<li><strong>", file.name,
243
						"</strong> - ", "&nbsp; &nbsp; ",
274
					"</strong> - ", "&nbsp; &nbsp; ",
244
						removeLink, "</li> ");
275
					removeLink, "</li> ");
245
 
276
 
246
				}
277
			}
247
 
278
 
248
				for (var j = 0; j < fileBundle.length; j++) {
279
			for (var j = 0; j < fileBundle.length; j++) {
249
					console.log(fileBundle[j])
280
				console.log(fileBundle[j])
250
					var url = context + '/document-upload';
281
				var url = context + '/document-upload';
251
					doAjaxUploadRequestHandler(
282
				doAjaxUploadRequestHandler(
252
						url,
283
					url,
253
						'POST',
284
					'POST',
254
						fileBundle[j],
285
					fileBundle[j],
255
						function(response) {
286
					function(response) {
256
							console.log(response);
287
						console.log(response);
257
							var documentId = response.response.document_id;
288
						var documentId = response.response.document_id;
258
							console.log("documentId : "
289
						console.log("documentId : "
259
								+ documentId);
290
							+ documentId);
260
							documentIds.push(documentId);
291
						documentIds.push(documentId);
261
 
292
 
262
						});
293
					});
263
 
294
 
264
				}
295
			}
265
				console.log(documentIds);
296
			console.log(documentIds);
266
				$(".fileList").append(output.join(""));
297
			$(".fileList").append(output.join(""));
267
 
298
 
268
			});
299
		});
269
 
300
 
270
	$(document).on('click', ".removeFile", function(e) {
301
	$(document).on('click', ".removeFile", function(e) {
271
		e.preventDefault();
302
		e.preventDefault();
272
		console.log("Hello")
303
		console.log("Hello")
273
		var fileId = $(this).parent().children("a").data("fileid");
304
		var fileId = $(this).parent().children("a").data("fileid");
Line 430... Line 461...
430
	});
461
	});
431
	$(document).on('click', ".create-ticket", function() {
462
	$(document).on('click', ".create-ticket", function() {
432
		loadCreateTicket("main-content");
463
		loadCreateTicket("main-content");
433
	});
464
	});
434
	$(document).on('click', ".create-ticket-button",
465
	$(document).on('click', ".create-ticket-button",
435
			function() {
466
		function() {
436
				var categoryId = $('#category').val();
467
			var categoryId = $('#category').val();
437
				var subCategoryId = $('#subCategory').val();
468
			var subCategoryId = $('#subCategory').val();
438
				if (categoryId == "" || categoryId == null
469
			if (categoryId == "" || categoryId == null
439
					|| categoryId == undefined) {
470
				|| categoryId == undefined) {
440
					alert("select appropriate category");
471
				alert("select appropriate category");
441
					return false;
472
				return false;
442
				}
473
			}
443
				if (subCategoryId == "" || subCategoryId == null
474
			if (subCategoryId == "" || subCategoryId == null
444
					|| subCategoryId == undefined) {
475
				|| subCategoryId == undefined) {
445
					alert("select appropriate subCategoryId");
476
				alert("select appropriate subCategoryId");
446
					return false;
477
				return false;
447
				}
478
			}
448
				var dialog = bootbox
479
			var dialog = bootbox
449
					.dialog({
480
				.dialog({
450
						title: "Are you sure want to change create ticket!",
481
					title: "Are you sure want to change create ticket!",
451
						message: "<div class=form-inline'>"
482
					message: "<div class=form-inline'>"
452
							+ "<label for='message'>Message:</label>"
483
						+ "<label for='message'>Message:</label>"
453
							+ "<textarea class='form-control' rows='2' id='message'></textarea>"
484
						+ "<textarea class='form-control' rows='2' id='message'></textarea>"
454
							+ "</div>",
485
						+ "</div>",
455
						buttons: {
486
					buttons: {
456
							cancel: {
487
						cancel: {
457
								label: "cancel",
488
							label: "cancel",
458
								className: 'btn-danger',
489
							className: 'btn-danger',
459
								callback: function() {
490
							callback: function() {
460
									loadCreateTicket("main-content");
491
								loadCreateTicket("main-content");
-
 
492
							}
-
 
493
						},
-
 
494
						ok: {
-
 
495
							label: "ok",
-
 
496
							className: 'btn-info',
-
 
497
							callback: function() {
-
 
498
								message = $('#message').val();
-
 
499
								console.log(message);
-
 
500
								if (message == ""
-
 
501
									|| message == null
-
 
502
									|| message == undefined) {
-
 
503
									alert("message field can't be empty");
-
 
504
									return false;
461
								}
505
								}
462
							},
-
 
463
							ok: {
-
 
464
								label: "ok",
-
 
465
								className: 'btn-info',
-
 
466
								callback: function() {
-
 
467
									message = $('#message').val();
-
 
468
									console.log(message);
-
 
469
									if (message == ""
-
 
470
										|| message == null
-
 
471
										|| message == undefined) {
-
 
472
										alert("message field can't be empty");
-
 
473
										return false;
-
 
474
									}
-
 
475
									var params = {
506
								var params = {
476
										"categoryId": categoryId,
507
									"categoryId": categoryId,
477
										"subCategoryId": subCategoryId,
508
									"subCategoryId": subCategoryId,
478
										"message": message
509
									"message": message
479
									}
-
 
480
									doPostAjaxRequestWithParamsHandler(
-
 
481
										context
-
 
482
										+ "/cs/createTicket",
-
 
483
										params,
-
 
484
										function(response) {
-
 
485
											if (response == "true") {
-
 
486
												alert("successfully created");
-
 
487
												loadCreateTicket("main-content");
-
 
488
											} else {
-
 
489
												alert("You have reached maximum number of tickets Resolved , pls click on Resolved for the resolved tickets to create new.");
-
 
490
											}
-
 
491
										});
-
 
492
 
-
 
493
								}
510
								}
-
 
511
								doPostAjaxRequestWithParamsHandler(
-
 
512
									context
-
 
513
									+ "/cs/createTicket",
-
 
514
									params,
-
 
515
									function(response) {
-
 
516
										if (response == "true") {
-
 
517
											alert("successfully created");
-
 
518
											loadCreateTicket("main-content");
-
 
519
										} else {
-
 
520
											alert("You have reached maximum number of tickets Resolved , pls click on Resolved for the resolved tickets to create new.");
-
 
521
										}
-
 
522
									});
-
 
523
 
494
							}
524
							}
495
						}
525
						}
-
 
526
					}
496
					});
527
				});
497
 
528
 
498
			});
529
		});
499
	$(document).on('click', ".create-position", function() {
530
	$(document).on('click', ".create-position", function() {
500
		loadCreatePosition("main-content");
531
		loadCreatePosition("main-content");
501
	});
532
	});
502
 
533
 
503
	$(document).on('click', ".positionPartnerView", function() {
534
	$(document).on('click', ".positionPartnerView", function() {
504
		$clickedElement = $(this);
535
		$clickedElement = $(this);
505
		var positionId = $clickedElement.data("positionid");
536
		var positionId = $clickedElement.data("positionid");
506
		$tdElement = $(this).closest('td');
537
		$tdElement = $(this).closest('td');
507
		doGetAjaxRequestHandler(context + "/cs/getPosition?positionId=" + positionId, function(response) {
538
		doGetAjaxRequestHandler(context + "/cs/getPosition?positionId=" + positionId, function(response) {
508
			
539
 
509
			$tdElement.html(response);
540
			$tdElement.html(response);
510
			$tdElement.find('.partners').multiselect({
541
			$tdElement.find('.partners').multiselect({
511
				includeSelectAllOption: true,
542
				includeSelectAllOption: true,
512
				multiple: true,
543
				multiple: true,
513
				maxHeight: 200,
544
				maxHeight: 200,
Line 620... Line 651...
620
			}
651
			}
621
 
652
 
622
		});
653
		});
623
	$(document).on('change', "#category", function() {
654
	$(document).on('change', "#category", function() {
624
		var categoryId = $("#category").val();
655
		var categoryId = $("#category").val();
625
		$("#auth-user-for-category").hide();
656
		//	$("#auth-user-for-category").hide();
626
		loadSubCategories(categoryId);
657
		loadSubCategories(categoryId);
627
	});
658
	});
-
 
659
 
-
 
660
	$(document).on('change', "#authUserCategory", function() {
-
 
661
		var authId = $("#authUserCategory").val();
-
 
662
		console.log(authId)
-
 
663
		loadCategories(authId);
-
 
664
	});
-
 
665
 
-
 
666
	$(document).on('change', "#categoryAuth", function() {
-
 
667
		var categoryId = $("#categoryAuth").val();
-
 
668
		var authId = $("#authUserCategory").val();
-
 
669
 
-
 
670
		console.log(categoryId)
-
 
671
		loadAuthSubCategories(categoryId, authId);
-
 
672
	});
-
 
673
 
-
 
674
 
628
	$(document).on('click', ".create-ticket-category-button",
675
	$(document).on('click', ".create-ticket-category-button",
629
			function() {
676
		function() {
630
				console
677
			console
631
					.log("create-ticket-category-button clicked......");
678
				.log("create-ticket-category-button clicked......");
632
				var name = $("#categoryName").val();
679
			var name = $("#categoryName").val();
633
				var description = $("#categorydescription").val();
680
			var description = $("#categorydescription").val();
634
				console.log(name, description);
681
			console.log(name, description);
635
				if (name == "" || name == null || name == undefined) {
682
			if (name == "" || name == null || name == undefined) {
636
					alert("Name field can't be empty");
683
				alert("Name field can't be empty");
637
					return false;
684
				return false;
638
				}
685
			}
639
				if (description == "" || description == null
686
			if (description == "" || description == null
640
					|| description == undefined) {
687
				|| description == undefined) {
641
					alert("Description field can't be empty");
688
				alert("Description field can't be empty");
642
					return false;
689
				return false;
643
				}
690
			}
644
				if (confirm("Are you sure you want to create ticket category!") == true) {
691
			if (confirm("Are you sure you want to create ticket category!") == true) {
645
					createCategory("main-content", name, description);
692
				createCategory("main-content", name, description);
646
				}
693
			}
647
			});
694
		});
648
	$(document).on('click', ".create-region-button",
695
	$(document).on('click', ".create-region-button",
649
			function() {
696
		function() {
650
				var name = $("#regionName").val();
697
			var name = $("#regionName").val();
651
				var description = $("#regiondescription").val();
698
			var description = $("#regiondescription").val();
652
				if (name == "" || name == null || name == undefined) {
699
			if (name == "" || name == null || name == undefined) {
653
					alert("Name field can't be empty");
700
				alert("Name field can't be empty");
654
					return false;
701
				return false;
655
				}
702
			}
656
				if (description == "" || description == null
703
			if (description == "" || description == null
657
					|| description == undefined) {
704
				|| description == undefined) {
658
					alert("Description field can't be empty");
705
				alert("Description field can't be empty");
659
					return false;
706
				return false;
660
				}
707
			}
661
				if (confirm("Are you sure you want to create region!") == true) {
708
			if (confirm("Are you sure you want to create region!") == true) {
662
					createRegion("main-content", name, description);
709
				createRegion("main-content", name, description);
663
				}
710
			}
664
			});
711
		});
665
 
712
 
666
	$(document).on('click', ".create-partner-region-button",
713
	$(document).on('click', ".create-partner-region-button",
667
			function() {
714
		function() {
668
 
715
 
669
				var regionId = $("#region").val();
716
			var regionId = $("#region").val();
670
				var fofoIds = $("#partner").val();
717
			var fofoIds = $("#partner").val();
671
				console.log(regionId, fofoIds);
718
			console.log(regionId, fofoIds);
672
				if (regionId == "" || regionId == null
719
			if (regionId == "" || regionId == null
673
					|| regionId == undefined) {
720
				|| regionId == undefined) {
674
					alert("regionId field can't be empty");
721
				alert("regionId field can't be empty");
675
					return false;
722
				return false;
676
				}
723
			}
677
				if (fofoIds == "" || fofoIds == null
724
			if (fofoIds == "" || fofoIds == null
678
					|| fofoIds == undefined) {
725
				|| fofoIds == undefined) {
679
					alert("select appropriate partner");
726
				alert("select appropriate partner");
680
					return false;
727
				return false;
681
				}
728
			}
682
				if (confirm("Are you sure you want to create partner region!") == true) {
729
			if (confirm("Are you sure you want to create partner region!") == true) {
683
					createPartnerRegion("main-content", regionId,
730
				createPartnerRegion("main-content", regionId,
684
						fofoIds);
731
					fofoIds);
685
				}
732
			}
686
			});
733
		});
687
	$(document).on('click', ".create-position-button",
734
	$(document).on('click', ".create-position-button",
688
			function() {
735
		function() {
689
 
736
 
690
				var authUser = $("#authUser").val();
737
			var authUser = $("#authUser").val();
691
				var ticketCategoryPosition = $(
738
			var ticketCategoryPosition = $(
692
					"#ticketCategoryPosition").val();
739
				"#ticketCategoryPosition").val();
693
				var escalationType = $("#escalationType").val();
740
			var escalationType = $("#escalationType").val();
694
				var regionPosition = $("#regionPosition").val();
741
			var regionPosition = $("#regionPosition").val();
-
 
742
 
-
 
743
			var ticketAssignee = $("#ticketAssignee").val();
-
 
744
 
695
				var fofoIds = $("#partner").val();
745
			var fofoIds = $("#partner").val();
696
				if (fofoIds.includes("0")) {
746
			if (fofoIds.includes("0")) {
697
					fofoIds = [0];
747
				fofoIds = [0];
698
					console.log(fofoIds);
748
				console.log(fofoIds);
699
				} else {
749
			} else {
700
					console.log(fofoIds);
750
				console.log(fofoIds);
701
				}
751
			}
702
				console.log(authUser, ticketCategoryPosition,
752
			console.log(authUser, ticketCategoryPosition,
703
					escalationType, regionPosition);
753
				escalationType, regionPosition);
704
				if (authUser == "" || authUser == null
754
			if (authUser == "" || authUser == null
705
					|| authUser == undefined) {
755
				|| authUser == undefined) {
706
					alert("select appropriate authUser");
756
				alert("select appropriate authUser");
707
					return false;
757
				return false;
708
				}
758
			}
709
				if (ticketCategoryPosition == ""
759
			if (ticketCategoryPosition == ""
710
					|| ticketCategoryPosition == null
760
				|| ticketCategoryPosition == null
711
					|| ticketCategoryPosition == undefined) {
761
				|| ticketCategoryPosition == undefined) {
712
					alert("select appropriate category");
762
				alert("select appropriate category");
713
					return false;
763
				return false;
714
				}
764
			}
715
				if (escalationType == "" || escalationType == null
765
			if (escalationType == "" || escalationType == null
716
					|| escalationType == undefined) {
766
				|| escalationType == undefined) {
717
					alert("select appropriate escalationType");
767
				alert("select appropriate escalationType");
718
					return false;
768
				return false;
719
				}
769
			}
720
				if (regionPosition == "" || regionPosition == null
770
			if (regionPosition == "" || regionPosition == null
721
					|| regionPosition == undefined) {
771
				|| regionPosition == undefined) {
722
					alert("select appropriate Region");
772
				alert("select appropriate Region");
723
					return false;
773
				return false;
724
				}
774
			}
725
 
775
 
726
				if (confirm("Are you sure you want to create Position!") == true) {
776
			if (confirm("Are you sure you want to create Position!") == true) {
727
					createPosition("main-content", authUser,
777
				createPosition("main-content", authUser,
728
						ticketCategoryPosition, escalationType,
778
					ticketCategoryPosition, escalationType,
729
						regionPosition, fofoIds);
779
					regionPosition, fofoIds, ticketAssignee);
730
				}
780
			}
731
 
781
 
732
			});
782
		});
733
 
783
 
734
	$(document).on('change', "#ticketCategory", function() {
784
	$(document).on('change', "#ticketCategory", function() {
735
		console.log("change ticket category clicked......");
785
		console.log("change ticket category clicked......");
736
		var ticketCategoryId = $(this).val();
786
		var ticketCategoryId = $(this).val();
737
		console.log(ticketCategoryId);
787
		console.log(ticketCategoryId);
Line 741... Line 791...
741
		console.log("create ticket category clicked......");
791
		console.log("create ticket category clicked......");
742
		loadCreateSubCategory("main-content");
792
		loadCreateSubCategory("main-content");
743
	});
793
	});
744
 
794
 
745
	$(document).on('click', ".create-ticket-sub-category-button",
795
	$(document).on('click', ".create-ticket-sub-category-button",
746
			function() {
796
		function() {
747
				console
797
			console
748
					.log("create-ticket-category-button clicked......");
798
				.log("create-ticket-category-button clicked......");
749
				var name = $("#subcategoryName").val();
799
			var name = $("#subcategoryName").val();
750
				var description = $("#subcategorydescription").val();
800
			var description = $("#subcategorydescription").val();
751
				var ticketCategoryId = $("#ticketCategory").val();
801
			var ticketCategoryId = $("#ticketCategory").val();
752
				console.log(name, description);
802
			console.log(name, description);
753
				if (name == "" || name == null || name == undefined) {
803
			if (name == "" || name == null || name == undefined) {
754
					alert("Name field can't be empty");
804
				alert("Name field can't be empty");
755
					return false;
805
				return false;
756
				}
806
			}
757
				if (description == "" || description == null
807
			if (description == "" || description == null
758
					|| description == undefined) {
808
				|| description == undefined) {
759
					alert("Description field can't be empty");
809
				alert("Description field can't be empty");
760
					return false;
810
				return false;
761
				}
811
			}
762
				if (ticketCategoryId == "" || ticketCategoryId == null
812
			if (ticketCategoryId == "" || ticketCategoryId == null
763
					|| ticketCategoryId == undefined) {
813
				|| ticketCategoryId == undefined) {
764
					alert("select appropriate category name");
814
				alert("select appropriate category name");
765
					return false;
815
				return false;
766
				}
816
			}
767
				if (confirm("Are you sure you want to create ticket category!") == true) {
817
			if (confirm("Are you sure you want to create ticket category!") == true) {
768
					createSubCategory("main-content", name,
818
				createSubCategory("main-content", name,
769
						description, ticketCategoryId);
819
					description, ticketCategoryId);
770
				}
820
			}
771
			});
821
		});
772
	$(document).on('click', ".remove-position", function() {
822
	$(document).on('click', ".remove-position", function() {
773
		var positionId = $(this).data('positionid');
823
		var positionId = $(this).data('positionid');
774
		if (confirm("Are you sure you want to remove position!") == true) {
824
		if (confirm("Are you sure you want to remove position!") == true) {
775
			removePosition(positionId);
825
			removePosition(positionId);
776
		}
826
		}
777
	});
827
	});
778
 
828
 
-
 
829
 
-
 
830
	$(document).on('change', "#ticketAssign", function() {
-
 
831
		var positionId = $(this).data('positionid');
-
 
832
		if (confirm("Are you sure you want to change ticket Assignee !") == true) {
-
 
833
			doPostAjaxRequestHandler(context + "/cs/changeTicketAssignee?positionId="
-
 
834
				+ positionId, function(response) {
-
 
835
					if (response == "true") {
-
 
836
						alert("change successfully");
-
 
837
						loadCreatePosition("main-content");
-
 
838
					}
-
 
839
				});
-
 
840
		}
-
 
841
	});
-
 
842
 
-
 
843
 
-
 
844
 
-
 
845
 
779
	$(document).on('click', ".update-position",
846
	$(document).on('click', ".update-position",
780
			function() {
847
		function() {
781
				var positionId = $(this).data('positionid');
848
			var positionId = $(this).data('positionid');
782
				var regionId = $(this).data('regionid');
849
			var regionId = $(this).data('regionid');
783
		        var row = $(this);
850
			var row = $(this);
784
				var selectedFofoIds = $(this).closest("tr").find(
851
			var selectedFofoIds = $(this).closest("tr").find(
785
					'#partners').val();
852
				'#partners').val();
786
				if (selectedFofoIds.includes("0")) {
853
			if (selectedFofoIds.includes("0")) {
787
					selectedFofoIds = [0];
854
				selectedFofoIds = [0];
788
					console.log(selectedFofoIds);
855
				console.log(selectedFofoIds);
789
				} else {
856
			} else {
790
					console.log(selectedFofoIds);
857
				console.log(selectedFofoIds);
791
				}
858
			}
792
				if (confirm("Are you sure you want to update the partners!") == true) {
859
			if (confirm("Are you sure you want to update the partners!") == true) {
793
					doPostAjaxRequestWithJsonHandler(context
860
				doPostAjaxRequestWithJsonHandler(context
794
						+ "/cs/updatePartnerPosition?regionId="
861
					+ "/cs/updatePartnerPosition?regionId="
795
						+ regionId + "&positionId=" + positionId,
862
					+ regionId + "&positionId=" + positionId,
796
						JSON.stringify(selectedFofoIds), function(
863
					JSON.stringify(selectedFofoIds), function(
797
							response) {
864
						response) {
798
						if (response == "true") {
865
					if (response == "true") {
799
							alert("Update successfully");
866
						alert("Update successfully");
800
							loadCreatePosition("main-content");
867
						loadCreatePosition("main-content");
801
						}
868
					}
802
					});
869
				});
803
				}
870
			}
804
 
871
 
805
			});
872
		});
806
 
873
 
807
});
874
});
808
 
875
 
809
function loadCreateCategory(domId) {
876
function loadCreateCategory(domId) {
810
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
877
	doGetAjaxRequestHandler(context + "/cs/createCategory", function(response) {
Line 874... Line 941...
874
		+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
941
		+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
875
		function(response) {
942
		function(response) {
876
			$('#' + "create-ticket-sub-categories").html(response);
943
			$('#' + "create-ticket-sub-categories").html(response);
877
		});
944
		});
878
}
945
}
-
 
946
 
-
 
947
function loadCategories(authId) {
-
 
948
	doGetAjaxRequestHandler(context
-
 
949
		+ "/cs/getCategoriesByAuthId?authId=" + authId,
-
 
950
		function(response) {
-
 
951
			$('#' + "create-tickets-categories-for-auth").html(response);
-
 
952
		});
-
 
953
}
-
 
954
 
-
 
955
function loadAuthSubCategories(categoryId, authId) {
-
 
956
	doGetAjaxRequestHandler(context
-
 
957
		+ "/cs/getSubCategoriesByCategoryId?categoryId=" + categoryId,
-
 
958
		function(response) {
-
 
959
			$('#' + "create-ticket-sub-categories-for-auth").html(response);
-
 
960
		});
-
 
961
 
-
 
962
 
-
 
963
	doGetAjaxRequestHandler(context
-
 
964
		+ "/cs/getEscalationTypeByCategoryId?categoryId=" + categoryId + "&authId=" + authId,
-
 
965
		function(response) {
-
 
966
			$('#' + "create-ticket-escalationType-for-auth").html(response);
-
 
967
		});
-
 
968
 
-
 
969
 
-
 
970
}
-
 
971
 
879
function createCategory(domId, name, description) {
972
function createCategory(domId, name, description) {
880
	var params = {
973
	var params = {
881
		"name": name,
974
		"name": name,
882
		"description": description
975
		"description": description
883
	}
976
	}
Line 885... Line 978...
885
		function(response) {
978
		function(response) {
886
			alert("Category created successfully");
979
			alert("Category created successfully");
887
			loadCreateCategory(domId);
980
			loadCreateCategory(domId);
888
		});
981
		});
889
}
982
}
890
function changeTicket(ticketId, subCategoryId, authUserId, categoryId) {
983
function changeTicket(ticketId, subCategoryId, authUserId, categoryId, escalationType) {
891
	var params = {
984
	var params = {
892
		"ticketId": ticketId,
985
		"ticketId": ticketId,
893
		"subCategoryId": subCategoryId,
986
		"subCategoryId": subCategoryId,
894
		"authUserId": authUserId,
987
		"authUserId": authUserId,
895
		"categoryId": categoryId
988
		"categoryId": categoryId,
-
 
989
		"escalationType": escalationType
896
	}
990
	}
897
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
991
	doPostAjaxRequestWithParamsHandler(context + "/cs/edit-ticket", params,
898
		function(response) {
992
		function(response) {
899
			if (response == "true") {
993
			if (response == "true") {
900
				alert("Ticket changed successfully");
994
				alert("Ticket changed successfully");
Line 1000... Line 1094...
1000
			}
1094
			}
1001
		});
1095
		});
1002
}
1096
}
1003
 
1097
 
1004
function createPosition(domId, authUserId, categoryId, escalationType,
1098
function createPosition(domId, authUserId, categoryId, escalationType,
1005
	regionId, fofoIds) {
1099
	regionId, fofoIds, ticketAssignee) {
1006
 
1100
 
1007
	var createPositionModel = {};
1101
	var createPositionModel = {};
1008
	createPositionModel['authUserId'] = authUserId;
1102
	createPositionModel['authUserId'] = authUserId;
1009
	createPositionModel['categoryId'] = categoryId
1103
	createPositionModel['categoryId'] = categoryId
1010
	createPositionModel['escalationType'] = escalationType;
1104
	createPositionModel['escalationType'] = escalationType;
1011
	createPositionModel['regionId'] = regionId,
1105
	createPositionModel['regionId'] = regionId,
-
 
1106
 
-
 
1107
		createPositionModel['ticketAssigned'] = ticketAssignee,
1012
		createPositionModel['fofoIds'] = fofoIds
1108
		createPositionModel['fofoIds'] = fofoIds
1013
 
1109
 
1014
	console.log(createPositionModel);
1110
	console.log(createPositionModel);
1015
	doPostAjaxRequestWithJsonHandler(context + "/cs/createPosition", JSON
1111
	doPostAjaxRequestWithJsonHandler(context + "/cs/createPosition", JSON
1016
		.stringify(createPositionModel), function(response) {
1112
		.stringify(createPositionModel), function(response) {