Subversion Repositories SmartDukaan

Rev

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

Rev 27517 Rev 27583
Line 9... Line 9...
9
			delete pendingPO;
9
			delete pendingPO;
10
			delete pendingPOCustomer;
10
			delete pendingPOCustomer;
11
		}
11
		}
12
		loadCatalog("main-content", "");
12
		loadCatalog("main-content", "");
13
	});
13
	});
-
 
14
 
-
 
15
 
-
 
16
	$('.add-compare-checkbox').live('change', function() {
-
 
17
  
-
 
18
		let catalogitemid = [$(this).data("catalogitemid")];
-
 
19
		let  checked = $(this).is(':checked');
-
 
20
		console.log(checked);
-
 
21
		$cbToModify = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
-
 
22
			return ($(this).data("catalogitemid") == catalogitemid && $(this).is(':checked') != checked);
-
 
23
		});
-
 
24
		
-
 
25
		let count=0;
-
 
26
		$cbToModify.prop("checked", checked).prop("disabled", checked);
-
 
27
		let cbToCondition = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
-
 
28
			return ($(this).is(':checked') != checked);
-
 
29
		});
-
 
30
		
-
 
31
		$('#add-to-compare-check').closest('table').find('tr').each(function() {
-
 
32
 
-
 
33
			var row = $(this);
-
 
34
 
-
 
35
			if (row.find('input[name="compare-check"]').is(':checked'))
-
 
36
		    {
-
 
37
        	count++;
-
 
38
        	
-
 
39
			}
-
 
40
		});
-
 
41
 
-
 
42
      console.log(count);
-
 
43
        $cbToModify.prop("checked", checked).prop("disabled", checked);
-
 
44
		 
-
 
45
	});
-
 
46
 
-
 
47
	$("#Go-compare-button").live('click', function() {
-
 
48
 
-
 
49
		console.log('helo');
-
 
50
		var gocatalogitemid = [];
-
 
51
 
-
 
52
		$('table').find('input[type="checkbox"]:enabled:checked').each(function(el){
-
 
53
			gocatalogitemid.push($(this).data("catalogitemid"));
-
 
54
		});
-
 
55
		console.log(gocatalogitemid);
-
 
56
		if(gocatalogitemid.length <4 ){
-
 
57
 
-
 
58
		doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + gocatalogitemid.join(","), "GET", 
-
 
59
			function(response) {
-
 
60
				console.log(response)
-
 
61
			$('#' + "main-content").html(response);
-
 
62
			});
-
 
63
	}
14
	
64
	
-
 
65
	});
-
 
66
 
-
 
67
 
-
 
68
	$(document).on('click', '#catalog-button', function() {
-
 
69
 
-
 
70
		loadSimilarCatalog("main-content", "");
-
 
71
	});
-
 
72
 
-
 
73
 
-
 
74
 
15
	$('.view-invoices').live('click', function() {
75
	$('.view-invoices').live('click', function() {
16
		loadInvoice();
76
		loadInvoice();
17
	});
77
	});
18
 
78
 
-
 
79
 
19
	$(".review_order").live('click', function() {
80
	$(".review_order").live('click', function() {
20
		loadOrder("main-content");
81
		loadOrder("main-content");
21
	});
82
	});
22
 
83
 
