Subversion Repositories SmartDukaan

Rev

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

Rev 24950 Rev 25066
Line 14... Line 14...
14
	});
14
	});
15
 
15
 
16
	$(".keep-a-tab").live('click', function() {
16
	$(".keep-a-tab").live('click', function() {
17
		loadtabOrder("main-content");
17
		loadtabOrder("main-content");
18
	});
18
	});
19
	
19
 
20
	$(".notify_order").live('click', function() {
20
	$(".notify_order").live('click', function() {
21
		loadnotifyOrder("main-content");
21
		loadnotifyOrder("main-content");
22
	});
22
	});
23
	
23
 
24
	$(".item_aging").live('click', function() {
24
	$(".item_aging").live('click', function() {
25
		getInventoryItemAgingByInterval("main-content", "");
25
		getInventoryItemAgingByInterval("main-content", "");
26
	});
26
	});
27
 
27
 
28
	$("#item-aging-search-button").live('click', function() {
28
	$("#item-aging-search-button").live('click', function() {
Line 162... Line 162...
162
 
162
 
163
	$(".cancellation").live("click", function(e) {
163
	$(".cancellation").live("click", function(e) {
164
		orderid = $(this).data('orderid');
164
		orderid = $(this).data('orderid');
165
		cancelOrder(orderid, "CANCELLED_DUE_TO_LOW_INVENTORY")
165
		cancelOrder(orderid, "CANCELLED_DUE_TO_LOW_INVENTORY")
166
	});
166
	});
167
	
167
 
168
	$(".order-request-submit").live("click", function(e) {
168
	$(".order-request-submit").live("click", function(e) {
169
		requestcancelOrder();
169
		requestcancelOrder();
170
	});
170
	});
171
	$(".keepatab").live("click", function(e) {
171
	$(".keepatab").live("click", function(e) {
172
		orderid = $(this).data('orderid');
172
		orderid = $(this).data('orderid');
173
		cancelOrder(orderid, "KEEP_A_TAB")
173
		cancelOrder(orderid, "KEEP_A_TAB")
174
 
174
 
175
	});
175
	});
176
	
176
 
177
	 
-
 
178
	  $(".request-cancel").live('click',
177
	$(".request-cancel").live('click', function() {
179
			     function(){
-
 
180
		 
178
 
181
				   
-
 
182
				 });
179
	});
183
	
180
 
184
	$(".mk_button").on("click", function(){
181
	$(".mk_button").on("click", function() {
185
		 
182
 
186
		});
183
	});
187
 
184
 
188
	$(".closeOrder")
185
	$(".closeOrder")
189
			.live(
186
			.live(
190
					"click",
187
					"click",
191
					function(e) {
188
					function(e) {
Line 201... Line 198...
201
										}
198
										}
202
									});
199
									});
203
						}
200
						}
204
 
201
 
205
					});
202
					});
-
 
203
	$('#notify-table').find(':checkbox').live('change', function(e) {
-
 
204
		var colormessage = [];
-
 
205
		$("#notify-table input[type=checkbox]:checked").each(function() {
-
 
206
 
-
 
207
			var row = $(this).closest("tr")[0];
-
 
208
			colormessage.push(row.cells[0].innerText);
-
 
209
 
-
 
210
			console.log(colormessage)
-
 
211
		});
-
 
212
 
-
 
213
		$("#colorValue").text(colormessage);
-
 
214
	});
-
 
215
 
-
 
216
	$('#overridemessage').live('change', function() {
-
 
217
		if ($(this).is(':checked')) {
-
 
218
			$('#textnotifymessage').show();
-
 
219
			$('#textnotifymessage').focus();
-
 
220
		} else {
-
 
221
			$('#textnotifymessage').hide();
-
 
222
		}
-
 
223
	});
206
 
224
 
207
	$(".notify-submit")
225
	$(".notify-submit")
