Subversion Repositories SmartDukaan

Rev

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

Rev 23500 Rev 23629
Line 9... Line 9...
9
	
9
	
10
	$(".item_aging").live('click', function() {
10
	$(".item_aging").live('click', function() {
11
		getInventoryItemAgingByInterval("main-content", "");
11
		getInventoryItemAgingByInterval("main-content", "");
12
	});
12
	});
13
	
13
	
14
	$("#item-aging-paginated .next").live('click', function() {
-
 
15
		var end = $( "#item-aging-paginated .end" ).text();
-
 
16
		getItemAgingNextPreviousItems(end, "");
-
 
17
		$("#item-aging-paginated .next").blur();
-
 
18
    });
-
 
19
	
-
 
20
	$("#item-aging-search-button").live('click', function() {
14
	$("#item-aging-search-button").live('click', function() {
21
		searchContent = $("#item-aging-search-text").val();
15
		searchContent = $("#item-aging-search-text").val();
22
		if (typeof (searchContent) == "undefined" || !searchContent){
16
		if (typeof (searchContent) == "undefined" || !searchContent){
23
			searchContent = "";
17
			searchContent = "";
24
		}
18
		}
Line 31... Line 25...
31
    	if(keyCode == 13){
25
    	if(keyCode == 13){
32
        	$("#item-aging-search-button").click();
26
        	$("#item-aging-search-button").click();
33
    	}
27
    	}
34
	});
28
	});
35
	
29
	
-
 
30
	$("#item-aging-paginated .next").live('click', function() {
-
 
31
		var end = $( "#item-aging-paginated .end" ).text();
-
 
32
		getItemAgingNextPreviousItems(end, "");
-
 
33
		$("#item-aging-paginated .next").blur();
-
 
34
    });
-
 
35
	
36
	$("#item-aging-paginated .previous").live('click', function() {
36
	$("#item-aging-paginated .previous").live('click', function() {
37
		var start = $( "#item-aging-paginated .start" ).text();
37
		var start = $( "#item-aging-paginated .start" ).text();
38
		getItemAgingNextPreviousItems(start - 11, "");
38
		getItemAgingNextPreviousItems(start - 11, "");
39
		$("#item-aging-paginated .previous").blur();
39
		$("#item-aging-paginated .previous").blur();
40
    });
40
    });
Line 50... Line 50...
50
	$(".bad_inventory").live('click', function() {
50
	$(".bad_inventory").live('click', function() {
51
		loadBadInventory("main-content","");
51
		loadBadInventory("main-content","");
52
	});
52
	});
53
	
53
	
54
	$("#good-inventory-paginated .next").live('click', function() {
54
	$("#good-inventory-paginated .next").live('click', function() {
55
		var start = $( "#good-inventory-paginated .start" ).text();
-
 
56
		var end = $( "#good-inventory-paginated .end" ).text();
-
 
57
		var searchText = $("#good-inventory-search-text").val();
55
		var searchText = $("#good-inventory-search-text").val();
58
		if (typeof (searchText) == "undefined" || !searchText){
56
		if (typeof (searchText) == "undefined" || !searchText){
59
			searchText = "";
57
			searchText = "";
60
		}
58
		}
-
 
59
		var params = {};
61
		getNextItems(start,end, searchText);
60
		params['searchTerm'] = searchText;
62
		$("#good-inventory-paginated .next").blur();
61
		loadPaginatedNextItems('/getPaginatedCurrentInventorySnapshot', params, 'good-inventory-paginated', 'good-inventory-table', null);
63
		
62
		$(this).blur();
64
    });
63
    });
65
	
64
	
66
	$("#good-inventory-paginated .previous").live('click', function() {
65
	$("#good-inventory-paginated .previous").live('click', function() {
67
		var start = $( "#good-inventory-paginated .start" ).text();
-
 
68
		var end =  $( "#good-inventory-paginated .end" ).text();
-
 
69
		var searchText = $("#good-inventory-search-text").val();
66
		var searchText = $("#good-inventory-search-text").val();
70
		if (typeof (searchText) == "undefined" || !searchText){
67
		if (typeof (searchText) == "undefined" || !searchText){
71
			searchText = "";
68
			searchText = "";
72
		}
69
		}
73
		var size = $("#good-inventory-paginated .size").text();
-
 
74
		if(parseInt(end) == parseInt(size)){
-
 
75
			var mod = parseInt(end) % 10;
70
		var params = {};
76
			end = parseInt(end) + (10 - mod); 
71
		params['searchTerm'] = searchText;
77
		}
-
 
78
		var pre = end - 20;
-
 
79
		getPreviousItems(start, end, pre, searchText);
72
		loadPaginatedPreviousItems('/getPaginatedCurrentInventorySnapshot', params, 'good-inventory-paginated', 'good-inventory-table', null);
80
		$("#good-inventory-paginated .previous").blur();
73
		$(this).blur();
81
    });
74
    });
