Subversion Repositories SmartDukaan

Rev

Rev 27755 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
24106 tejbeer 1
$(function() {
2
 
27754 amit.gupta 3
	$(document).on('click', ".feature", function() {
24106 tejbeer 4
		loadFeaturePanel("main-content");
5
	});
25393 amit.gupta 6
 
7
	$(".content").on('click', function() {
8
		loadContentPanel("main-content");
9
	});
24106 tejbeer 10
 
24798 tejbeer 11
	/*
27755 amit.gupta 12
	 * $(document).on('click', "#feature-paginated .next", function() {
24798 tejbeer 13
	 * loadPaginatedNextItems('/getPaginatedfeature', null, 'feature-paginated',
14
	 * 'feature-table', 'feature-container');
15
	 * 
16
	 * $(this).blur(); });
17
	 * 
27755 amit.gupta 18
	 * $(document).on('click', "#feature-paginated .previous", function() {
24798 tejbeer 19
	 * 
20
	 * loadPaginatedPreviousItems('/getPaginatedfeature', null,
21
	 * 'feature-paginated', 'feature-table', 'feature-container');
22
	 * 
23
	 * $(this).blur(); });
24
	 */
24106 tejbeer 25
 
27755 amit.gupta 26
	$(document).on('click', "#submitFeature",
24766 tejbeer 27
			function() {
24106 tejbeer 28
				var editorData = CKEDITOR.instances['featureEditor'].getData();
29
				console.log(editorData)
30
				var catalogItemid = $('#catalogItemid').val();
31
				var rankPoints = $('#rankPoints').val();
32
				var featureData = {};
33
				if (catalogItemid === "" && rankPoints === ""
34
						&& editorData === "") {
35
					alert("Field can't be empty");
36
					return;
37
				}
38
				if (catalogItemid === "") {
39
					alert("Catalog Item Id is required");
40
					return;
41
				}
42
				if (rankPoints === "") {
43
					alert("Rank Point is required");
44
					return;
45
				}
46
 
47
				featureData['feature'] = editorData;
48
				featureData['catalogItemId'] = $('#catalogItemid').val();
49
				featureData['rankPoints'] = $('#rankPoints').val();
50
				console.log(featureData)
51
				console.log(JSON.stringify(featureData))
52
				if (confirm("Are you sure you want add item feature") == true) {
53
					doPostAjaxRequestWithJsonHandler(context + "/itemfeature",
54
							JSON.stringify(featureData), function(response) {
55
								if (response == 'true') {
56
									alert("successfully add feature");
57
									loadFeaturePanel("main-content");
58
								}
59
							});
60
 
61
					return false;
62
				}
63
			});
64
 
27754 amit.gupta 65
	$(document).on('click', ".editfeature", function() {
24106 tejbeer 66
		rank = $(this).data('rank');
67
		catalogItemId = $(this).data('requestid');
68
		$('#catalogItemid').attr('readonly', true);
69
		feature = $(this).data('feature');
70
		$('#catalogItemid').val(catalogItemId);
71
		$('#rankPoints').val(rank);
72
		CKEDITOR.instances['featureEditor'].setData(feature);
73
		console.log(rank);
74
		console.log(catalogItemId);
75
		console.log(feature);
76
 
77
	});
78
 
27755 amit.gupta 79
	$(document).on('click', ".deleteCatalogranking",
24798 tejbeer 80
					function() {
81
						if (confirm("Are you sure you want to Remove the Entry") == true) {
82
							tagid = $(this).data('tagid');
83
							console.log(tagid);
84
							doDeleteAjaxRequestHandler(context
85
									+ "/removeFeature?id="
86
									+ tagid, function(response) {
87
								if (response == 'true') {
88
									alert("successfully Removed");
89
									loadFeaturePanel("main-content");
90
								}
91
 
92
							});
93
						}
94
 
95
					});
24106 tejbeer 96
});
97
 
98
function loadFeaturePanel(domId) {
99
	doGetAjaxRequestHandler(context + "/featurePanel", function(response) {
100
		$('#' + domId).html(response);
32956 amit.gupta 101
		//CKEDITOR.replace("featureEditor");
24106 tejbeer 102
	});
103
}
25393 amit.gupta 104
function loadContentPanel(domId) {
105
	doGetAjaxRequestHandler(context + "/content/index", function(response) {
106
		$('#' + domId).html(response);
107
	});
108
}