Subversion Repositories SmartDukaan

Rev

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

Rev 27537 Rev 27754
Line 4... Line 4...
4
grnhistory.startTime = "0";
4
grnhistory.startTime = "0";
5
grnhistory.endTime = "0";
5
grnhistory.endTime = "0";
6
dateRangeCallback(moment(), moment());
6
dateRangeCallback(moment(), moment());
7
 
7
 
8
$(function() {
8
$(function() {
9
	$(".new_grn").live('click', function() {
9
	$(document).on('click', ".new_grn", function() {
10
		loadNewGrn("main-content");
10
		loadNewGrn("main-content");
11
	});
11
	});
12
 
12
 
13
	$(".grn_history").live('click', function() {
13
	$(document).on('click', ".grn_history", function() {
14
		loadGrnHistory("main-content","","",startDate,endDate);
14
		loadGrnHistory("main-content","","",startDate,endDate);
15
	});
15
	});
16
	
16
	
17
	$(".pending_grn").live('click', function() {
17
	$(document).on('click', ".pending_grn", function() {
18
		loadPendingGrn("main-content");
18
		loadPendingGrn("main-content");
19
	});
19
	});
20
 
20
 
21
	$("td.startGrnSerialized").live('click', function() {
21
	$(document).on('click', "td.startGrnSerialized", function() {
22
		var invoiceNumber = $(this).attr('invoiceNumber');
22
		var invoiceNumber = $(this).attr('invoiceNumber');
23
		var quantity = $(this).attr('quantity');
23
		var quantity = $(this).attr('quantity');
24
		var displayName = $(this).attr('displayName');
24
		var displayName = $(this).attr('displayName');
25
		var itemId = $(this).attr('itemId');
25
		var itemId = $(this).attr('itemId');
26
		console.log(quantity);
26
		console.log(quantity);
Line 55... Line 55...
55
			$("#grnImeiInformation")
55
			$("#grnImeiInformation")
56
			.append(divText)
56
			.append(divText)
57
		}
57
		}
58
	});
58
	});
59
 
59
 
60
	$("td.startGrnNonSerialized").live('click', function() {
60
	$(document).on('click', "td.startGrnNonSerialized", function() {
61
		var invoiceNumber = $(this).attr('invoiceNumber');
61
		var invoiceNumber = $(this).attr('invoiceNumber');
62
		var quantity = $(this).attr('quantity');
62
		var quantity = $(this).attr('quantity');
63
		var displayName = $(this).attr('displayName');
63
		var displayName = $(this).attr('displayName');
64
		var itemId = $(this).attr('itemId');
64
		var itemId = $(this).attr('itemId');
65
		console.log(quantity);
65
		console.log(quantity);
Line 94... Line 94...
94
			$("#grnImeiInformation")
94
			$("#grnImeiInformation")
95
			.append(divText)
95
			.append(divText)
96
		}
96
		}
97
	});
97
	});
98
	
98
	
99
	$("#grnSubmitSerialized").live('click', function(){
99
	$(document).on('click', "#grnSubmitSerialized", function(){
100
		var imeis = [];
100
		var imeis = [];
101
		var error = false;
101
		var error = false;
102
		var errorText = "";
102
		var errorText = "";
103
		$("#grnImeiInformation :input").each(function(){
103
		$("#grnImeiInformation :input").each(function(){
104
			var input = $(this).val().trim();
104
			var input = $(this).val().trim();
Line 127... Line 127...
127
			});
127
			});
128
		});
128
		});
129
		return false;
129
		return false;
130
	});
130
	});
131
	
131
	
132
	$("#grnNonSerializedSubmit").live('click', function(){
132
	$(document).on('click', "#grnNonSerializedSubmit", function(){
133
		var error = false;
133
		var error = false;
134
		var errorText = "";
134
		var errorText = "";
135
		if (error){
135
		if (error){
136
			return false;
136
			return false;
137
		}
137
		}
Line 149... Line 149...
149
			});
149
			});
150
		});
150
		});
151
		return false;
151
		return false;
152
	});
152
	});
153
 
153
 
