Subversion Repositories SmartDukaan

Rev

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

Rev 23343 Rev 23419
Line 15... Line 15...
15
    });
15
    });
16
	
16
	
17
	$("#wallet-history-paginated .previous").live('click', function() {
17
	$("#wallet-history-paginated .previous").live('click', function() {
18
		var start = $( "#wallet-history-paginated .start" ).text();
18
		var start = $( "#wallet-history-paginated .start" ).text();
19
		var end =  $( "#wallet-history-paginated .end" ).text();
19
		var end =  $( "#wallet-history-paginated .end" ).text();
-
 
20
		var size = $("#wallet-history-paginated .size").text();
-
 
21
		if(parseInt(end) == parseInt(size)){
-
 
22
			var mod = parseInt(end) % 10;
-
 
23
			end = parseInt(end) + (10 - mod); 
-
 
24
		}
20
		var pre = end - 20;
25
		var pre = end - 20;
21
		getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
26
		getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
22
		$("#wallet-history-paginated .previous").blur();
27
		$("#wallet-history-paginated .previous").blur();
23
    });
28
    });
24
});
29
});
Line 29... Line 34...
29
	console.log(end);
34
	console.log(end);
30
	console.log(+end + +10);
35
	console.log(+end + +10);
31
	console.log(+start + +10);
36
	console.log(+start + +10);
32
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
37
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
33
	        +"&endTime="+endTime+"&offset="+end, "GET", function(response){
38
	        +"&endTime="+endTime+"&offset="+end, "GET", function(response){
-
 
39
		var size = $("#wallet-history-paginated .size").text();
-
 
40
		if((parseInt(end) + 10) > parseInt(size)){
-
 
41
			console.log("(end + 10) > size == true");
-
 
42
			$( "#wallet-history-paginated .end" ).text(size);
-
 
43
		}else{
-
 
44
			console.log("(end + 10) > size == false");
34
		$( "#wallet-history-paginated .end" ).text(+end + +10);
45
			$( "#wallet-history-paginated .end" ).text(+end + +10);
-
 
46
		}
-
 
47
		
35
		$( "#wallet-history-paginated .start" ).text(+start + +10);
48
		$( "#wallet-history-paginated .start" ).text(+start + +10);
36
		var last = $( "#wallet-history-paginated .end" ).text();
49
		var last = $( "#wallet-history-paginated .end" ).text();
37
		var temp = $( "#wallet-history-paginated .size" ).text();
50
		var temp = $( "#wallet-history-paginated .size" ).text();
38
		if (parseInt(last) >= parseInt(temp)){
51
		if (parseInt(last) >= parseInt(temp)){
39
			$("#wallet-history-paginated .next").prop('disabled', true);
52
			$("#wallet-history-paginated .next").prop('disabled', true);
Line 44... Line 57...
44
	});
57
	});
45
	
58
	
46
}
59
}
47
 
60
 
48
function getWalletHistoryPreviousItems(start, end, pre, startTime, endTime){
61
function getWalletHistoryPreviousItems(start, end, pre, startTime, endTime){
-
 
62
	console.log(start);
-
 
63
	console.log(end);
-
 
64
	console.log(pre);
-
 
65
	console.log(+end - +10);
-
 
66
	console.log(+start - +10);
49
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
67
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
50
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
68
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
51
		$( "#wallet-history-paginated .end" ).text(+end - +10);
69
		$( "#wallet-history-paginated .end" ).text(+end - +10);
52
		$( "#wallet-history-paginated .start" ).text(+start - +10);
70
		$( "#wallet-history-paginated .start" ).text(+start - +10);
53
		$('#wallet-history-table').html(response);
71
		$('#wallet-history-table').html(response);