Subversion Repositories SmartDukaan

Rev

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

Rev 23557 Rev 23629
Line 8... Line 8...
8
		loadTagListingItemsDescriptionByBrand("tag-listing-items-description-container", $(this).text());
8
		loadTagListingItemsDescriptionByBrand("tag-listing-items-description-container", $(this).text());
9
	    console.log($(this).text());
9
	    console.log($(this).text());
10
	});
10
	});
11
	
11
	
12
	$("#schemes-paginated .next").live('click', function() {
12
	$("#schemes-paginated .next").live('click', function() {
13
		var start = $( "#schemes-paginated .start" ).text();
13
		loadPaginatedNextItems('/getPaginatedSchemes', null, 'schemes-paginated', 'schemes-table', 'scheme-details-container');
14
		var end = $( "#schemes-paginated .end" ).text();
-
 
15
		getSchemesNextItems(start, end);
-
 
16
		$("#schemes-paginated .next").blur();
14
		$(this).blur();
17
    });
15
    });
18
	
16
	
19
	$("#schemes-paginated .previous").live('click', function() {
17
	$("#schemes-paginated .previous").live('click', function() {
20
		var start = $( "#schemes-paginated .start" ).text();
18
		loadPaginatedPreviousItems('/getPaginatedSchemes', null, 'schemes-paginated', 'schemes-table', 'scheme-details-container');
21
		var end =  $( "#schemes-paginated .end" ).text();
-
 
22
		var size = $("#schemes-paginated .size").text();
-
 
23
		if(parseInt(end) == parseInt(size)){
-
 
24
			var mod = parseInt(end) % 10;
-
 
25
			end = parseInt(end) + (10 - mod); 
-
 
26
		}
-
 
27
		var pre = end - 20;
-
 
28
		getSchemesPreviousItems(start, end, pre);
-
 
29
		$("#schemes-paginated .previous").blur();
19
		$(this).blur();
30
    });
20
    });
31
	
21
	
32
	$(".scheme-details").live('click',function(){
22
	$(".scheme-details").live('click',function(){
33
		var schemeId = $(this).attr('data');
23
		var schemeId = $(this).attr('data');
34
		console.log("schemeId = "+schemeId);
24
		console.log("schemeId = "+schemeId);
Line 104... Line 94...
104
	console.log("endDateTime : "+endDateTime);
94
	console.log("endDateTime : "+endDateTime);
105
	doAjaxGetDownload(context+"/schemes/download?startDateTime="+startDateTime+"&endDateTime="+endDateTime,
95
	doAjaxGetDownload(context+"/schemes/download?startDateTime="+startDateTime+"&endDateTime="+endDateTime,
106
			"SchemesReport.xlsx");
96
			"SchemesReport.xlsx");
107
}
97
}
108
 
98
 
109
function getSchemesNextItems(start, end){
-
 
110
	console.log(start);
-
 
111
	console.log(end);
-
 
112
	console.log(+end + +10);
-
 
113
	console.log(+start + +10);
-
 
114
	doGetAjaxRequestHandler(context+"/getPaginatedSchemes?offset="+end, function(response){
-
 
115
		var size = $("#schemes-paginated .size").text();
-
 
116
		if((parseInt(end) + 10) > parseInt(size)){
-
 
117
			console.log("(end + 10) > size == true");
-
 
118
			$( "#schemes-paginated .end" ).text(size);
-
 
119
		}else{
-
 
120
			console.log("(end + 10) > size == false");
-
 
121
			$( "#schemes-paginated .end" ).text(+end + +10);
-
 
122
		}
-
 
123
		$( "#schemes-paginated .start" ).text(+start + +10);
-
 
124
		var last = $( "#schemes-paginated .end" ).text();
-
 
125
		var temp = $( "#schemes-paginated .size" ).text();
-
 
126
		if (parseInt(last) >= parseInt(temp)){
-
 
127
			$("#schemes-paginated .next").prop('disabled', true);
-
 
128
			//$( "#good-inventory-paginated .end" ).text(temp);
-
 
129
		}
-
 
130
	    $('#schemes-table').html(response);
-
 
131
	    $('#scheme-details-container').html('');
-
 
132
	    $("#schemes-paginated .previous").prop('disabled', false);
-
 
133
	});
-
 
134
    
-
 
135
}
-
 
136
 
-
 
137
 
-
 
138
function getSchemesPreviousItems(start, end, pre){
-
 
139
	
-
 
140
	doGetAjaxRequestHandler(context+"/getPaginatedSchemes/?offset="+pre, function(response){
-
 
141
		$( "#schemes-paginated .end" ).text(+end - +10);
-
 
142
		$( "#schemes-paginated .start" ).text(+start - +10);
-
 
143
		$('#schemes-table').html(response);
-
 
144
		$('#scheme-details-container').html('');
-
 
145
		$("#schemes-paginated .next").prop('disabled', false);
-
 
146
		if (parseInt(pre)==0)
-
 
147
		{
-
 
148
			$("#schemes-paginated .previous").prop('disabled', true);
-
 
149
		}
-
 
150
	});
-
 
151
	
-
 
152
	
-
 
153
}
-
 
154
 
-
 
155
function loadSchemeDetails(schemeId, domId){
99
function loadSchemeDetails(schemeId, domId){
156
	doGetAjaxRequestHandler(context+"/getSchemeById?schemeId="+schemeId, function(response){
100
	doGetAjaxRequestHandler(context+"/getSchemeById?schemeId="+schemeId, function(response){
157
		$('#' + domId).html(response);
101
		$('#' + domId).html(response);
158
		window.dispatchEvent(new Event('resize'));
102
		window.dispatchEvent(new Event('resize'));
159
	});
103
	});