Subversion Repositories SmartDukaan

Rev

Rev 24221 | Rev 24739 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23343 ashik.ali 1
$(function() {
2
	$(".good_inventory").live('click', function() {
3
		loadGoodInventory("main-content","");
4
	});
5
 
6
	$(".catalog").live('click', function() {
7
		loadCatalog("main-content","");
8
	});
9
 
24658 tejbeer 10
	$(".review_order").live('click', function() {
11
		loadOrder("main-content");
12
	});
13
 
23343 ashik.ali 14
	$(".item_aging").live('click', function() {
15
		getInventoryItemAgingByInterval("main-content", "");
16
	});
17
 
18
	$("#item-aging-search-button").live('click', function() {
19
		searchContent = $("#item-aging-search-text").val();
20
		if (typeof (searchContent) == "undefined" || !searchContent){
21
			searchContent = "";
22
		}
23
		getInventoryItemAgingByInterval("main-content", searchContent);
24
    });
25
 
26
 
27
	$("#item-aging-search-text").live("keyup", function(e) {
28
		var keyCode = e.keyCode || e.which;
29
    	if(keyCode == 13){
30
        	$("#item-aging-search-button").click();
31
    	}
32
	});
33
 
23629 ashik.ali 34
	$("#item-aging-paginated .next").live('click', function() {
35
		var end = $( "#item-aging-paginated .end" ).text();
36
		getItemAgingNextPreviousItems(end, "");
37
		$("#item-aging-paginated .next").blur();
38
    });
39
 
23343 ashik.ali 40
	$("#item-aging-paginated .previous").live('click', function() {
41
		var start = $( "#item-aging-paginated .start" ).text();
42
		getItemAgingNextPreviousItems(start - 11, "");
43
		$("#item-aging-paginated .previous").blur();
44
    });
45
 
46
	$(".download_aging_report").live('click', function() {
47
		downloadAgingReport();
48
	});
49
 
23637 amit.gupta 50
	$(".download_reports").live('click', function() {
51
		downloadReports();
52
	});
53
 
23343 ashik.ali 54
	$(".item-ledger-report-download-page").live('click', function() {
55
		loadItemLedgerReportDownloadPage("main-content");
56
	});
57
 
58
	$(".bad_inventory").live('click', function() {
59
		loadBadInventory("main-content","");
60
	});
61
 
62
	$("#good-inventory-paginated .next").live('click', function() {
63
		var searchText = $("#good-inventory-search-text").val();
64
		if (typeof (searchText) == "undefined" || !searchText){
65
			searchText = "";
23886 amit.gupta 66
 
23343 ashik.ali 67
		}
23629 ashik.ali 68
		var params = {};
69
		params['searchTerm'] = searchText;
70
		loadPaginatedNextItems('/getPaginatedCurrentInventorySnapshot', params, 'good-inventory-paginated', 'good-inventory-table', null);
71
		$(this).blur();
23343 ashik.ali 72
    });
73
 
74
	$("#good-inventory-paginated .previous").live('click', function() {
75
		var searchText = $("#good-inventory-search-text").val();
76
		if (typeof (searchText) == "undefined" || !searchText){
77
			searchText = "";
78
		}
23629 ashik.ali 79
		var params = {};
80
		params['searchTerm'] = searchText;
81
		loadPaginatedPreviousItems('/getPaginatedCurrentInventorySnapshot', params, 'good-inventory-paginated', 'good-inventory-table', null);
82
		$(this).blur();
23343 ashik.ali 83
    });
84
 
85
	$("#good-inventory-search-button").live('click', function() {
86
		var searchText = $("#good-inventory-search-text").val();
87
		if (typeof (searchText) == "undefined" || !searchText){
88
			searchText = "";
89
		}
90
		loadGoodInventorySearchInfo(searchText);
91
    });
92
 
93
	$("#good-inventory-search-text").live("keyup", function(e) {
94
		var keyCode = e.keyCode || e.which;
95
    	if(keyCode == 13){
96
        	$("#good-inventory-search-button").click();
97
    	}
98
	});
99
 
100
 
101
	$("#catalog-paginated .next").live('click', function() {
102
		var searchText = $("#catalog-search-text").val();
103
		if (typeof (searchText) == "undefined" || !searchText){
104
			searchText = "";
105
		}
23629 ashik.ali 106
 
107
		var params = {};
108
		params['searchTerm'] = searchText;
109
		loadPaginatedNextItems('/getPaginatedCatalog', params, 'catalog-paginated', 'catalog-table', null);
110
		$(this).blur();
23343 ashik.ali 111
    });
112
 
113
	$("#catalog-paginated .previous").live('click', function() {
114
		var searchText = $("#catalog-search-text").val();
115
		if (typeof (searchText) == "undefined" || !searchText){
116
			searchText = "";
117
		}
23629 ashik.ali 118
 
119
		var params = {};
120
		params['searchTerm'] = searchText;
121
		loadPaginatedPreviousItems('/getPaginatedCatalog', params, 'catalog-paginated', 'catalog-table', null);
122
		$(this).blur();
23343 ashik.ali 123
    });
124
 
125
	$("#catalog-search-button").live('click', function() {
126
		var searchText = $("#catalog-search-text").val();
127
		if (typeof (searchText) == "undefined" || !searchText){
128
			searchText = "";
129
		}
130
		loadCatalogSearchInfo(searchText);
131
    });
132
 
133
	$("#catalog-search-text").live("keyup", function(e) {
134
		var keyCode = e.keyCode || e.which;
135
    	if(keyCode == 13){
136
        	$("#catalog-search-button").click();
137
    	}
138
	});
139
 
140
});
141
 
