Subversion Repositories SmartDukaan

Rev

Rev 23419 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
23343 ashik.ali 1
var walletHistory = walletHistory || {};
2
walletHistory.startTime="";
3
walletHistory.endTime="";
4
 
5
$(function() {
6
	$(".wallet_icon_header").live('click', function() {
7
		loadWallet("main-content", "", "");
8
	});
9
 
10
	$("#wallet-history-paginated .next").live('click', function() {
11
		var start = $( "#wallet-history-paginated .start" ).text();
12
		var end = $( "#wallet-history-paginated .end" ).text();
13
		getWalletHistoryNextItems(start, end, walletHistory.startTime, walletHistory.endTime);
14
		$("#wallet-history-paginated .next").blur();
15
    });
16
 
17
	$("#wallet-history-paginated .previous").live('click', function() {
18
		var start = $( "#wallet-history-paginated .start" ).text();
19
		var end =  $( "#wallet-history-paginated .end" ).text();
20
		var pre = end - 20;
21
		getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
22
		$("#wallet-history-paginated .previous").blur();
23
    });
24
});
25
 
26
 
27
function getWalletHistoryNextItems(start, end, startTime, endTime){
28
	console.log(start);
29
	console.log(end);
30
	console.log(+end + +10);
31
	console.log(+start + +10);
32
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
33
	        +"&endTime="+endTime+"&offset="+end, "GET", function(response){
34
		$( "#wallet-history-paginated .end" ).text(+end + +10);
35
		$( "#wallet-history-paginated .start" ).text(+start + +10);
36
		var last = $( "#wallet-history-paginated .end" ).text();
37
		var temp = $( "#wallet-history-paginated .size" ).text();
38
		if (parseInt(last) >= parseInt(temp)){
39
			$("#wallet-history-paginated .next").prop('disabled', true);
40
			//$( "#good-inventory-paginated .end" ).text(temp);
41
		}
42
	    $('#wallet-history-table').html(response);
43
	    $("#wallet-history-paginated .previous").prop('disabled', false);
44
	});
45
 
46
}
47
 
48
function getWalletHistoryPreviousItems(start, end, pre, startTime, endTime){
49
	doAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
50
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
51
		$( "#wallet-history-paginated .end" ).text(+end - +10);
52
		$( "#wallet-history-paginated .start" ).text(+start - +10);
53
		$('#wallet-history-table').html(response);
54
		$("#wallet-history-paginated .next").prop('disabled', false);
55
		if (parseInt(pre)==0)
56
		{
57
			$("#wallet-history-paginated .previous").prop('disabled', true);
58
		}
59
	});
60
 
61
}
62
 
63
function loadWallet(domId, startTime, endTime){
64
	doAjaxRequestHandler(context+"/walletDetails?startTime="+startTime
65
	        +"&endTime="+endTime, "GET", function(response){
66
		$('#' + domId).html(response);
67
	});
68
}
69