Subversion Repositories SmartDukaan

Rev

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

Rev 35458 Rev 35459
Line 70... Line 70...
70
		'<input type="text" class="form-control">' +
70
		'<input type="text" class="form-control">' +
71
		'</div>' +
71
		'</div>' +
72
		'</div>';
72
		'</div>';
73
	while (qty > 0) {
73
	while (qty > 0) {
74
		var divText = "";
74
		var divText = "";
-
 
75
		if (qty < 4) {
-
 
76
			var cp = qty;
75
		var loopCount = qty < 4 ? qty : 4;
77
			for (var i = 0; i < cp; i++) {
-
 
78
				divText = divText + innerDiv;
-
 
79
				qty = qty - 1;
-
 
80
			}
-
 
81
		} else {
76
		for (var i = 0; i < loopCount; i++) {
82
			for (var i = 0; i < 4; i++) {
77
			divText = divText + innerDiv;
83
				divText = divText + innerDiv;
78
			qty = qty - 1;
84
				qty = qty - 1;
-
 
85
			}
79
		}
86
		}
80
		divText = divCode.replace("CONTENT", divText);
87
		divText = divCode.replace("CONTENT", divText);
81
		$("#grnImeiInformation")
88
		$("#grnImeiInformation")
82
			.append(divText)
89
			.append(divText)
83
	}
90
	}
Line 133... Line 140...
133
	});
140
	});
134
	return false;
141
	return false;
135
});
142
});
136
 
143
 
137
$(document).on('change', "#grnImeiInformation :input", function () {
144
$(document).on('change', "#grnImeiInformation :input", function () {
138
	var value = $(this).val().trim();
145
	if ($(this).val().trim() != "") {
139
	if (value !== "") {
146
		console.log('The text box really changed this time');
140
		$('#grnImeiInformation :input').removeClass("border-highlight");
147
		$('#grnImeiInformation :input').removeClass("border-highlight");
141
		if (findDuplicateSerialNumbers(value) > 0) {
148
		if (findDuplicateSerialNumbers($(this).val().trim()) > 0) {
142
			var inputs = $("#grnImeiInformation :input[value='" + value + "']");
149
			var inputs = $("#grnImeiInformation :input[value=" + $(this).val().trim() + "]");
143
			if (inputs.length > 1) {
150
			if (inputs.length > 1) {
144
				inputs.each(function () {
151
				inputs.each(function () {
145
					$(this).addClass("border-highlight");
152
					$(this).addClass("border-highlight")
146
				});
153
				});
147
			}
154
			}
148
		}
155
		}
149
	}
156
	}
150
});
157
});
151
 
158
 
-
 
159
 
152
$(document).on('paste', "#grnImeiInformation :input", function () {
160
$(document).on('paste', "#grnImeiInformation :input", function () {
153
	if ($(this).val().trim() !== "") {
161
	if ($(this).val().trim() != "") {
-
 
162
		console.log('paste event');
154
		$(this).next("input .form-control").focus();
163
		$(this).next("input .form-control").focus();
155
	}
164
	}
156
});
165
});
157
 
166
 
158
$(document).on("keyup", "#airwayBillOrInvoiceNumberText", function (e) {
167
$(document).on("keyup", "#airwayBillOrInvoiceNumberText", function (e) {
159
	var keyCode = e.keyCode || e.which;
168
	var keyCode = e.keyCode || e.which;
160
	if (keyCode === 13) {
169
	if (keyCode == 13) {
161
		$("#purchase-reference-submit-button").click();
170
		$("#purchase-reference-submit-button").click();
162
	}
171
	}
163
});
172
});
164
 
173
 
