Subversion Repositories SmartDukaan

Rev

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

Rev 23500 Rev 23629
Line 6... Line 6...
6
	$(".wallet_icon_header").live('click', function() {
6
	$(".wallet_icon_header").live('click', function() {
7
		loadWallet("main-content", "", "");
7
		loadWallet("main-content", "", "");
8
	});
8
	});
9
	
9
	
10
	$("#wallet-history-paginated .next").live('click', function() {
10
	$("#wallet-history-paginated .next").live('click', function() {
-
 
11
		var params = {};
11
		var start = $( "#wallet-history-paginated .start" ).text();
12
		params['startTime'] = walletHistory.startTime;
12
		var end = $( "#wallet-history-paginated .end" ).text();
13
		params['endTime'] = walletHistory.endTime;
13
		getWalletHistoryNextItems(start, end, walletHistory.startTime, walletHistory.endTime);
14
		loadPaginatedNextItems('/getPaginatedWalletHistory', params, 'wallet-history-paginated', 'wallet-history-table', null);
14
		$("#wallet-history-paginated .next").blur();
15
		$(this).blur();
15
    });
16
    });
16
	
17
	
17
	$("#wallet-history-paginated .previous").live('click', function() {
18
	$("#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 size = $("#wallet-history-paginated .size").text();
-
 
21
		if(parseInt(end) == parseInt(size)){
-
 
22
			var mod = parseInt(end) % 10;
19
		var params = {};
23
			end = parseInt(end) + (10 - mod); 
20
		params['startTime'] = walletHistory.startTime;
24
		}
-
 
25
		var pre = end - 20;
21
		params['endTime'] = walletHistory.endTime;
26
		getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
22
		loadPaginatedPreviousItems('/getPaginatedWalletHistory', params, 'wallet-history-paginated', 'wallet-history-table', null);
27
		$("#wallet-history-paginated .previous").blur();
23
		$(this).blur();
28
    });
24
    });
29
});
25
});
30
 
26
 
31
 
-
 
32
function getWalletHistoryNextItems(start, end, startTime, endTime){
-
 
33
	console.log(start);
-
 
34
	console.log(end);
-
 
35
	console.log(+end + +10);
-
 
36
	console.log(+start + +10);
-
 
37
	doGetAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
-
 
38
	        +"&endTime="+endTime+"&offset="+end, 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");
-
 
45
			$( "#wallet-history-paginated .end" ).text(+end + +10);
-
 
46
		}
-
 
47
		
-
 
48
		$( "#wallet-history-paginated .start" ).text(+start + +10);
-
 
49
		var last = $( "#wallet-history-paginated .end" ).text();
-
 
50
		var temp = $( "#wallet-history-paginated .size" ).text();
-
 
51
		if (parseInt(last) >= parseInt(temp)){
-
 
52
			$("#wallet-history-paginated .next").prop('disabled', true);
-
 
53
			//$( "#good-inventory-paginated .end" ).text(temp);
-
 
54
		}
-
 
55
	    $('#wallet-history-table').html(response);
-
 
56
	    $("#wallet-history-paginated .previous").prop('disabled', false);
-
 
57
	});
-
 
58
	
-
 
59
}
-
 
60
 
-
 
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);
-
 
67
	doGetAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
-
 
68
	        +"&endTime="+endTime+"&offset="+pre, function(response){
-
 
69
		$( "#wallet-history-paginated .end" ).text(+end - +10);
-
 
70
		$( "#wallet-history-paginated .start" ).text(+start - +10);
-
 
71
		$('#wallet-history-table').html(response);
-
 
72
		$("#wallet-history-paginated .next").prop('disabled', false);
-
 
73
		if (parseInt(pre)==0)
-
 
74
		{
-
 
75
			$("#wallet-history-paginated .previous").prop('disabled', true);
-
 
76
		}
-
 
77
	});
-
 
78
	
-
 
79
}
-
 
80
 
-
 
81
function loadWallet(domId, startTime, endTime){
27
function loadWallet(domId, startTime, endTime){
82
	doGetAjaxRequestHandler(context+"/walletDetails?startTime="+startTime
28
	doGetAjaxRequestHandler(context+"/walletDetails?startTime="+startTime
83
	        +"&endTime="+endTime, function(response){
29
	        +"&endTime="+endTime, function(response){
84
		$('#' + domId).html(response);
30
		$('#' + domId).html(response);
85
	});
31
	});