Subversion Repositories SmartDukaan

Rev

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

Rev 23419 Rev 23500
Line 114... Line 114...
114
			return false;
114
			return false;
115
		}
115
		}
116
		var invoiceNumber = $("#scanModel .invoiceNumber").val();
116
		var invoiceNumber = $("#scanModel .invoiceNumber").val();
117
		var itemId = $("#scanModel .itemId").val();
117
		var itemId = $("#scanModel .itemId").val();
118
		var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"serialNumbers":imeis});
118
		var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"serialNumbers":imeis});
119
		jQuery.ajax({
-
 
120
			url: context+"/scanSerialized",
119
		doPostAjaxRequestWithJsonHandler(context+"/scanSerialized", postData, function(response){
121
			type: 'POST',
-
 
122
			data: postData,
-
 
123
			contentType:'application/json',
-
 
124
			async: false,
-
 
125
			success: function (data) {
-
 
126
				alert("Purchase booked successfully");
120
			alert("Purchase booked successfully");
127
				$('#scanModel').modal('hide');
121
			$('#scanModel').modal('hide');
128
				$("#scanModel").on("hidden.bs.modal", function () {
122
			$("#scanModel").on("hidden.bs.modal", function () {
129
					$("#purchase-reference-submit-button").click();
123
				$("#purchase-reference-submit-button").click();
130
				});
124
			});
131
			},
-
 
132
			cache: false,
-
 
133
			processData: false
-
 
134
		});
125
		});
135
		return false;
126
		return false;
136
	});
127
	});
137
	
128
	
138
	$("#grnNonSerializedSubmit").live('click', function(){
129
	$("#grnNonSerializedSubmit").live('click', function(){
Line 143... Line 134...
143
		}
134
		}
144
		var invoiceNumber = $("#scanNonSerializedModel .invoiceNumber").val();
135
		var invoiceNumber = $("#scanNonSerializedModel .invoiceNumber").val();
145
		var itemId = $("#scanNonSerializedModel .itemId").val();
136
		var itemId = $("#scanNonSerializedModel .itemId").val();
146
		var quantity = $("#scanNonSerializedModel .quantity").val();
137
		var quantity = $("#scanNonSerializedModel .quantity").val();
147
		var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"quantity":parseInt(quantity)});
138
		var postData = JSON.stringify({"itemId":parseInt(itemId),"invoiceNumber":invoiceNumber,"quantity":parseInt(quantity)});
148
		jQuery.ajax({
-
 
149
			url: context+"/scanNonSerialized",
139
		doPostAjaxRequestWithJsonHandler(context+"/scanNonSerialized", postData, function(response){
150
			type: 'POST',
-
 
151
			data: postData,
-
 
152
			contentType:'application/json',
-
 
153
			async: false,
-
 
154
			success: function (data) {
-
 
155
				alert("Purchase booked successfully");
140
			alert("Purchase booked successfully");
156
				$('#scanNonSerializedModel').modal('hide');
141
			$('#scanNonSerializedModel').modal('hide');
157
				$("#scanNonSerializedModel").on("hidden.bs.modal", function () {
142
			$("#scanNonSerializedModel").on("hidden.bs.modal", function () {
158
					$("#purchase-reference-submit-button").click();
143
				$("#purchase-reference-submit-button").click();
159
				});
144
			});
160
			},
-
 
161
			cache: false,
-
 
162
			processData: false
-
 
163
		});
145
		});
164
		return false;
146
		return false;
165
	});
147
	});
166
 
148
 
167
	$("#grnImeiInformation :input").live('change paste keyup mouseup', function() {
149
	$("#grnImeiInformation :input").live('change paste keyup mouseup', function() {
Line 262... Line 244...
262
});
244
});
263
 
245
 
264
 
246
 
265
function loadNewGrn(domId){
247
function loadNewGrn(domId){
266
	//var response = doGetAjaxRequest(context+"/purchase");
248
	//var response = doGetAjaxRequest(context+"/purchase");
267
	doAjaxRequestHandler(context+"/purchase", "GET", function(response){
249
	doGetAjaxRequestHandler(context+"/purchase", function(response){
268
		$('#' + domId).html(response);
250
		$('#' + domId).html(response);
269
	});
251
	});
270
	  
252
	  
271
}
253
}
272
 
254
 
273
function getPurchaseByInvoiceNumber(){
255
function getPurchaseByInvoiceNumber(){
274
	var airwayBillOrInvoiceNumber = $('#airwayBillOrInvoiceNumberText').val();
256
	var airwayBillOrInvoiceNumber = $('#airwayBillOrInvoiceNumberText').val();
275
	doAjaxRequestHandler(context+"/purchaseByInvoiceNumber?airwayBillOrInvoiceNumber="+airwayBillOrInvoiceNumber, "GET", function(response){
257
	doGetAjaxRequestHandler(context+"/purchaseByInvoiceNumber?airwayBillOrInvoiceNumber="+airwayBillOrInvoiceNumber, function(response){
276
		$('#main-content').html(response);
258
		$('#main-content').html(response);
277
	});
259
	});
278
	//var response = doGetAjaxRequest(context+"/purchaseByInvoiceNumber?airwayBillOrInvoiceNumber="+airwayBillOrInvoiceNumber);
-
 
279
	
-
 
280
}
260
}
281
 
261
 
282
function loadPendingGrn(domId){
262
function loadPendingGrn(domId){
283
	doAjaxRequestHandler(context+"/pendingGrn", "GET", function(response){
263
	doGetAjaxRequestHandler(context+"/pendingGrn", function(response){
284
		$('#' + domId).html(response);
264
		$('#' + domId).html(response);
285
	});
265
	});
286
}
266
}
287
 
267
 