82
	
75
	
83
	$("#good-inventory-search-button").live('click', function() {
76
	$("#good-inventory-search-button").live('click', function() {
84
		var searchText = $("#good-inventory-search-text").val();
77
		var searchText = $("#good-inventory-search-text").val();
85
		if (typeof (searchText) == "undefined" || !searchText){
78
		if (typeof (searchText) == "undefined" || !searchText){
Line 95... Line 88...
95
    	}
88
    	}
96
	});
89
	});
97
	
90
	
98
	
91
	
99
	$("#catalog-paginated .next").live('click', function() {
92
	$("#catalog-paginated .next").live('click', function() {
100
		var start = $( "#catalog-paginated .start" ).text();
-
 
101
		var end = $( "#catalog-paginated .end" ).text();
-
 
102
		var searchText = $("#catalog-search-text").val();
93
		var searchText = $("#catalog-search-text").val();
103
		if (typeof (searchText) == "undefined" || !searchText){
94
		if (typeof (searchText) == "undefined" || !searchText){
104
			searchText = "";
95
			searchText = "";
105
		}
96
		}
-
 
97
		
-
 
98
		var params = {};
106
		getNextCatalogItems(start,end,searchText);
99
		params['searchTerm'] = searchText;
-
 
100
		loadPaginatedNextItems('/getPaginatedCatalog', params, 'catalog-paginated', 'catalog-table', null);
107
		$("#catalog-paginated .next").blur();
101
		$(this).blur();
108
    });
102
    });
109
	
103
	
110
	$("#catalog-paginated .previous").live('click', function() {
104
	$("#catalog-paginated .previous").live('click', function() {
111
		var start = $( "#catalog-paginated .start" ).text();
-
 
112
		var end =  $( "#catalog-paginated .end" ).text();
-
 
113
		var searchText = $("#catalog-search-text").val();
105
		var searchText = $("#catalog-search-text").val();
114
		if (typeof (searchText) == "undefined" || !searchText){
106
		if (typeof (searchText) == "undefined" || !searchText){
115
			searchText = "";
107
			searchText = "";
116
		}
108
		}
117
		var size = $("#catalog-paginated .size").text();
-
 
118
		if(parseInt(end) == parseInt(size)){
-
 
119
			var mod = parseInt(end) % 10;
-
 
120
			end = parseInt(end) + (10 - mod); 
-
 
121
		}
109
		
122
		var pre = end - 20;
110
		var params = {};
123
		getPreviousCatalogItems(start,end,pre,searchText);
111
		params['searchTerm'] = searchText;
-
 
112
		loadPaginatedPreviousItems('/getPaginatedCatalog', params, 'catalog-paginated', 'catalog-table', null);
124
		$("#catalog-paginated .previous").blur();
113
		$(this).blur();
125
    });
114
    });
126
	
115
	