23
	$(".notify_cancel").live('click', function() {
84
	$(".notify_cancel").live('click', function() {
Line 78... Line 139...
78
	$(".bad_inventory").live('click', function() {
139
	$(".bad_inventory").live('click', function() {
79
		loadBadInventory("main-content", "");
140
		loadBadInventory("main-content", "");
80
	});
141
	});
81
 
142
 
82
	$("#good-inventory-paginated .next").live(
143
	$("#good-inventory-paginated .next").live(
83
			'click',
144
		'click',
84
			function() {
145
		function() {
85
				var searchText = $("#good-inventory-search-text").val();
146
			var searchText = $("#good-inventory-search-text").val();
86
				if (typeof (searchText) == "undefined" || !searchText) {
147
			if (typeof (searchText) == "undefined" || !searchText) {
87
					searchText = "";
148
				searchText = "";
88
 
149
 
89
				}
150
			}
90
				var params = {};
151
			var params = {};
91
				params['searchTerm'] = searchText;
152
			params['searchTerm'] = searchText;
92
				loadPaginatedNextItems('/getPaginatedCurrentInventorySnapshot',
153
			loadPaginatedNextItems('/getPaginatedCurrentInventorySnapshot',
93
						params, 'good-inventory-paginated',
154
				params, 'good-inventory-paginated',
94
						'good-inventory-table', null);
155
				'good-inventory-table', null);
95
				$(this).blur();
156
			$(this).blur();
96
			});
157
		});
97
 
158
 
98
	$("#good-inventory-paginated .previous").live(
159
	$("#good-inventory-paginated .previous").live(
99
			'click',
160
		'click',
100
			function() {
161
		function() {
101
				var searchText = $("#good-inventory-search-text").val();
162
			var searchText = $("#good-inventory-search-text").val();
102
				if (typeof (searchText) == "undefined" || !searchText) {
163
			if (typeof (searchText) == "undefined" || !searchText) {
103
					searchText = "";
164
				searchText = "";
104
				}
165
			}
105
				var params = {};
166
			var params = {};
106
				params['searchTerm'] = searchText;
167
			params['searchTerm'] = searchText;
107
				loadPaginatedPreviousItems(
168
			loadPaginatedPreviousItems(
108
						'/getPaginatedCurrentInventorySnapshot', params,
169
				'/getPaginatedCurrentInventorySnapshot', params,
109
						'good-inventory-paginated', 'good-inventory-table',
170
				'good-inventory-paginated', 'good-inventory-table',
110
						null);
171
				null);
111
				$(this).blur();
172
			$(this).blur();
112
			});
173
		});
113
 
174
 
114
	$("#good-inventory-search-button").live('click', function() {
175
	$("#good-inventory-search-button").live('click', function() {
115
		var searchText = $("#good-inventory-search-text").val();
176
		var searchText = $("#good-inventory-search-text").val();
116
		if (typeof (searchText) == "undefined" || !searchText) {
177
		if (typeof (searchText) == "undefined" || !searchText) {
117
			searchText = "";
178
			searchText = "";
Line 125... Line 186...
125
			$("#good-inventory-search-button").click();
186
			$("#good-inventory-search-button").click();
126
		}
187
		}
127
	});
188
	});
128
 
189
 
129
	$("#catalog-paginated .next").live(
190
	$("#catalog-paginated .next").live(
130
			'click',
191
		'click',
131
			function() {
192
		function() {
132
				var searchText = $("#catalog-search-text").val();
193
			var searchText = $("#catalog-search-text").val();
133
				if (typeof (searchText) == "undefined" || !searchText) {
194
			if (typeof (searchText) == "undefined" || !searchText) {
134
					searchText = "";
195
				searchText = "";
135
				}
196
			}
136
 
197
 
-
 
198
			var searchItem = $("#catalog-search-text-compare").val();
-
 
199
			console.log(searchItem)
-
 
200
 
137
				var params = {};
201
			var params = {};
-
 
202
 
-
 
203
			if (searchItem) {
-
 
204
				params['itemId'] = currentItem.itemId;
-
 
205
			}
138
				params['searchTerm'] = searchText;
206
			params['searchTerm'] = searchText;
139
				loadPaginatedNextItems('/getPaginatedCatalog', params,
207
			loadPaginatedNextItems('/getPaginatedCatalog', params,
140
						'catalog-paginated', 'catalog-table', null);
208
				'catalog-paginated', 'catalog-table', null);
141
				$(this).blur();
209
			$(this).blur();
142
			});
210
		});
143
 
211
 
144
	$("#catalog-paginated .previous").live(
212
	$("#catalog-paginated .previous").live(
145
			'click',
-
 
146
			function() {
213
		'click',function() {
147
				var searchText = $("#catalog-search-text").val();
214
			var searchText = $("#catalog-search-text").val();
148
				if (typeof (searchText) == "undefined" || !searchText) {
215
			if (typeof (searchText) == "undefined" || !searchText) {
149
					searchText = "";
216
				searchText = "";
150
				}
217
			}
-
 
218
			var searchItem = $("#catalog-search-text-compare").val();
-
 
219
			console.log(searchItem)
151
 
220
 
152
				var params = {};
221
			var params = {};
-
 
222
 
-
 
223
			if (searchItem)
-
 
224
		  {
-
 
225
				params['itemId'] = currentItem.itemId;
-
 
226
		  }
153
				params['searchTerm'] = searchText;
227
			params['searchTerm'] = searchText;
154
				loadPaginatedPreviousItems('/getPaginatedCatalog', params,
228
			loadPaginatedPreviousItems('/getPaginatedCatalog', params,
155
						'catalog-paginated', 'catalog-table', null);
229
				'catalog-paginated', 'catalog-table', null);
156
				$(this).blur();
230
			$(this).blur();
157
			});
231
		});
158
 
232
 
159
	$("#catalog-search-button").live('click', function() {
233
	$("#catalog-search-button").live('click', function() {
160
		var searchText = $("#catalog-search-text").val();
234
		var searchText = $("#catalog-search-text").val();
161
		if (typeof (searchText) == "undefined" || !searchText) {
235
		if (typeof (searchText) == "undefined" || !searchText) {
162
			searchText = "";
236
			searchText = "";
Line 170... Line 244...
170
			$("#catalog-search-button").click();
244
			$("#catalog-search-button").click();
171
		}
245
		}
172
	});
246
	});
173
 
247
 
174
	$(".cancellation").live(
248
	$(".cancellation").live(
175
			"click",
249
		"click",
176
			function(e) {
250
		function(e) {
177
				orderid = $(this).data('orderid');
251
			orderid = $(this).data('orderid');
178
				itemId = $(this).data('itemid');
252
			itemId = $(this).data('itemid');
179
 
253
 
180
				doGetAjaxRequestHandler(context
254
			doGetAjaxRequestHandler(context
181
						+ "/getcancelOrderItems?itemId=" + itemId, function(
255
				+ "/getcancelOrderItems?itemId=" + itemId, function(
182
						response) {
256
					response) {
183
					$('.cancel-order-container .modal-content').html(response);
257
				$('.cancel-order-container .modal-content').html(response);
184
					$("#textreason").hide();
258
				$("#textreason").hide();
185
				});
-
 
186
			});
259
			});
-
 
260
		});
187
 
261
 
188
	$(".cancel-order-submit").live("click", function(e) {
262
	$(".cancel-order-submit").live("click", function(e) {
189
		requestcancelOrder();
263
		requestcancelOrder();
190
	});
264
	});
191
	$(".keepatab").live("click", function(e) {
265
	$(".keepatab").live("click", function(e) {
Line 201... Line 275...
201
	$(".mk_button").on("click", function() {
275
	$(".mk_button").on("click", function() {
202
 
276
 
203
	});
277
	});
204
 
278
 
205
	$(".closeOrder")
279
	$(".closeOrder")
206
			.live(
280
		.live(
207
					"click",
281
			"click",
208
					function(e) {
282
			function(e) {
209
						orderid = $(this).data('orderid');
283
				orderid = $(this).data('orderid');
210
						if (confirm("Are you sure you want to close the order") == true) {
284
				if (confirm("Are you sure you want to close the order") == true) {
211
 
-
 
212
							doPostAjaxRequestHandler(context
-
 
213
									+ "/closeOrder?orderId=" + orderd,
-
 
214
									function(response) {
-
 
215
										if (response == 'true') {
-
 
216
											alert("successfully close");
-
 
217
											loadtabOrder("main-content");
-
 
218
										}
-
 
219
									});
-
 
220
						}
-
 
221
 
285
 
-
 
286
					doPostAjaxRequestHandler(context
-
 
287
						+ "/closeOrder?orderId=" + orderd,
-
 
288
						function(response) {
-
 
289
							if (response == 'true') {
-
 
290
								alert("successfully close");
-
 
291
								loadtabOrder("main-content");
-
 
292
							}
222
					});
293
						});
-
 
294
				}
-
 
295
 
-
 
296
			});
223
	$('#notify-table').find(':checkbox').live('change', function(e) {
297
	$('#notify-table').find(':checkbox').live('change', function(e) {
224
		var colormessage = [];
298
		var colormessage = [];
225
		$("#notify-table input[type=checkbox]:checked").each(function() {
299
		$("#notify-table input[type=checkbox]:checked").each(function() {
226
 
300
 
227
			var row = $(this).closest("tr")[0];
301
			var row = $(this).closest("tr")[0];
Line 255... Line 329...
255
			$('#textnotifymessage').hide();
329
			$('#textnotifymessage').hide();
256
		}
330
		}
257
	});
331
	});
258
 
332
 
259
	$(".notify-cancel-order-submit")
333
	$(".notify-cancel-order-submit")
260
			.live(
334
		.live(
261
					"click",
335
			"click",
262
					function(e) {
336
			function(e) {
263
						var jsonObject = {};
337
				var jsonObject = {};
264
						var orderAndItemIdsJson = [];
338
				var orderAndItemIdsJson = [];
265
						var orderAndItemIds;
339
				var orderAndItemIds;
266
						var orderIds;
340
				var orderIds;
267
						var message;
341
				var message;
268
						message = $('#textNotifyCancellationMessage').val();
342
				message = $('#textNotifyCancellationMessage').val();
269
 
343
 
270
						var partnerchecked = $("input[name='partnerCancelOrderCheck']:checked").length;
344
				var partnerchecked = $("input[name='partnerCancelOrderCheck']:checked").length;
271
 
345
 
272
						if (!partnerchecked) {
346
				if (!partnerchecked) {
273
							alert("You must check at least one partner.");
347
					alert("You must check at least one partner.");
274
							return false;
348
					return false;
275
						}
349
				}
276
 
350
 
277
						if (message === "") {
351
				if (message === "") {
278
							alert("message is required");
352
					alert("message is required");
279
							return false;
353
					return false;
-
 
354
				}
-
 
355
 
-
 
356
				$('#partner-cancel-order-table')
-
 
357
					.find('tr')
-
 
358
					.each(
-
 
359
						function() {
-
 
360
							var row = $(this);
-
 
361
 
-
 
362
							console.log(row);
-
 
363
							if (row
-
 
364
								.find(
-
 
365
									'input[name="partnerCancelOrderCheck"]')
-
 
366
								.is(':checked')) {
-
 
367
								var currentRow = $(this)
-
 
368
									.closest("tr");
-
 
369
 
-
 
370
								var col5 = currentRow.find(
-
 
371
									"td:eq(1)").html();
-
 
372
								var col6 = currentRow.find(
-
 
373
									"td:eq(2)").html();
-
 
374
 
-
 
375
								orderIds = {
-
 
376
									"orderId": col6,
-
 
377
									"olditemId": col5
-
 
378
								}
-
 
379
								orderAndItemIdsJson
-
 
380
									.push(orderIds)
-
 
381
 
280
						}
382
							}
-
 
383
 
-
 
384
						});
-
 
385
 
-
 
386
				jsonObject['orderIds'] = orderAndItemIdsJson;
-
 
387
				jsonObject['message'] = message
-
 
388
				console.log(jsonObject)
281
 
389
 
282
						$('#partner-cancel-order-table')
-
 
283
								.find('tr')
-
 
284
								.each(
-
 
285
										function() {
-
 
286
											var row = $(this);
-
 
287
 
-
 
288
											console.log(row);
-
 
289
											if (row
-
 
290
													.find(
-
 
291
															'input[name="partnerCancelOrderCheck"]')
-
 
292
													.is(':checked')) {
-
 
293
												var currentRow = $(this)
-
 
294
														.closest("tr");
-
 
295
 
-
 
296
												var col5 = currentRow.find(
-
 
297
														"td:eq(1)").html();
-
 
298
												var col6 = currentRow.find(
-
 
299
														"td:eq(2)").html();
-
 
300
 
-
 
301
												orderIds = {
-
 
302
													"orderId" : col6,
-
 
303
													"olditemId" : col5
-
 
304
												}
-
 
305
												orderAndItemIdsJson
-
 
306
														.push(orderIds)
-
 
307
 
-
 
308
											}
-
 
309
 
-
 
310
										});
-
 
311
 
-
 
312
						jsonObject['orderIds'] = orderAndItemIdsJson;
-
 
313
						jsonObject['message'] = message
-
 
314
						console.log(jsonObject)
-
 
315
 
-
 
316
						if (confirm("Are you sure you want to notify the order") == true) {
390
				if (confirm("Are you sure you want to notify the order") == true) {
317
 
391
 
318
							doPostAjaxRequestWithJsonHandler(context
392
					doPostAjaxRequestWithJsonHandler(context
319
									+ "/notifyCancelOrder", JSON
393
						+ "/notifyCancelOrder", JSON
320
									.stringify(jsonObject), function(response) {
394
							.stringify(jsonObject), function(response) {
321
								if (response == 'true') {
395
								if (response == 'true') {
322
									alert("successfully notify");
396
									alert("successfully notify");
323
									$('#notifyCancelOrder').modal('hide');
397
									$('#notifyCancelOrder').modal('hide');
324
									$('.modal-backdrop').remove();
398
									$('.modal-backdrop').remove();
325
									loadOrder("main-content");
399
									loadOrder("main-content");
326
								}
400
								}
327
							});
401
							});
328
						}
402
				}
329
 
403
 
330
					});
404
			});
331
	$(".notify-submit")
405
	$(".notify-submit")
332
			.live(
406
		.live(
333
					"click",
407
			"click",
334
					function(e) {
408
			function(e) {
335
 
409
 
336
						var jsonObject = {};
410
				var jsonObject = {};
337
						var orderIdsJSon = [];
411
				var orderIdsJSon = [];
338
						var ItemIdsJson = [];
412
				var ItemIdsJson = [];
339
						var itemIds;
413
				var itemIds;
340
						var orderIds;
414
				var orderIds;
341
						var message;
415
				var message;
342
 
416
 
343
						if ($('#overridemessage').is(':checked')) {
417
				if ($('#overridemessage').is(':checked')) {
344
							message = $('#textnotifymessage').val();
418
					message = $('#textnotifymessage').val();
345
						} else {
419
				} else {
346
							message = $('#notifymsg').text();
420
					message = $('#notifymsg').text();
347
						}
421
				}
348
 
422
 
349
						console.log(message);
423
				console.log(message);
350
						var itemchecked = $("input[name='itemCheck']:checked").length;
424
				var itemchecked = $("input[name='itemCheck']:checked").length;
351
 
425
 
352
						if (!itemchecked) {
426
				if (!itemchecked) {
353
							alert("You must check at least one item.");
427
					alert("You must check at least one item.");
354
							return false;
428
					return false;
355
						}
429
				}
356
						var partnerchecked = $("input[name='partnerCheck']:checked").length;
430
				var partnerchecked = $("input[name='partnerCheck']:checked").length;
357
 
431
 
358
						if (!partnerchecked) {
432
				if (!partnerchecked) {
359
							alert("You must check at least one partner.");
433
					alert("You must check at least one partner.");
360
							return false;
434
					return false;
361
						}
435
				}
362
 
436
 
363
						if (message === "") {
437
				if (message === "") {
364
							alert("message is required");
438
					alert("message is required");
365
							return false;
439
					return false;
-
 
440
				}
-
 
441
 
-
 
442
				$('#notify-table')
-
 
443
					.find('tr')
-
 
444
					.each(
-
 
445
						function() {
-
 
446
							var row = $(this);
-
 
447
 
-
 
448
							console.log(row);
-
 
449
							if (row.find(
-
 
450
								'input[name="itemCheck"]')
-
 
451
								.is(':checked')) {
-
 
452
								var currentRow = $(this)
-
 
453
									.closest("tr");
-
 
454
 
-
 
455
								var col1 = currentRow
-
 
456
									.find(
-
 
457
										"td:eq(0) input[type='checkbox']")
-
 
458
									.val(); // get current
-
 
459
								// row 1st TD
-
 
460
								// value
-
 
461
								var col2 = currentRow
-
 
462
									.find(
-
 
463
										"td:eq(1) input[name='responseTime']")
-
 
464
									.data('daterangepicker').startDate
-
 
465
									.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);// get
-
 
466
								// current
-
 
467
								// row 2nd TD
-
 
468
								var col3 = currentRow
-
 
469
									.find(
-
 
470
										"td:eq(2) input[name='procuredDate']")
-
 
471
									.data('daterangepicker').startDate
-
 
472
									.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
-
 
473
								// get current
-
 
474
								// row 3rd TD
-
 
475
 
-
 
476
								itemIds = {
-
 
477
									"itemId": col1,
-
 
478
									"responseTime": col2,
-
 
479
									"procuredTime": col3
-
 
480
 
-
 
481
								}
-
 
482
								ItemIdsJson.push(itemIds);
-
 
483
							}
-
 
484
 
-
 
485
						});
-
 
486
 
-
 
487
				$('#notify-order-table').find('tr').each(
-
 
488
					function() {
-
 
489
						var row = $(this);
-
 
490
 
-
 
491
						console.log(row);
-
 
492
						if (row.find('input[name="partnerCheck"]')
-
 
493
							.is(':checked')) {
-
 
494
							var currentRow = $(this).closest("tr");
-
 
495
 
-
 
496
							var col5 = currentRow.find("td:eq(2)")
-
 
497
								.html();
-
 
498
							var col6 = currentRow.find("td:eq(1)")
-
 
499
								.html();
-
 
500
 
-
 
501
							orderIds = {
-
 
502
								"orderId": col5,
-
 
503
								"olditemId": col6
-
 
504
							}
-
 
505
							orderIdsJSon.push(orderIds)
366
						}
506
						}
-
 
507
					});
-
 
508
 
-
 
509
				jsonObject['itemIds'] = ItemIdsJson;
-
 
510
				jsonObject['orderIds'] = orderIdsJSon;
-
 
511
				jsonObject['message'] = message;
-
 
512
 
-
 
513
				console.log(jsonObject)
367
 
514
 
368
						$('#notify-table')
-
 
369
								.find('tr')
-
 
370
								.each(
-
 
371
										function() {
-
 
372
											var row = $(this);
-
 
373
 
-
 
374
											console.log(row);
-
 
375
											if (row.find(
-
 
376
													'input[name="itemCheck"]')
-
 
377
													.is(':checked')) {
-
 
378
												var currentRow = $(this)
-
 
379
														.closest("tr");
-
 
380
 
-
 
381
												var col1 = currentRow
-
 
382
														.find(
-
 
383
																"td:eq(0) input[type='checkbox']")
-
 
384
														.val(); // get current
-
 
385
												// row 1st TD
-
 
386
												// value
-
 
387
												var col2 = currentRow
-
 
388
														.find(
-
 
389
																"td:eq(1) input[name='responseTime']")
-
 
390
														.data('daterangepicker').startDate
-
 
391
														.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);// get
-
 
392
												// current
-
 
393
												// row 2nd TD
-
 
394
												var col3 = currentRow
-
 
395
														.find(
-
 
396
																"td:eq(2) input[name='procuredDate']")
-
 
397
														.data('daterangepicker').startDate
-
 
398
														.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
-
 
399
												// get current
-
 
400
												// row 3rd TD
-
 
401
 
-
 
402
												itemIds = {
-
 
403
													"itemId" : col1,
-
 
404
													"responseTime" : col2,
-
 
405
													"procuredTime" : col3
-
 
406
 
-
 
407
												}
-
 
408
												ItemIdsJson.push(itemIds);
-
 
409
											}
-
 
410
 
-
 
411
										});
-
 
412
 
-
 
413
						$('#notify-order-table').find('tr').each(
-
 
414
								function() {
-
 
415
									var row = $(this);
-
 
416
 
-
 
417
									console.log(row);
-
 
418
									if (row.find('input[name="partnerCheck"]')
-
 
419
											.is(':checked')) {
-
 
420
										var currentRow = $(this).closest("tr");
-
 
421
 
-
 
422
										var col5 = currentRow.find("td:eq(2)")
-
 
423
												.html();
-
 
424
										var col6 = currentRow.find("td:eq(1)")
-
 
425
												.html();
-
 
426
 
-
 
427
										orderIds = {
-
 
428
											"orderId" : col5,
-
 
429
											"olditemId" : col6
-
 
430
										}
-
 
431
										orderIdsJSon.push(orderIds)
-
 
432
									}
-
 
433
								});
-
 
434
 
-
 
435
						jsonObject['itemIds'] = ItemIdsJson;
-
 
436
						jsonObject['orderIds'] = orderIdsJSon;
-
 
437
						jsonObject['message'] = message;
-
 
438
 
-
 
439
						console.log(jsonObject)
-
 
440
 
-
 
441
						if (confirm("Are you sure you want to notify the order") == true) {
515
				if (confirm("Are you sure you want to notify the order") == true) {
442
 
516
 
443
							doPostAjaxRequestWithJsonHandler(context
517
					doPostAjaxRequestWithJsonHandler(context
444
									+ "/notifyOrder", JSON
518
						+ "/notifyOrder", JSON
445
									.stringify(jsonObject), function(response) {
519
							.stringify(jsonObject), function(response) {
446
								if (response == 'true') {
520
								if (response == 'true') {
447
									alert("successfully notify");
521
									alert("successfully notify");
448
									$('#notifyOrder').modal('hide');
522
									$('#notifyOrder').modal('hide');
449
									$('.modal-backdrop').remove();
523
									$('.modal-backdrop').remove();
450
									loadOrder("main-content");
524
									loadOrder("main-content");
451
								}
525
								}
452
							});
526
							});
453
						}
527
				}
454
 
528
 
455
					});
529
			});
456
 
530
 
457
	$(".change-notify-request")
531
	$(".change-notify-request")
458
			.live(
532
		.live(
459
					"click",
533
			"click",
460
					function(e) {
534
			function(e) {
461
 
535
 
462
						var jsonObject = {};
536
				var jsonObject = {};
463
						var orderIdsJSon = [];
537
				var orderIdsJSon = [];
464
						var orderIds;
538
				var orderIds;
465
 
539
 
466
						$('#notify-cancel-order-list-table').find('tr').each(
540
				$('#notify-cancel-order-list-table').find('tr').each(
467
								function() {
541
					function() {
468
									var row = $(this);
542
						var row = $(this);
469
 
543
 
470
									console.log(row);
544
						console.log(row);
471
									if (row.find(
545
						if (row.find(
472
											'input[name="cancelOrderCheck"]')
546
							'input[name="cancelOrderCheck"]')
473
											.is(':checked')) {
547
							.is(':checked')) {
474
										var currentRow = $(this).closest("tr");
548
							var currentRow = $(this).closest("tr");
475
										var col5 = currentRow.find("td:eq(1)")
549
							var col5 = currentRow.find("td:eq(1)")
476
												.html();
550
								.html();
477
										var col6 = currentRow.find("td:eq(2)")
551
							var col6 = currentRow.find("td:eq(2)")
478
												.html();
552
								.html();
479
 
553
 
480
										orderIds = {
554
							orderIds = {
481
											"orderId" : col6,
555
								"orderId": col6,
482
											"olditemId" : col5
556
								"olditemId": col5
483
										}
557
							}
484
										orderIdsJSon.push(orderIds)
558
							orderIdsJSon.push(orderIds)
485
									}
559
						}
486
								});
560
					});
487
						console.log(orderIdsJSon)
561
				console.log(orderIdsJSon)
488
						jsonObject['orderIds'] = orderIdsJSon;
562
				jsonObject['orderIds'] = orderIdsJSon;
489
						console.log(jsonObject)
563
				console.log(jsonObject)
490
						if (confirm("Are you sure you want to update notify order") == true) {
564
				if (confirm("Are you sure you want to update notify order") == true) {
491
 
565
 
492
							doPostAjaxRequestWithJsonHandler(context
566
					doPostAjaxRequestWithJsonHandler(context
493
									+ "/changeNotifyCancelRequest", JSON
567
						+ "/changeNotifyCancelRequest", JSON
494
									.stringify(jsonObject), function(response) {
568
							.stringify(jsonObject), function(response) {
495
								if (response == 'true') {
569
								if (response == 'true') {
496
									alert("successfully Update");
570
									alert("successfully Update");
497
									$('#notifyCancelOrderList').modal('hide');
571
									$('#notifyCancelOrderList').modal('hide');
498
									$('.modal-backdrop').remove();
572
									$('.modal-backdrop').remove();
499
									loadNotifyCancelOrder("main-content");
573
									loadNotifyCancelOrder("main-content");
500
								}
574
								}
501
							});
575
							});
502
						}
576
				}
503
					});
577
			});
504
 
578
 
505
});
579
});
506
 
580
 
507
function getItemColor(catalogId, itemId) {
581
function getItemColor(catalogId, itemId) {
508
	console.log(catalogId);
582
	console.log(catalogId);
509
 
583
 
510
	doGetAjaxRequestHandler(context + "/getNotifyItemColor?catalogItemId="
584
	doGetAjaxRequestHandler(context + "/getNotifyItemColor?catalogItemId="
511
			+ catalogId + "&itemId=" + itemId, function(response) {
585
		+ catalogId + "&itemId=" + itemId, function(response) {
512
		$('.notify-container .modal-content').html(response);
586
			$('.notify-container .modal-content').html(response);
513
		$('#textnotifymessage').hide();
587
			$('#textnotifymessage').hide();
514
	});
588
		});
515
}
589
}
516
 
590
 
517
function getItems(catalogItemId) {
591
function getItems(catalogItemId) {
518
	doGetAjaxRequestHandler(context + "/getItems?catalogItemId="
592
	doGetAjaxRequestHandler(context + "/getItems?catalogItemId="
519
			+ catalogItemId, function(response) {
593
		+ catalogItemId, function(response) {
520
		$('.notify-cancel-order-container .modal-content').html(response);
594
			$('.notify-cancel-order-container .modal-content').html(response);
521
 
595
 
522
	});
596
		});
523
}
597
}
524
 
598
 
525
function loadGoodInventory(domId, search_text) {
599
function loadGoodInventory(domId, search_text) {
526
	doGetAjaxRequestHandler(context
600
	doGetAjaxRequestHandler(context
527
			+ "/getCurrentInventorySnapshot?searchTerm=" + search_text,
601
		+ "/getCurrentInventorySnapshot?searchTerm=" + search_text,
528
			function(response) {
602
		function(response) {
529
				$('#' + domId).html(response);
603
			$('#' + domId).html(response);
530
			});
604
		});
531
}
605
}
532
 
606
 
533
function loadCatalog(domId, search_text) {
607
function loadCatalog(domId, search_text) {
534
	doGetAjaxRequestHandler(context + "/getCatalog?searchTerm=" + search_text,
608
	doGetAjaxRequestHandler(context + "/getCatalog?searchTerm=" + search_text,
535
			function(response) {
609
		function(response) {
-
 
610
			$('#' + domId).html(response);
-
 
611
		});
-
 
612
 
-
 
613
}
-
 
614
 
-
 
615
function loadSimilarCatalog(domId, catalogItemId) {
-
 
616
	console.log(currentItem);
-
 
617
	var searchText = $("#catalog-search-text-compare").val();
-
 
618
	console.log(searchText)
-
 
619
	doGetAjaxRequestHandler(context + "/getCatalog?itemId=" + currentItem.itemId,
-
 
620
		function(response) {
536
				$('#' + domId).html(response);
621
			$('#' + domId).html(response);
-
 
622
 
-
 
623
			$("#catalog-search-text-compare").val(currentItem.itemDescription)
537
			});
624
		});
538
 
625
 
539
}
626
}
540
 
627
 
-
 
628
 
541
function loadOrder(domId) {
629
 function loadOrder(domId) {
542
	doGetAjaxRequestHandler(context + "/getInProcessOrder", function(response) {
630
	doGetAjaxRequestHandler(context + "/getInProcessOrder", function(response) {
543
		$('#' + domId).html(response);
631
		$('#' + domId).html(response);
544
	});
632
	});
545
 
633
 
546
}
634
}
Line 559... Line 647...
559
 
647
 
560
}
648
}
561
 
649
 
562
function getInventoryItemAgingByInterval(domId, searchContent) {
650
function getInventoryItemAgingByInterval(domId, searchContent) {
563
	doPostAjaxRequestWithJsonHandler(
651
	doPostAjaxRequestWithJsonHandler(
564
			context + "/getInventoryItemAgingByInterval?searchContent="
652
		context + "/getInventoryItemAgingByInterval?searchContent="
565
					+ searchContent, JSON.stringify([ 5, 15, 30, 45 ]),
653
		+ searchContent, JSON.stringify([5, 15, 30, 45]),
566
			function(response) {
654
		function(response) {
567
				$('#' + domId).html(response);
655
			$('#' + domId).html(response);
568
			});
656
		});
569
}
657
}
570
 
658
 
571
function downloadAgingReport() {
659
function downloadAgingReport() {
572
	data = JSON.stringify([ 5, 15, 30, 45 ]), doAjaxPostDownload(context
660
	data = JSON.stringify([5, 15, 30, 45]), doAjaxPostDownload(context
573
			+ "/downloadInventoryItemAgingByInterval", data,
661
		+ "/downloadInventoryItemAgingByInterval", data,
574
			"InventoryItemAging.xlsx");
662
		"InventoryItemAging.xlsx");
575
 
663
 
576
}
664
}
577
 
665
 
578
function downloadReports() {
666
function downloadReports() {
579
	doGetAjaxRequestHandler(context + "/reports", function(response) {
667
	doGetAjaxRequestHandler(context + "/reports", function(response) {
Line 583... Line 671...
583
 
671
 
584
function downloadItemLedgerReport() {
672
function downloadItemLedgerReport() {
585
	console.log("downloadItemLedgerReport Button clicked")
673
	console.log("downloadItemLedgerReport Button clicked")
586
	var dateWise = $("#dateWise").get(0).checked;
674
	var dateWise = $("#dateWise").get(0).checked;
587
	doAjaxGetDownload(context + "/itemLedger/complete/download?startDateTime="
675
	doAjaxGetDownload(context + "/itemLedger/complete/download?startDateTime="
588
			+ startDate + "&endDateTime=" + endDate + "&dateWise=" + dateWise,
676
		+ startDate + "&endDateTime=" + endDate + "&dateWise=" + dateWise,
589
			"ItemCompleteLedegerReport.xlsx");
677
		"ItemCompleteLedegerReport.xlsx");
590
}
678
}
591
 
679
 
592
function getItemAgingNextPreviousItems(offset, searchContent) {
680
function getItemAgingNextPreviousItems(offset, searchContent) {
593
	console.log("getItemAgingNextPreviousItems() called");
681
	console.log("getItemAgingNextPreviousItems() called");
594
	doPostAjaxRequestWithJsonHandler(context
682
	doPostAjaxRequestWithJsonHandler(context
595
			+ "/getInventoryItemAgingByInterval?offset=" + offset
683
		+ "/getInventoryItemAgingByInterval?offset=" + offset
596
			+ "&searchContent=" + searchContent, JSON
684
		+ "&searchContent=" + searchContent, JSON
597
			.stringify([ 5, 15, 30, 45 ]), function(response) {
685
			.stringify([5, 15, 30, 45]), function(response) {
598
		$('#main-content').html(response);
686
				$('#main-content').html(response);
599
	});
687
			});
600
 
688
 
601
}
689
}
602
 
690
 
603
function loadBadInventory(domId, search_text) {
691
function loadBadInventory(domId, search_text) {
604
	doGetAjaxRequestHandler(context + "/getBadInventorySnapshot?searchTerm="
692
	doGetAjaxRequestHandler(context + "/getBadInventorySnapshot?searchTerm="
605
			+ search_text, function(response) {
693
		+ search_text, function(response) {
606
		$('#' + domId).html(response);
694
			$('#' + domId).html(response);
607
	});
695
		});
608
}
696
}
609
 
697
 
610
function loadGoodInventorySearchInfo(search_text) {
698
function loadGoodInventorySearchInfo(search_text) {
611
	loadGoodInventory("main-content", search_text);
699
	loadGoodInventory("main-content", search_text);
612
}
700
}
Line 615... Line 703...
615
	loadCatalog("main-content", search_text);
703
	loadCatalog("main-content", search_text);
616
}
704
}
617
 
705
 
618
function loadItemLedgerReportDownloadPage(domId) {
706
function loadItemLedgerReportDownloadPage(domId) {
619
	doGetAjaxRequestHandler(context + "/itemLedger/downloadPage", function(
707
	doGetAjaxRequestHandler(context + "/itemLedger/downloadPage", function(
620
			response) {
708
		response) {
621
		$('#' + domId).html(response);
709
		$('#' + domId).html(response);
622
	});
710
	});
623
}
711
}
624
function myFunction() {
712
function myFunction() {
625
	var val = $("#selectreason").val();
713
	var val = $("#selectreason").val();
Line 664... Line 752...
664
	console.log(jsonObject)
752
	console.log(jsonObject)
665
 
753
 
666
	if (confirm("Are you sure you want to cancel the order") == true) {
754
	if (confirm("Are you sure you want to cancel the order") == true) {
667
 
755
 
668
		doPostAjaxRequestWithJsonHandler(context + "/cancelOrder", JSON
756
		doPostAjaxRequestWithJsonHandler(context + "/cancelOrder", JSON
669
				.stringify(jsonObject), function(response) {
757
			.stringify(jsonObject), function(response) {
670
			if (response == 'true') {
758
				if (response == 'true') {
671
				alert("successfully cancel");
759
					alert("successfully cancel");
672
				$('#cancelOrder').modal('hide');
760
					$('#cancelOrder').modal('hide');
673
				$('.modal-backdrop').remove();
761
					$('.modal-backdrop').remove();
674
				loadOrder("main-content");
762
					loadOrder("main-content");
675
			}
763
				}
676
		});
764
			});
677
	}
765
	}
678
 
766
 
679
}
767
}
680
 
768
 
681
function loadNotifyCancelOrder(domId) {
769
function loadNotifyCancelOrder(domId) {
682
	doGetAjaxRequestHandler(context + "/getNotifiedCancelOrder", function(
770
	doGetAjaxRequestHandler(context + "/getNotifiedCancelOrder", function(
683
			response) {
771
		response) {
684
		$('#' + domId).html(response);
772
		$('#' + domId).html(response);
685
	});
773
	});
686
}
774
}
687
 
775
 
688
function getNotifyCancelItems(itemId, OrderId) {
776
function getNotifyCancelItems(itemId, OrderId) {
689
	doGetAjaxRequestHandler(context + "/getNotifyItems?itemId=" + itemId,
777
	doGetAjaxRequestHandler(context + "/getNotifyItems?itemId=" + itemId,
690
			function(response) {
778
		function(response) {
691
				$('.notify-cancel-order-Items-container .modal-content').html(
779
			$('.notify-cancel-order-Items-container .modal-content').html(
692
						response);
780
				response);
693
 
781
 
694
			});
782
		});
695
}
783
}
696
 
784
 
697
function loadInvoice(serialNumber) {
785
function loadInvoice(serialNumber) {
698
	let url = `${context}/view-invoices`;
786
	let url = `${context}/view-invoices`;
699
	if(typeof serialNumber != "undefined") {
787
	if (typeof serialNumber != "undefined") {
700
		url = `${url}?serialNumber=${serialNumber}`;
788
		url = `${url}?serialNumber=${serialNumber}`;
701
		doAjaxGetDownload(url, `invoice-${serialNumber}.pdf`) 
789
		doAjaxGetDownload(url, `invoice-${serialNumber}.pdf`)
702
	} else {
790
	} else {
703
		doGetAjaxRequestHandler(url, function(response) {
791
		doGetAjaxRequestHandler(url, function(response) {
704
			$('#main-content').html(response);
792
			$('#main-content').html(response);
705
		});
793
		});
706
	}
794
	}