| 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();
|
| 23419 |
ashik.ali |
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 |
}
|
| 23343 |
ashik.ali |
25 |
var pre = end - 20;
|
|
|
26 |
getWalletHistoryPreviousItems(start, end, pre, walletHistory.startTime, walletHistory.endTime);
|
|
|
27 |
$("#wallet-history-paginated .previous").blur();
|
|
|
28 |
});
|
|
|
29 |
});
|
|
|
30 |
|
|
|
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);
|
| 23500 |
ashik.ali |
37 |
doGetAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
|
|
|
38 |
+"&endTime="+endTime+"&offset="+end, function(response){
|
| 23419 |
ashik.ali |
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 |
|
| 23343 |
ashik.ali |
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){
|
| 23419 |
ashik.ali |
62 |
console.log(start);
|
|
|
63 |
console.log(end);
|
|
|
64 |
console.log(pre);
|
|
|
65 |
console.log(+end - +10);
|
|
|
66 |
console.log(+start - +10);
|
| 23500 |
ashik.ali |
67 |
doGetAjaxRequestHandler(context+"/getPaginatedWalletHistory?startTime="+startTime
|
|
|
68 |
+"&endTime="+endTime+"&offset="+pre, function(response){
|
| 23343 |
ashik.ali |
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){
|
| 23500 |
ashik.ali |
82 |
doGetAjaxRequestHandler(context+"/walletDetails?startTime="+startTime
|
|
|
83 |
+"&endTime="+endTime, function(response){
|
| 23343 |
ashik.ali |
84 |
$('#' + domId).html(response);
|
|
|
85 |
});
|
|
|
86 |
}
|
|
|
87 |
|