154
	$("#grnImeiInformation :input").live('change', function() {
154
	$(document).on('change', "#grnImeiInformation :input", function() {
155
		if ($(this).val().trim() != "") {
155
		if ($(this).val().trim() != "") {
156
			console.log('The text box really changed this time');
156
			console.log('The text box really changed this time');
157
			$('#grnImeiInformation :input').removeClass("border-highlight");
157
			$('#grnImeiInformation :input').removeClass("border-highlight");
158
			if(findDuplicateSerialNumbers( $(this).val().trim()) > 0){
158
			if(findDuplicateSerialNumbers( $(this).val().trim()) > 0){
159
				var inputs = $("#grnImeiInformation :input[value="+$(this).val().trim()+"]");
159
				var inputs = $("#grnImeiInformation :input[value="+$(this).val().trim()+"]");
Line 163... Line 163...
163
			}
163
			}
164
		}
164
		}
165
	});
165
	});
166
	
166
	
167
	
167
	
168
	$("#grnImeiInformation :input").live('paste', function() {
168
	$(document).on('paste', "#grnImeiInformation :input", function() {
169
		if ($(this).val().trim() != "") {
169
		if ($(this).val().trim() != "") {
170
			console.log('paste event');
170
			console.log('paste event');
171
			$(this).next("input .form-control").focus();
171
			$(this).next("input .form-control").focus();
172
		}
172
		}
173
	});
173
	});
174
 
174
 
175
	$("#airwayBillOrInvoiceNumberText").live("keyup", function(e) {
175
	$(document).on("keyup", "#airwayBillOrInvoiceNumberText", function(e) {
176
		var keyCode = e.keyCode || e.which;
176
		var keyCode = e.keyCode || e.which;
177
    	if(keyCode == 13){
177
    	if(keyCode == 13){
178
        	$("#purchase-reference-submit-button").click();
178
        	$("#purchase-reference-submit-button").click();
179
    	}
179
    	}
180
	});
180
	});
181
 
181
 
182
	$("#grn-history-search-button").live('click', function() {
182
	$(document).on('click', "#grn-history-search-button", function() {
183
		grnhistory.searchText = $("#grn-history-search-text").val();
183
		grnhistory.searchText = $("#grn-history-search-text").val();
184
		grnhistory.searchType = "purchaseReference";
184
		grnhistory.searchType = "purchaseReference";
185
		grnhistory.startTime = startDate;
185
		grnhistory.startTime = startDate;
186
		grnhistory.endTime = endDate;
186
		grnhistory.endTime = endDate;
187
		if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText){
187
		if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText){
188
			grnhistory.searchText = "";
188
			grnhistory.searchText = "";
189
		}
189
		}
190
		loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
190
		loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
191
    });
191
    });
192
	
192
	
193
	$("#grn-history-download-button").live('click', function() {
193
	$(document).on('click', "#grn-history-download-button", function() {
194
		grnhistory.searchText = $("#grn-history-search-text").val();
194
		grnhistory.searchText = $("#grn-history-search-text").val();
195
		grnhistory.searchType = "purchaseReference";
195
		grnhistory.searchType = "purchaseReference";
196
		grnhistory.startTime = startDate;
196
		grnhistory.startTime = startDate;
197
		grnhistory.endTime = endDate;
197
		grnhistory.endTime = endDate;
198
		if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText){
198
		if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText){
199
			grnhistory.searchText = "";
199
			grnhistory.searchText = "";
200
		}
200
		}
201
		downloadPurchaseInvoices(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
201
		downloadPurchaseInvoices(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
202
	});
202
	});
203
	
203
	
204
	$("#grn-history-search-text").live("keyup", function(e) {
204
	$(document).on("keyup", "#grn-history-search-text", function(e) {
205
		var keyCode = e.keyCode || e.which;
205
		var keyCode = e.keyCode || e.which;
206
    	if(keyCode == 13){
206
    	if(keyCode == 13){
207
        	$("#grn-history-search-button").click();
207
        	$("#grn-history-search-button").click();
208
    	}
208
    	}
209
	});
209
	});
210
 
210
 