127
	$("#catalog-search-button").live('click', function() {
116
	$("#catalog-search-button").live('click', function() {
128
		var searchText = $("#catalog-search-text").val();
117
		var searchText = $("#catalog-search-text").val();
129
		if (typeof (searchText) == "undefined" || !searchText){
118
		if (typeof (searchText) == "undefined" || !searchText){
Line 193... Line 182...
193
	doGetAjaxRequestHandler(context+"/getBadInventorySnapshot/?searchTerm="+search_text, function(response){
182
	doGetAjaxRequestHandler(context+"/getBadInventorySnapshot/?searchTerm="+search_text, function(response){
194
		$('#' + domId).html(response);
183
		$('#' + domId).html(response);
195
	});
184
	});
196
}
185
}
197
 
186
 
198
 
-
 
199
function getNextItems(start, end, searchText){
-
 
200
	console.log(start);
-
 
201
	console.log(end);
-
 
202
	console.log(+end + +10);
-
 
203
	console.log(+start + +10);
-
 
204
	doGetAjaxRequestHandler(context+"/getPaginatedCurrentInventorySnapshot/?offset="+end+"&searchTerm="+searchText, function(response){
-
 
205
		var size = $("#good-inventory-paginated .size").text();
-
 
206
		if((parseInt(end) + 10) > parseInt(size)){
-
 
207
			console.log("(end + 10) > size == true");
-
 
208
			$( "#good-inventory-paginated .end" ).text(size);
-
 
209
		}else{
-
 
210
			console.log("(end + 10) > size == false");
-
 
211
			$( "#good-inventory-paginated .end" ).text(+end + +10);
-
 
212
		}
-
 
213
		$( "#good-inventory-paginated .start" ).text(+start + +10);
-
 
214
		var last = $( "#good-inventory-paginated .end" ).text();
-
 
215
		var temp = $( "#good-inventory-paginated .size" ).text();
-
 
216
		if (parseInt(last) >= parseInt(temp)){
-
 
217
			$("#good-inventory-paginated .next").prop('disabled', true);
-
 
218
			//$( "#good-inventory-paginated .end" ).text(temp);
-
 
219
		}
-
 
220
	    $('#good-inventory-table').html(response);
-
 
221
	    $("#good-inventory-paginated .previous").prop('disabled', false);
-
 
222
	});
-
 
223
	
-
 
224
    
-
 
225
}
-
 
226
 
-
 
227
function getPreviousItems(start,end,pre,searchText){
-
 
228
	doGetAjaxRequestHandler(context+"/getPaginatedCurrentInventorySnapshot/?offset="+pre+"&searchTerm="+searchText, function(response){
-
 
229
		$( "#good-inventory-paginated .end" ).text(+end - +10);
-
 
230
		$( "#good-inventory-paginated .start" ).text(+start - +10);
-
 
231
		$('#good-inventory-table').html(response);
-
 
232
		$("#good-inventory-paginated .next").prop('disabled', false);
-
 
233
		if (parseInt(pre)==0)
-
 
234
		{
-
 
235
			$("#good-inventory-paginated .previous").prop('disabled', true);
-
 
236
		}
-
 
237
	});
-
 
238
	
-
 
239
}
-
 
240
 
-
 
241
function loadGoodInventorySearchInfo(search_text){
187
function loadGoodInventorySearchInfo(search_text){
242
	loadGoodInventory("main-content",search_text);
188
	loadGoodInventory("main-content",search_text);
243
}
189
}
244
 
190
 
245
 
-
 
246
function getNextCatalogItems(start, end, searchText){
-
 
247
	console.log(start);
-
 
248
	console.log(end);
-
 
249
	console.log(+end + +10);
-
 
250
	console.log(+start + +10);
-
 
251
	doGetAjaxRequestHandler(context+"/getPaginatedCatalog/?offset="+end+"&searchTerm="+searchText, function(response){
-
 
252
		var size = $("#catalog-paginated .size").text();
-
 
253
		if((parseInt(end) + 10) > parseInt(size)){
-
 
254
			console.log("(end + 10) > size == true");
-
 
255
			$( "#catalog-paginated .end" ).text(size);
-
 
256
		}else{
-
 
257
			console.log("(end + 10) > size == false");
-
 
258
			$( "#catalog-paginated .end" ).text(+end + +10);
-
 
259
		}
-
 
260
		$( "#catalog-paginated .start" ).text(+start + +10);
-
 
261
		var last = $( "#catalog-paginated .end" ).text();
-
 
262
		var temp = $( "#catalog-paginated .size" ).text();
-
 
263
		if (parseInt(last) >= parseInt(temp)){
-
 
264
			$("#catalog-paginated .next").prop('disabled', true);
-
 
265
		}
-
 
266
	    $('#catalog-table').html(response);
-
 
267
	    $("#catalog-paginated .previous").prop('disabled', false);
-
 
268
	});
-
 
269
}
-
 
270
 
-
 
271
function getPreviousCatalogItems(start,end,pre,searchText){
-
 
272
	doGetAjaxRequestHandler(context+"/getPaginatedCatalog/?offset="+pre+"&searchTerm="+searchText, function(response){
-
 
273
		$( "#catalog-paginated .end" ).text(+end - +10);
-
 
274
		$( "#catalog-paginated .start" ).text(+start - +10);
-
 
275
		$('#catalog-table').html(response);
-
 
276
		$("#catalog-paginated .next").prop('disabled', false);
-
 
277
		if (parseInt(pre)==0)
-
 
278
		{
-
 
279
			$("#catalog-paginated .previous").prop('disabled', true);
-
 
280
		}
-
 
281
	});
-
 
282
	
-
 
283
}
-
 
284
 
-
 
285
function loadCatalogSearchInfo(search_text){
191
function loadCatalogSearchInfo(search_text){
286
	loadCatalog("main-content",search_text);
192
	loadCatalog("main-content",search_text);
287
}
193
}
288
 
194
 
289
function loadItemLedgerReportDownloadPage(domId){
195
function loadItemLedgerReportDownloadPage(domId){