288
function loadGrnHistory(domId,purchase_reference,searchType, startTime, endTime){
268
function loadGrnHistory(domId,purchase_reference,searchType, startTime, endTime){
289
	doAjaxRequestHandler(context+"/grnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
269
	doGetAjaxRequestHandler(context+"/grnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
290
	        +"&startTime="+startTime
270
	        +"&startTime="+startTime
291
	        +"&endTime="+endTime, "GET", function(response){
271
	        +"&endTime="+endTime, function(response){
292
		$('#' + domId).html(response);
272
		$('#' + domId).html(response);
293
	});
273
	});
294
}
274
}
295
 
275
 
296
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
276
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
297
	doAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
277
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
298
	        +"&startTime="+startTime
278
	        +"&startTime="+startTime
299
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
279
	        +"&endTime="+endTime+"&offset="+pre, function(response){
300
		$( "#grn-history-paginated .end" ).text(+end - +10);
280
		$( "#grn-history-paginated .end" ).text(+end - +10);
301
		$( "#grn-history-paginated .start" ).text(+start - +10);
281
		$( "#grn-history-paginated .start" ).text(+start - +10);
302
		$('#grn-history-table').html(response);
282
		$('#grn-history-table').html(response);
303
		$("#grn-history-paginated .next").prop('disabled', false);
283
		$("#grn-history-paginated .next").prop('disabled', false);
304
		if (parseInt(pre)==0)
284
		if (parseInt(pre)==0){
305
		{
-
 
306
			$("#grn-history-paginated .previous").prop('disabled', true);
285
			$("#grn-history-paginated .previous").prop('disabled', true);
307
		}
286
		}
308
	});
287
	});
309
		
288
		
310
}
289
}
Line 313... Line 292...
313
function getGrnHistoryNextItems(start, end, purchase_reference, searchType,startTime,endTime){
292
function getGrnHistoryNextItems(start, end, purchase_reference, searchType,startTime,endTime){
314
	console.log(start);
293
	console.log(start);
315
	console.log(end);
294
	console.log(end);
316
	console.log(+end + +10);
295
	console.log(+end + +10);
317
	console.log(+start + +10);
296
	console.log(+start + +10);
318
	doAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
297
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
319
	        +"&startTime="+startTime
298
	        +"&startTime="+startTime
320
	        +"&endTime="+endTime+"&offset="+end, "GET", function(response){
299
	        +"&endTime="+endTime+"&offset="+end, function(response){
321
		var size = $("#grn-history-paginated .size").text();
300
		var size = $("#grn-history-paginated .size").text();
322
		if((parseInt(end) + 10) > parseInt(size)){
301
		if((parseInt(end) + 10) > parseInt(size)){
323
			console.log("(end + 10) > size == true");
302
			console.log("(end + 10) > size == true");
324
			$( "#grn-history-paginated .end" ).text(size);
303
			$( "#grn-history-paginated .end" ).text(size);
325
		}else{
304
		}else{
Line 339... Line 318...
339
	
318
	
340
    
319
    
341
}
320
}
342
 
321
 
343
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
322
function getGrnHistoryPreviousItems(start,end,pre,purchase_reference, searchType,startTime,endTime){
344
	doAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
323
	doGetAjaxRequestHandler(context+"/getPaginatedGrnHistory/?purchaseReference="+purchase_reference+"&searchType="+searchType
345
	        +"&startTime="+startTime
324
	        +"&startTime="+startTime
346
	        +"&endTime="+endTime+"&offset="+pre, "GET", function(response){
325
	        +"&endTime="+endTime+"&offset="+pre, function(response){
347
		$( "#grn-history-paginated .end" ).text(+end - +10);
326
		$( "#grn-history-paginated .end" ).text(+end - +10);
348
		$( "#grn-history-paginated .start" ).text(+start - +10);
327
		$( "#grn-history-paginated .start" ).text(+start - +10);
349
		$('#grn-history-table').html(response);
328
		$('#grn-history-table').html(response);
350
		$("#grn-history-paginated .next").prop('disabled', false);
329
		$("#grn-history-paginated .next").prop('disabled', false);
351
		if (parseInt(pre)==0)
330
		if (parseInt(pre)==0)
Line 364... Line 343...
364
    var result = $("#grnImeiInformation :input[value='" + value + "']").length - 1;
343
    var result = $("#grnImeiInformation :input[value='" + value + "']").length - 1;
365
    return result;
344
    return result;
366
}
345
}
367
 
346
 
368
function loadGrnDetails(purchaseId, domId){
347
function loadGrnDetails(purchaseId, domId){
369
	doAjaxRequestHandler(context+"/grnHistoryDetailByPurchaseId/?purchaseId="+purchaseId, "GET", function(response){
348
	doGetAjaxRequestHandler(context+"/grnHistoryDetailByPurchaseId/?purchaseId="+purchaseId, function(response){
370
		$('#' + domId).html(response);
349
		$('#' + domId).html(response);
371
		window.dispatchEvent(new Event('resize'));
350
		window.dispatchEvent(new Event('resize'));
372
	});	
351
	});	
373
}
352
}
374
 
353
 
375
function loadPendingGrnDetails(orderId, domId){
354
function loadPendingGrnDetails(orderId, domId){
376
	doAjaxRequestHandler(context+"/pendingGrnDetails/?orderId="+orderId, "GET", function(response){
355
	doGetAjaxRequestHandler(context+"/pendingGrnDetails/?orderId="+orderId, function(response){
377
		$('#' + domId).html(response);
356
		$('#' + domId).html(response);
378
		window.dispatchEvent(new Event('resize'));
357
		window.dispatchEvent(new Event('resize'));
379
	});
358
	});
380
	
359
	
381
}
360
}