142
 
143
function loadGoodInventory(domId, search_text){
23783 ashik.ali 144
	doGetAjaxRequestHandler(context+"/getCurrentInventorySnapshot?searchTerm="+search_text, function(response){
23343 ashik.ali 145
		$('#' + domId).html(response);
146
	});
147
}
148
 
149
function loadCatalog(domId, search_text){
23783 ashik.ali 150
	doGetAjaxRequestHandler(context+"/getCatalog?searchTerm="+search_text, function(response){
23343 ashik.ali 151
		$('#' + domId).html(response);
152
	});
24658 tejbeer 153
 
154
 
23343 ashik.ali 155
}
156
 
24658 tejbeer 157
 
158
function loadOrder(domId){
159
	doGetAjaxRequestHandler(context+"/getCurrentOrder", function(response){
160
		$('#' + domId).html(response);
161
	});
162
 
163
 
164
}
165
 
23343 ashik.ali 166
function getInventoryItemAgingByInterval(domId, searchContent){
23500 ashik.ali 167
	doPostAjaxRequestWithJsonHandler(context+"/getInventoryItemAgingByInterval?searchContent="+searchContent, JSON.stringify([5,15,30,45]), function(response){
23343 ashik.ali 168
		$('#' + domId).html(response);
169
	});
170
}
171
 
172
 
173
function downloadAgingReport(){
174
	data = JSON.stringify([5,15,30,45]),
175
	doAjaxPostDownload(context+"/downloadInventoryItemAgingByInterval",
176
			data, "InventoryItemAging.xlsx");
177
 
178
}
179
 
23637 amit.gupta 180
function downloadReports(){
23783 ashik.ali 181
	doGetAjaxRequestHandler(context+"/reports", function(response){
23637 amit.gupta 182
		$('#main-content').html(response);
183
	});
184
}
185
 
23343 ashik.ali 186
function downloadItemLedgerReport(){
187
	console.log("downloadItemLedgerReport Button clicked")
24221 amit.gupta 188
	var dateWise = $("#dateWise").get(0).checked;
24218 amit.gupta 189
	doAjaxGetDownload(context+"/itemLedger/complete/download?startDateTime="+startDate+"&endDateTime="+endDate+"&dateWise="+dateWise,
23343 ashik.ali 190
			"ItemCompleteLedegerReport.xlsx");
191
}
192
 
193
 
194
function getItemAgingNextPreviousItems(offset, searchContent){
195
	console.log("getItemAgingNextPreviousItems() called");
23500 ashik.ali 196
	doPostAjaxRequestWithJsonHandler(context+"/getInventoryItemAgingByInterval?offset="+offset+"&searchContent="+searchContent, JSON.stringify([5,15,30,45]), function(response){
23343 ashik.ali 197
		$('#main-content').html(response);
198
	});
199
 
200
}
201
 
202
 
203
function loadBadInventory(domId, search_text){
23783 ashik.ali 204
	doGetAjaxRequestHandler(context+"/getBadInventorySnapshot?searchTerm="+search_text, function(response){
23343 ashik.ali 205
		$('#' + domId).html(response);
206
	});
207
}
208
 
209
function loadGoodInventorySearchInfo(search_text){
210
	loadGoodInventory("main-content",search_text);
211
}
212
 
213
function loadCatalogSearchInfo(search_text){
214
	loadCatalog("main-content",search_text);
215
}
216
 
217
function loadItemLedgerReportDownloadPage(domId){
23500 ashik.ali 218
	doGetAjaxRequestHandler(context+"/itemLedger/downloadPage", function(response){
23343 ashik.ali 219
		$('#' + domId).html(response);
220
	});
221
}