Subversion Repositories SmartDukaan

Rev

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