Subversion Repositories SmartDukaan

Rev

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