211
	$("#grn-history-paginated .next").live('click', function() {
211
	$(document).on('click', "#grn-history-paginated .next", function() {
212
		var params = {};
212
		var params = {};
213
		params['purchaseReference'] = grnhistory.searchText;
213
		params['purchaseReference'] = grnhistory.searchText;
214
		params['searchType'] = grnhistory.searchType;
214
		params['searchType'] = grnhistory.searchType;
215
		params['startTime'] = grnhistory.startTime;
215
		params['startTime'] = grnhistory.startTime;
216
		params['endTime'] = grnhistory.endTime;
216
		params['endTime'] = grnhistory.endTime;
217
		loadPaginatedNextItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
217
		loadPaginatedNextItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
218
		$(this).blur();
218
		$(this).blur();
219
		
219
		
220
    });
220
    });
221
	
221
	
222
	$("#grn-history-paginated .previous").live('click', function() {
222
	$(document).on('click', "#grn-history-paginated .previous", function() {
223
		var params = {};
223
		var params = {};
224
		params['purchaseReference'] = grnhistory.searchText;
224
		params['purchaseReference'] = grnhistory.searchText;
225
		params['searchType'] = grnhistory.searchType;
225
		params['searchType'] = grnhistory.searchType;
226
		params['startTime'] = grnhistory.startTime;
226
		params['startTime'] = grnhistory.startTime;
227
		params['endTime'] = grnhistory.endTime;
227
		params['endTime'] = grnhistory.endTime;
228
		loadPaginatedPreviousItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
228
		loadPaginatedPreviousItems('/getPaginatedGrnHistory', params, 'grn-history-paginated', 'grn-history-table', null);
229
		$(this).blur();
229
		$(this).blur();
230
		
230
		
231
    });
231
    });
232
	
232
	
233
	$("#grn-history-date-button").live('click', function() {
233
	$(document).on('click', "#grn-history-date-button", function() {
234
		var dateRange = $('#reportrange span').text();
234
		var dateRange = $('#reportrange span').text();
235
		grnhistory.startTime = startDate;
235
		grnhistory.startTime = startDate;
236
		grnhistory.endTime = endDate;
236
		grnhistory.endTime = endDate;
237
		grnhistory.searchType = "dateFilter";
237
		grnhistory.searchType = "dateFilter";
238
		grnhistory.searchText = "";
238
		grnhistory.searchText = "";
239
		loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
239
		loadGrnHistorySearchInfo(grnhistory.searchText,grnhistory.searchType,grnhistory.startTime,grnhistory.endTime);
240
    });
240
    });
241
 
241
 
242
    $(".grn-details").live('click',function(){
242
    $(document).on('click', ".grn-details",function(){
243
		var purchaseId = $(this).attr('data');
243
		var purchaseId = $(this).attr('data');
244
		console.log(purchaseId);
244
		console.log(purchaseId);
245
		loadGrnDetails(purchaseId,"grn-details-container");
245
		loadGrnDetails(purchaseId,"grn-details-container");
246
	});
246
	});
247
	
247
	
248
	$(".pending-grn-details").live('click',function(){
248
	$(document).on('click', ".pending-grn-details",function(){
249
		console.log("pending-grn-details clicked");
249
		console.log("pending-grn-details clicked");
250
		var orderId = $(this).attr('data');
250
		var orderId = $(this).attr('data');
251
		console.log("orderId : "+orderId);
251
		console.log("orderId : "+orderId);
252
		loadPendingGrnDetails(orderId, "pending-grn-details-container");
252
		loadPendingGrnDetails(orderId, "pending-grn-details-container");
253
	});
253
	});
254
 
254
 
255
	$(".pending-grn").live('click',function(){
255
	$(document).on('click', ".pending-grn",function(){
256
		var purchaseReference = $(this).attr('data');
256
		var purchaseReference = $(this).attr('data');
257
		console.log(purchaseReference);
257
		console.log(purchaseReference);
258
		loadPendingGrnDetails(purchaseReference,"main-content");
258
		loadPendingGrnDetails(purchaseReference,"main-content");
259
	});
259
	});
260
 
260