208
			.live(
226
			.live(
209
					"click",
227
					"click",
210
					function(e) {
228
					function(e) {
Line 212... Line 230...
212
						var jsonObject = {};
230
						var jsonObject = {};
213
						var orderIdsJSon = [];
231
						var orderIdsJSon = [];
214
						var ItemIdsJson = [];
232
						var ItemIdsJson = [];
215
						var itemIds;
233
						var itemIds;
216
						var orderIds;
234
						var orderIds;
-
 
235
						var message;
217
 
236
 
-
 
237
						if ($('#overridemessage').is(':checked')) {
-
 
238
							message = $('#textnotifymessage').val();
-
 
239
						} else {
-
 
240
							message = $('#notifymessage').text();
-
 
241
						}
-
 
242
 
-
 
243
						console.log(message);
218
						var itemchecked = $("input[name='itemCheck']:checked").length;
244
						var itemchecked = $("input[name='itemCheck']:checked").length;
219
 
245
 
220
						if (!itemchecked) {
246
						if (!itemchecked) {
221
							alert("You must check at least one item.");
247
							alert("You must check at least one item.");
222
							return false;
248
							return false;
Line 225... Line 251...
225
 
251
 
226
						if (!partnerchecked) {
252
						if (!partnerchecked) {
227
							alert("You must check at least one partner.");
253
							alert("You must check at least one partner.");
228
							return false;
254
							return false;
229
						}
255
						}
-
 
256
						
-
 
257
						if(message === ""){
-
 
258
							alert("message is required");
-
 
259
							return false;
-
 
260
						}
-
 
261
						
230
 
262
 
231
						$('#notify-table')
263
						$('#notify-table')
232
								.find('tr')
264
								.find('tr')
233
								.each(
265
								.each(
234
										function() {
266
										function() {
Line 295... Line 327...
295
									}
327
									}
296
								});
328
								});
297
 
329
 
298
						jsonObject['itemIds'] = ItemIdsJson;
330
						jsonObject['itemIds'] = ItemIdsJson;
299
						jsonObject['orderIds'] = orderIdsJSon;
331
						jsonObject['orderIds'] = orderIdsJSon;
-
 
332
						jsonObject['message'] = message;
300
 
333
 
301
						console.log(jsonObject)
334
						console.log(jsonObject)
302
 
335
 
303
						if (confirm("Are you sure you want to notify the order") == true) {
336
						if (confirm("Are you sure you want to notify the order") == true) {
304
 
337
 
Line 320... Line 353...
320
	console.log(catalogId);
353
	console.log(catalogId);
321
 
354
 
322
	doGetAjaxRequestHandler(context + "/getNotifyItemColor?catalogItemId="
355
	doGetAjaxRequestHandler(context + "/getNotifyItemColor?catalogItemId="
323
			+ catalogId + "&itemId=" + itemId, function(response) {
356
			+ catalogId + "&itemId=" + itemId, function(response) {
324
		$('.notify-container .modal-content').html(response);
357
		$('.notify-container .modal-content').html(response);
-
 
358
		$('#textnotifymessage').hide();
325
	});
359
	});
326
}
360
}
327
 
361
 
328
function loadGoodInventory(domId, search_text) {
362
function loadGoodInventory(domId, search_text) {
329
	doGetAjaxRequestHandler(context
363
	doGetAjaxRequestHandler(context
Line 353... Line 387...
353
		$('#' + domId).html(response);
387
		$('#' + domId).html(response);
354
	});
388
	});
355
 
389
 
356
}
390
}
357
 
391
 
358
function loadnotifyOrder(domId){
392
function loadnotifyOrder(domId) {
359
	doGetAjaxRequestHandler(context + "/getAllNotifyOrder", function(response) {
393
	doGetAjaxRequestHandler(context + "/getAllNotifyOrder", function(response) {
360
		$('#' + domId).html(response);
394
		$('#' + domId).html(response);
361
	});
395
	});
362
 
396
 
363
}
397
}
364
 
398
 
365
 
-
 
366
 
-
 
367
function getInventoryItemAgingByInterval(domId, searchContent) {
399
function getInventoryItemAgingByInterval(domId, searchContent) {
368
	doPostAjaxRequestWithJsonHandler(
400
	doPostAjaxRequestWithJsonHandler(
369
			context + "/getInventoryItemAgingByInterval?searchContent="
401
			context + "/getInventoryItemAgingByInterval?searchContent="
370
					+ searchContent, JSON.stringify([ 5, 15, 30, 45 ]),
402
					+ searchContent, JSON.stringify([ 5, 15, 30, 45 ]),
371
			function(response) {
403
			function(response) {
Line 426... Line 458...
426
		$('#' + domId).html(response);
458
		$('#' + domId).html(response);
427
	});
459
	});
428
}
460
}
429
 
461
 
430
function cancelOrder(orderId, status) {
462
function cancelOrder(orderId, status) {
431
	
463
 
432
	cancelOrderId=orderId;
464
	cancelOrderId = orderId;
433
	cancelSatus=status;
465
	cancelSatus = status;
434
	console.log(cancelOrderId)
466
	console.log(cancelOrderId)
435
	console.log(cancelSatus)
467
	console.log(cancelSatus)
436
	$('#orderCancelModal').modal('show');
468
	$('#orderCancelModal').modal('show');
437
	$("#textreason").hide();
469
	$("#textreason").hide();
438
}
470
}
439
 
471
 
440
function myFunction() {
472
function myFunction() {
441
     var val = $("#selectreason").val();
473
	var val = $("#selectreason").val();
442
	    console.log(val);
474
	console.log(val);
443
	 if(val=="other"){
475
	if (val == "other") {
444
	     $("#textreason").show();
476
		$("#textreason").show();
445
	 } else {
477
	} else {
446
	     $("#textreason").hide();
478
		$("#textreason").hide();
447
	 }
-
 
448
	
-
 
449
}
-
 
450
function requestcancelOrder(){
-
 
451
val=$('#selectreason').val();
-
 
452
 if(val=="other"){
-
 
453
	 reason = $('#textreason').val(); 
-
 
454
 }
-
 
455
 else{
-
 
456
reason = $('#textreason').val();
-
 
457
 }
-
 
458
console.log(reason);
-
 
459
console.log(selectreason);
-
 
460
console.log(cancelSatus);
-
 
461
console.log(cancelOrderId);
-
 
462
orderId = cancelOrderId;
-
 
463
status = cancelSatus;
-
 
464
if (reason == "" || reason == null
-
 
465
		|| reason == undefined) {
-
 
466
	alert("reason field can't be empty");
-
 
467
	return false;
-
 
468
}
-
 
469
 
-
 
470
doPostAjaxRequestHandler(context
-
 
471
		+ "/cancelOrder?orderId=" + orderId
-
 
472
		+ "&reason=" + reason + "&orderStatus="
-
 
473
		+ status, function(response) {
-
 
474
	if (response == 'true') {
-
 
475
		alert("successfully cancel");
-
 
476
 
-
 
477
		loadOrder("main-content");
-
 
478
	}
479
	}
479
});
480
 
480
}
481
}
-
 
482
function requestcancelOrder() {
-
 
483
	val = $('#selectreason').val();
-
 
484
	if (val == "other") {
-
 
485
		reason = $('#textreason').val();
-
 
486
	} else {
-
 
487
		reason = $('#textreason').val();
-
 
488
	}
-
 
489
	console.log(reason);
-
 
490
	console.log(selectreason);
-
 
491
	console.log(cancelSatus);
-
 
492
	console.log(cancelOrderId);
-
 
493
	orderId = cancelOrderId;
-
 
494
	status = cancelSatus;
-
 
495
	if (reason == "" || reason == null || reason == undefined) {
-
 
496
		alert("reason field can't be empty");
-
 
497
		return false;
-
 
498
	}
-
 
499
 
-
 
500
	doPostAjaxRequestHandler(context + "/cancelOrder?orderId=" + orderId
-
 
501
			+ "&reason=" + reason + "&orderStatus=" + status,
-
 
502
			function(response) {
-
 
503
				if (response == 'true') {
-
 
504
					alert("successfully cancel");
481
 
505
 
-
 
506
					loadOrder("main-content");
-
 
507
				}
-
 
508
			});
-
 
509
}