165
$(document).on('click', "#grn-history-search-button", function () {
174
$(document).on('click', "#grn-history-search-button", function () {
166
	grnhistory.searchText = $("#grn-history-search-text").val();
175
	grnhistory.searchText = $("#grn-history-search-text").val();
167
	grnhistory.searchType = "purchaseReference";
176
	grnhistory.searchType = "purchaseReference";
168
	var dateRange = getDatesFromPicker($("#grnDateRange"));
-
 
169
	grnhistory.startTime = dateRange.startDate;
177
	grnhistory.startTime = startDate;
170
	grnhistory.endTime = dateRange.endDate;
178
	grnhistory.endTime = endDate;
171
	if (typeof (grnhistory.searchText) === "undefined" || !grnhistory.searchText) {
179
	if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText) {
172
		grnhistory.searchText = "";
180
		grnhistory.searchText = "";
173
	}
181
	}
174
	loadGrnHistorySearchInfo(grnhistory.searchText, grnhistory.searchType, grnhistory.startTime, grnhistory.endTime);
182
	loadGrnHistorySearchInfo(grnhistory.searchText, grnhistory.searchType, grnhistory.startTime, grnhistory.endTime);
175
});
183
});
176
 
184
 
177
$(document).on('click', "#grn-history-download-button", function () {
185
$(document).on('click', "#grn-history-download-button", function () {
178
	grnhistory.searchText = $("#grn-history-search-text").val();
186
	grnhistory.searchText = $("#grn-history-search-text").val();
179
	grnhistory.searchType = "purchaseReference";
187
	grnhistory.searchType = "purchaseReference";
180
	var dateRange = getDatesFromPicker($("#grnDateRange"));
-
 
181
	grnhistory.startTime = dateRange.startDate;
188
	grnhistory.startTime = startDate;
182
	grnhistory.endTime = dateRange.endDate;
189
	grnhistory.endTime = endDate;
183
	if (typeof (grnhistory.searchText) === "undefined" || !grnhistory.searchText) {
190
	if (typeof (grnhistory.searchText) == "undefined" || !grnhistory.searchText) {
184
		grnhistory.searchText = "";
191
		grnhistory.searchText = "";
185
	}
192
	}
186
	downloadPurchaseInvoices(grnhistory.searchText, grnhistory.searchType, grnhistory.startTime, grnhistory.endTime);
193
	downloadPurchaseInvoices(grnhistory.searchText, grnhistory.searchType, grnhistory.startTime, grnhistory.endTime);
187
});
194
});
188
 
195
 
189
$(document).on("keyup", "#grn-history-search-text", function (e) {
196
$(document).on("keyup", "#grn-history-search-text", function (e) {
190
	var keyCode = e.keyCode || e.which;
197
	var keyCode = e.keyCode || e.which;
191
	if (keyCode === 13) {
198
	if (keyCode == 13) {
192
		$("#grn-history-search-button").click();
199
		$("#grn-history-search-button").click();
193
	}
200
	}
194
});
201
});
195
 
202
 
196
$(document).on('click', "#grn-history-paginated .next", function () {
203
$(document).on('click', "#grn-history-paginated .next", function () {
Line 243... Line 250...
243
	loadPendingGrnDetails(purchaseReference, "main-content");
250
	loadPendingGrnDetails(purchaseReference, "main-content");
244
});
251
});
245
 
252
 
246
 
253
 
247
function loadNewGrn(domId, invoiceNumber) {
254
function loadNewGrn(domId, invoiceNumber) {
-
 
255
	//var response = doGetAjaxRequest(context+"/purchase");
248
	doGetAjaxRequestHandler(context + "/purchase", function (response) {
256
	doGetAjaxRequestHandler(context + "/purchase", function (response) {
249
		$('#' + domId).html(response);
257
		$('#' + domId).html(response);
250
		if (invoiceNumber !== undefined) {
258
		if (invoiceNumber != undefined) {
251
			$("#airwayBillOrInvoiceNumberText").val(invoiceNumber);
259
			$("#airwayBillOrInvoiceNumberText").val(invoiceNumber);
252
			$("#purchase-reference-submit-button").click();
260
			$("#purchase-reference-submit-button").click();
253
		}
261
		}
254
	});
262
	});
-
 
263
 
255
}
264
}
256
 
