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 3... Line 3...
3
saleHistory.searchType="";
3
saleHistory.searchType="";
4
saleHistory.startTime="";
4
saleHistory.startTime="";
5
saleHistory.endTime="";
5
saleHistory.endTime="";
6
 
6
 
7
$(function() {
7
$(function() {
-
 
8
	
8
	$(".sale-history").live('click', function() {
9
	$(".sale-history").live('click', function() {
9
		console.log("Sale History Button Clicked...")
10
		console.log("Sale History Button Clicked...")
10
		saleHistory("main-content","","","0","0");
11
		saleHistory("main-content","","","0","0");
11
	});
12
	});
12
	
13
	
13
	$('#searchType').live('change', function() { 
14
	$('#searchType').live('change', function() {
14
	    var searchType = $(this).find('option:selected').text();
15
	    var searchType = $(this).find('option:selected').text();
15
	    console.log("selected searchType = " + searchType);
16
	    console.log("selected searchType = " + searchType);
16
	    $("#sale-history-search-text").attr('placeholder', 'Search By '+searchType);
17
	    $("#sale-history-search-text").attr('placeholder', 'Search By '+searchType);
17
	    $("#sale-history-search-text").val('');
18
	    $("#sale-history-search-text").val('');
18
	});
19
	});
Line 55... Line 56...
55
    });
56
    });
56
	
57
	
57
	$("#sale-history-paginated .previous").live('click', function() {
58
	$("#sale-history-paginated .previous").live('click', function() {
58
		var start = $( "#sale-history-paginated .start" ).text();
59
		var start = $( "#sale-history-paginated .start" ).text();
59
		var end =  $( "#sale-history-paginated .end" ).text();
60
		var end =  $( "#sale-history-paginated .end" ).text();
-
 
61
		var size = $("#sale-history-paginated .size").text();
-
 
62
		if(parseInt(end) == parseInt(size)){
-
 
63
			var mod = parseInt(end) % 10;
-
 
64
			end = parseInt(end) + (10 - mod); 
-
 
65
		}
60
		var pre = end - 20;
66
		var pre = end - 20;
61
		getSaleHistoryPreviousItems(start, end, pre, saleHistory.searchType, saleHistory.searchText, saleHistory.startTime, saleHistory.endTime);
67
		getSaleHistoryPreviousItems(start, end, pre, saleHistory.searchType, saleHistory.searchText, saleHistory.startTime, saleHistory.endTime);
62
		$("#sale-history-paginated .previous").blur();
68
		$("#sale-history-paginated .previous").blur();
63
    });
69
    });
64
	
70
	
Line 78... Line 84...
78
	console.log(end);
84
	console.log(end);
79
	console.log(+end + +10);
85
	console.log(+end + +10);
80
	console.log(+start + +10);
86
	console.log(+start + +10);
81
	doAjaxRequestHandler(context+"/getPaginatedSaleHistory/?searchType="+searchType+"&searchValue="+searchValue
87
	doAjaxRequestHandler(context+"/getPaginatedSaleHistory/?searchType="+searchType+"&searchValue="+searchValue
82
	        +"&startTime="+startTime+"&endTime="+endTime+"&offset="+end, "GET", function(response){
88
	        +"&startTime="+startTime+"&endTime="+endTime+"&offset="+end, "GET", function(response){
-
 
89
		var size = $("#sale-history-paginated .size").text();
-
 
90
		if((parseInt(end) + 10) > parseInt(size)){
-
 
91
			console.log("(end + 10) > size == true");
-
 
92
			$( "#sale-history-paginated .end" ).text(size);
-
 
93
		}else{
-
 
94
			console.log("(end + 10) > size == false");
83
		$( "#sale-history-paginated .end" ).text(+end + +10);
95
			$( "#sale-history-paginated .end" ).text(+end + +10);
-
 
96
		}
84
		$( "#sale-history-paginated .start" ).text(+start + +10);
97
		$( "#sale-history-paginated .start" ).text(+start + +10);
85
		var last = $( "#sale-history-paginated .end" ).text();
98
		var last = $( "#sale-history-paginated .end" ).text();
86
		var temp = $( "#sale-history-paginated .size" ).text();
99
		var temp = $( "#sale-history-paginated .size" ).text();
87
		if (parseInt(last) >= parseInt(temp)){
100
		if (parseInt(last) >= parseInt(temp)){
88
			$("#sale-history-paginated .next").prop('disabled', true);
101
			$("#sale-history-paginated .next").prop('disabled', true);
Line 102... Line 115...
102
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
115
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
103
		$( "#sale-history-paginated .end" ).text(+end - +10);
116
		$( "#sale-history-paginated .end" ).text(+end - +10);
104
		$( "#sale-history-paginated .start" ).text(+start - +10);
117
		$( "#sale-history-paginated .start" ).text(+start - +10);
105
		$('#sale-history-table').html(response);
118
		$('#sale-history-table').html(response);
106
		$("#sale-history-paginated .next").prop('disabled', false);
119
		$("#sale-history-paginated .next").prop('disabled', false);
107
		if (parseInt(pre)==0)
120
		if (parseInt(pre)==0){
108
		{
-
 
109
			$("#sale-history-paginated .previous").prop('disabled', true);
121
			$("#sale-history-paginated .previous").prop('disabled', true);
110
		}
122
		}
111
	});
123
	});
112
	
124
	
113
}
125
}