Subversion Repositories SmartDukaan

Rev

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

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