Subversion Repositories SmartDukaan

Rev

Rev 24798 | Rev 27754 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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