265
 
257
function getPurchaseByInvoiceNumber() {
266
function getPurchaseByInvoiceNumber() {
258
	var airwayBillOrInvoiceNumber = $('#airwayBillOrInvoiceNumberText').val();
267
	var airwayBillOrInvoiceNumber = $('#airwayBillOrInvoiceNumberText').val();
259
	doGetAjaxRequestHandler(context + "/purchaseByInvoiceNumber?airwayBillOrInvoiceNumber=" + airwayBillOrInvoiceNumber, function (response) {
268
	doGetAjaxRequestHandler(context + "/purchaseByInvoiceNumber?airwayBillOrInvoiceNumber=" + airwayBillOrInvoiceNumber, function (response) {
Line 278... Line 287...
278
function loadGrnHistorySearchInfo(search_text, searchType, startTime, endTime) {
287
function loadGrnHistorySearchInfo(search_text, searchType, startTime, endTime) {
279
	loadGrnHistory("main-content", search_text, searchType, startTime, endTime);
288
	loadGrnHistory("main-content", search_text, searchType, startTime, endTime);
280
}
289
}
281
 
290
 
282
function downloadPurchaseInvoice(search_text, searchType, startTime, endTime) {
291
function downloadPurchaseInvoice(search_text, searchType, startTime, endTime) {
283
	var purchaseInvoice_url = context + "/grnHistory?purchaseReference=" + search_text + "&searchType=" + searchType
292
	purchaseInvoice_url = context + "/grnHistory?purchaseReference=" + purchase_reference + "&searchType=" + searchType
284
		+ "&startTime=" + startTime + "&endTime=" + endTime;
293
		+ "&startTime=" + startTime + "&endTime=" + endTime;
285
	return purchaseInvoice_url;
-
 
286
}
294
}
287
 
295
 
288
function findDuplicateSerialNumbers(value) {
296
function findDuplicateSerialNumbers(value) {
289
	var result = $("#grnImeiInformation :input[value='" + value + "']").length - 1;
297
	var result = $("#grnImeiInformation :input[value='" + value + "']").length - 1;
290
	return result;
298
	return result;
Line 304... Line 312...
304
	});
312
	});
305
 
313
 
306
}
314
}
307
 
315
 
308
function grnPartial(invoiceNumber) {
316
function grnPartial(invoiceNumber) {
309
	var serialNumbers = $("#all-imeis").tagsinput('items');
317
	let serialNumbers = $("#all-imeis").tagsinput('items');
310
	if (serialNumbers.length === 0) {
318
	if (serialNumbers.length == 0) {
311
		alert("Please add IMEIs");
319
		alert("Pls add imeis");
312
		$("#all-imeis").focus();
320
		$("#all-imeis").focus();
313
		return false;
321
		return false;
314
	}
322
	}
315
	let imeisJson = {
323
	let imeisJson = {
316
		serialNumbers: serialNumbers,
324
		serialNumbers: serialNumbers,
Line 335... Line 343...
335
$(document).on('click', '.partner-hid-allocation', function () {
343
$(document).on('click', '.partner-hid-allocation', function () {
336
	partnerHidAllocationList();
344
	partnerHidAllocationList();
337
});
345
});
338
 
346
 
339
function partnerHidAllocationList() {
347
function partnerHidAllocationList() {
340
	if (typeof partnerId !== "undefined") {
348
	if (typeof partnerId != "undefined") {
341
		doGetAjaxRequestHandler(context + "/pur-sale-ratio/stock/hid-catalog-allocation-list?fofoId=" + partnerId,
349
		doGetAjaxRequestHandler(context + "/pur-sale-ratio/stock/hid-catalog-allocation-list?fofoId=" + partnerId,
342
			function (response) {
350
			function (response) {
343
				$('.hid-allocation-conatiner').html(response);
351
				$('.hid-allocation-conatiner').html(response);
344
			});
352
			});
345
	} else {
353
	} else {