Subversion Repositories SmartDukaan

Rev

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

Rev 27763 Rev 28109
Line 100... Line 100...
100
 
100
 
101
	$(document).on('click', ".review_order", function() {
101
	$(document).on('click', ".review_order", function() {
102
		loadOrder("main-content");
102
		loadOrder("main-content");
103
	});
103
	});
104
 
104
 
-
 
105
	$(document).on('click', ".payment-pending-order", function() {
-
 
106
		loadPaymentPendingOrder("main-content");
-
 
107
	});
-
 
108
 
105
	$(document).on('click', ".notify_cancel", function() {
109
	$(document).on('click', ".notify_cancel", function() {
106
		loadNotifyCancelOrder("main-content");
110
		loadNotifyCancelOrder("main-content");
107
	});
111
	});
108
 
112
 
109
	$(document).on('click', ".keep-a-tab", function() {
113
	$(document).on('click', ".keep-a-tab", function() {
Line 237... Line 241...
237
				'catalog-paginated', 'catalog-table', null);
241
				'catalog-paginated', 'catalog-table', null);
238
			$(this).blur();
242
			$(this).blur();
239
		});
243
		});
240
 
244
 
241
	$(document).on('click', "#catalog-paginated .previous", function() {
245
	$(document).on('click', "#catalog-paginated .previous", function() {
242
			var searchText = $("#catalog-search-text").val();
246
		var searchText = $("#catalog-search-text").val();
243
			if (typeof (searchText) == "undefined" || !searchText) {
247
		if (typeof (searchText) == "undefined" || !searchText) {
244
				searchText = "";
248
			searchText = "";
245
			}
249
		}
246
			var searchItem = $("#catalog-search-text-compare").val();
250
		var searchItem = $("#catalog-search-text-compare").val();
247
			console.log(searchItem)
251
		console.log(searchItem)
248
 
252
 
249
			var params = {};
253
		var params = {};
250
 
254
 
251
			if (searchItem) {
255
		if (searchItem) {
252
				params['itemId'] = currentItem.itemId;
256
			params['itemId'] = currentItem.itemId;
253
			}
257
		}
254
			console.log(brand);
258
		console.log(brand);
255
			if (brand != null) {
259
		if (brand != null) {
256
				params['brand'] = brand;
260
			params['brand'] = brand;
257
			}
261
		}
258
 
262
 
259
			if (accesories == true) {
263
		if (accesories == true) {
260
				params['accesories'] = accesories;
264
			params['accesories'] = accesories;
261
			}
265
		}
262
			params['searchTerm'] = searchText;
266
		params['searchTerm'] = searchText;
263
			console.log(params)
267
		console.log(params)
264
 
268
 
265
			loadPaginatedCatalogPreviousItem('/getPaginatedCatalog', params,
269
		loadPaginatedCatalogPreviousItem('/getPaginatedCatalog', params,
266
				'catalog-paginated', 'catalog-table', null);
270
			'catalog-paginated', 'catalog-table', null);
267
			$(this).blur();
271
		$(this).blur();
268
		});
272
	});
269
 
273
 
270
	$(document).on('click', "#catalog-search-button", function() {
274
	$(document).on('click', "#catalog-search-button", function() {
271
		var searchText = $("#catalog-search-text").val();
275
		var searchText = $("#catalog-search-text").val();
272
		if (typeof (searchText) == "undefined" || !searchText) {
276
		if (typeof (searchText) == "undefined" || !searchText) {
273
			searchText = "";
277
			searchText = "";
Line 311... Line 315...
311
	$(".mk_button").on("click", function() {
315
	$(".mk_button").on("click", function() {
312
 
316
 
313
	});
317
	});
314
 
318
 
315
	$(document).on("click", ".closeOrder",
319
	$(document).on("click", ".closeOrder",
316
			function(e) {
320
		function(e) {
317
				orderid = $(this).data('orderid');
321
			orderid = $(this).data('orderid');
318
				if (confirm("Are you sure you want to close the order") == true) {
322
			if (confirm("Are you sure you want to close the order") == true) {
319
 
-
 
320
					doPostAjaxRequestHandler(context
-
 
321
						+ "/closeOrder?orderId=" + orderd,
-
 
322
						function(response) {
-
 
323
							if (response == 'true') {
-
 
324
								alert("successfully close");
-
 
325
								loadtabOrder("main-content");
-
 
326
							}
-
 
327
						});
-
 
328
				}
-
 
329
 
323
 
-
 
324
				doPostAjaxRequestHandler(context
-
 
325
					+ "/closeOrder?orderId=" + orderd,
-
 
326
					function(response) {
-
 
327
						if (response == 'true') {
-
 
328
							alert("successfully close");
-
 
329
							loadtabOrder("main-content");
-
 
330
						}
-
 
331
					});
-
 
332
			}
-
 
333
 
330
			});
334
		});
331
	$(document).on('change', '#notify-table :checkbox', function(e) {
335
	$(document).on('change', '#notify-table :checkbox', function(e) {
332
		var colormessage = [];
336
		var colormessage = [];
333
		$("#notify-table input[type=checkbox]:checked").each(function() {
337
		$("#notify-table input[type=checkbox]:checked").each(function() {
334
 
338
 
335
			var row = $(this).closest("tr")[0];
339
			var row = $(this).closest("tr")[0];
Line 363... Line 367...
363
			$('#textnotifymessage').hide();
367
			$('#textnotifymessage').hide();
364
		}
368
		}
365
	});
369
	});
366
 
370
 
367
	$(document).on("click", ".notify-cancel-order-submit",
371
	$(document).on("click", ".notify-cancel-order-submit",
368
			function(e) {
372
		function(e) {
369
				var jsonObject = {};
373
			var jsonObject = {};
370
				var orderAndItemIdsJson = [];
374
			var orderAndItemIdsJson = [];
371
				var orderAndItemIds;
375
			var orderAndItemIds;
372
				var orderIds;
376
			var orderIds;
373
				var message;
377
			var message;
374
				message = $('#textNotifyCancellationMessage').val();
378
			message = $('#textNotifyCancellationMessage').val();
375
 
379
 
376
				var partnerchecked = $("input[name='partnerCancelOrderCheck']:checked").length;
380
			var partnerchecked = $("input[name='partnerCancelOrderCheck']:checked").length;
377
 
381
 
378
				if (!partnerchecked) {
382
			if (!partnerchecked) {
379
					alert("You must check at least one partner.");
383
				alert("You must check at least one partner.");
380
					return false;
-
 
381
				}
-
 
382
 
-
 
383
				if (message === "") {
-
 
384
					alert("message is required");
-
 
385
					return false;
384
				return false;
386
				}
385
			}
387
 
-
 
388
				$('#partner-cancel-order-table')
-
 
389
					.find('tr')
-
 
390
					.each(
-
 
391
						function() {
-
 
392
							var row = $(this);
-
 
393
 
386
 
394
							console.log(row);
-
 
395
							if (row
-
 
396
								.find(
-
 
397
									'input[name="partnerCancelOrderCheck"]')
-
 
398
								.is(':checked')) {
387
			if (message === "") {
399
								var currentRow = $(this)
388
				alert("message is required");
400
									.closest("tr");
389
				return false;
401
 
390
			}
402
								var col5 = currentRow.find(
-
 
403
									"td:eq(1)").html();
-
 
404
								var col6 = currentRow.find(
-
 
405
									"td:eq(2)").html();
-
 
406
 
391
 
407
								orderIds = {
-
 
408
									"orderId": col6,
392
			$('#partner-cancel-order-table')
409
									"olditemId": col5
393
				.find('tr')
410
								}
394
				.each(
411
								orderAndItemIdsJson
395
					function() {
412
									.push(orderIds)
396
						var row = $(this);
413
 
397
 
-
 
398
						console.log(row);
-
 
399
						if (row
-
 
400
							.find(
-
 
401
								'input[name="partnerCancelOrderCheck"]')
-
 
402
							.is(':checked')) {
-
 
403
							var currentRow = $(this)
-
 
404
								.closest("tr");
-
 
405
 
-
 
406
							var col5 = currentRow.find(
-
 
407
								"td:eq(1)").html();
-
 
408
							var col6 = currentRow.find(
-
 
409
								"td:eq(2)").html();
-
 
410
 
-
 
411
							orderIds = {
-
 
412
								"orderId": col6,
-
 
413
								"olditemId": col5
414
							}
414
							}
-
 
415
							orderAndItemIdsJson
-
 
416
								.push(orderIds)
415
 
417
 
416
						});
418
						}
417
 
419
 
418
				jsonObject['orderIds'] = orderAndItemIdsJson;
-
 
419
				jsonObject['message'] = message
-
 
420
				console.log(jsonObject)
-
 
421
 
-
 
422
				if (confirm("Are you sure you want to notify the order") == true) {
-
 
423
 
-
 
424
					doPostAjaxRequestWithJsonHandler(context
-
 
425
						+ "/notifyCancelOrder", JSON
-
 
426
							.stringify(jsonObject), function(response) {
-
 
427
								if (response == 'true') {
-
 
428
									alert("successfully notify");
-
 
429
									$('#notifyCancelOrder').modal('hide');
-
 
430
									$('.modal-backdrop').remove();
-
 
431
									loadOrder("main-content");
-
 
432
								}
-
 
433
							});
420
					});
434
				}
-
 
435
 
421
 
-
 
422
			jsonObject['orderIds'] = orderAndItemIdsJson;
-
 
423
			jsonObject['message'] = message
-
 
424
			console.log(jsonObject)
-
 
425
 
-
 
426
			if (confirm("Are you sure you want to notify the order") == true) {
-
 
427
 
-
 
428
				doPostAjaxRequestWithJsonHandler(context
-
 
429
					+ "/notifyCancelOrder", JSON
-
 
430
						.stringify(jsonObject), function(response) {
-
 
431
							if (response == 'true') {
-
 
432
								alert("successfully notify");
-
 
433
								$('#notifyCancelOrder').modal('hide');
-
 
434
								$('.modal-backdrop').remove();
-
 
435
								loadOrder("main-content");
-
 
436
							}
-
 
437
						});
-
 
438
			}
-
 
439
 
436
			});
440
		});
437
	$(document).on("click", ".notify-submit",
441
	$(document).on("click", ".notify-submit",
438
			function(e) {
442
		function(e) {
439
 
443
 
440
				var jsonObject = {};
444
			var jsonObject = {};
441
				var orderIdsJSon = [];
445
			var orderIdsJSon = [];
442
				var ItemIdsJson = [];
446
			var ItemIdsJson = [];
443
				var itemIds;
447
			var itemIds;
444
				var orderIds;
448
			var orderIds;
445
				var message;
449
			var message;
446
 
450
 
447
				if ($('#overridemessage').is(':checked')) {
451
			if ($('#overridemessage').is(':checked')) {
448
					message = $('#textnotifymessage').val();
452
				message = $('#textnotifymessage').val();
449
				} else {
453
			} else {
450
					message = $('#notifymsg').text();
454
				message = $('#notifymsg').text();
451
				}
-
 
452
 
-
 
453
				console.log(message);
-
 
454
				var itemchecked = $("input[name='itemCheck']:checked").length;
-
 
455
 
-
 
456
				if (!itemchecked) {
-
 
457
					alert("You must check at least one item.");
-
 
458
					return false;
-
 
459
				}
-
 
460
				var partnerchecked = $("input[name='partnerCheck']:checked").length;
-
 
461
 
-
 
462
				if (!partnerchecked) {
-
 
463
					alert("You must check at least one partner.");
-
 
464
					return false;
-
 
465
				}
-
 
466
 
-
 
467
				if (message === "") {
-
 
468
					alert("message is required");
-
 
469
					return false;
-
 
470
				}
455
			}
471
 
-
 
472
				$('#notify-table')
-
 
473
					.find('tr')
-
 
474
					.each(
-
 
475
						function() {
-
 
476
							var row = $(this);
-
 
477
 
-
 
478
							console.log(row);
-
 
479
							if (row.find(
-
 
480
								'input[name="itemCheck"]')
-
 
481
								.is(':checked')) {
-
 
482
								var currentRow = $(this)
-
 
483
									.closest("tr");
-
 
484
 
-
 
485
								var col1 = currentRow
-
 
486
									.find(
-
 
487
										"td:eq(0) input[type='checkbox']")
-
 
488
									.val(); // get current
-
 
489
								// row 1st TD
-
 
490
								// value
-
 
491
								var col2 = currentRow
-
 
492
									.find(
-
 
493
										"td:eq(1) input[name='responseTime']")
-
 
494
									.data('daterangepicker').startDate
-
 
495
									.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);// get
-
 
496
								// current
-
 
497
								// row 2nd TD
-
 
498
								var col3 = currentRow
-
 
499
									.find(
-
 
500
										"td:eq(2) input[name='procuredDate']")
-
 
501
									.data('daterangepicker').startDate
-
 
502
									.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
-
 
503
								// get current
-
 
504
								// row 3rd TD
-
 
505
 
-
 
506
								itemIds = {
-
 
507
									"itemId": col1,
-
 
508
									"responseTime": col2,
-
 
509
									"procuredTime": col3
-
 
510
 
456
 
511
								}
457
			console.log(message);
512
								ItemIdsJson.push(itemIds);
458
			var itemchecked = $("input[name='itemCheck']:checked").length;
513
							}
-
 
514
 
459
 
-
 
460
			if (!itemchecked) {
-
 
461
				alert("You must check at least one item.");
-
 
462
				return false;
515
						});
463
			}
-
 
464
			var partnerchecked = $("input[name='partnerCheck']:checked").length;
516
 
465
 
-
 
466
			if (!partnerchecked) {
-
 
467
				alert("You must check at least one partner.");
-
 
468
				return false;
-
 
469
			}
-
 
470
 
-
 
471
			if (message === "") {
-
 
472
				alert("message is required");
-
 
473
				return false;
-
 
474
			}
-
 
475
 
517
				$('#notify-order-table').find('tr').each(
476
			$('#notify-table')
-
 
477
				.find('tr')
-
 
478
				.each(
518
					function() {
479
					function() {
519
						var row = $(this);
480
						var row = $(this);
520
 
481
 
521
						console.log(row);
482
						console.log(row);
-
 
483
						if (row.find(
522
						if (row.find('input[name="partnerCheck"]')
484
							'input[name="itemCheck"]')
523
							.is(':checked')) {
485
							.is(':checked')) {
524
							var currentRow = $(this).closest("tr");
486
							var currentRow = $(this)
-
 
487
								.closest("tr");
525
 
488
 
526
							var col5 = currentRow.find("td:eq(2)")
489
							var col1 = currentRow
527
								.html();
490
								.find(
-
 
491
									"td:eq(0) input[type='checkbox']")
-
 
492
								.val(); // get current
-
 
493
							// row 1st TD
-
 
494
							// value
-
 
495
							var col2 = currentRow
-
 
496
								.find(
-
 
497
									"td:eq(1) input[name='responseTime']")
-
 
498
								.data('daterangepicker').startDate
-
 
499
								.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);// get
-
 
500
							// current
-
 
501
							// row 2nd TD
528
							var col6 = currentRow.find("td:eq(1)")
502
							var col3 = currentRow
529
								.html();
503
								.find(
-
 
504
									"td:eq(2) input[name='procuredDate']")
-
 
505
								.data('daterangepicker').startDate
-
 
506
								.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
-
 
507
							// get current
-
 
508
							// row 3rd TD
-
 
509
 
-
 
510
							itemIds = {
-
 
511
								"itemId": col1,
-
 
512
								"responseTime": col2,
-
 
513
								"procuredTime": col3
530
 
514
 
531
							orderIds = {
-
 
532
								"orderId": col5,
-
 
533
								"olditemId": col6
-
 
534
							}
515
							}
535
							orderIdsJSon.push(orderIds)
516
							ItemIdsJson.push(itemIds);
536
						}
517
						}
-
 
518
 
537
					});
519
					});
538
 
520
 
539
				jsonObject['itemIds'] = ItemIdsJson;
521
			$('#notify-order-table').find('tr').each(
540
				jsonObject['orderIds'] = orderIdsJSon;
522
				function() {
541
				jsonObject['message'] = message;
523
					var row = $(this);
542
 
524
 
543
				console.log(jsonObject)
525
					console.log(row);
544
 
-
 
545
				if (confirm("Are you sure you want to notify the order") == true) {
526
					if (row.find('input[name="partnerCheck"]')
-
 
527
						.is(':checked')) {
-
 
528
						var currentRow = $(this).closest("tr");
546
 
529
 
547
					doPostAjaxRequestWithJsonHandler(context
530
						var col5 = currentRow.find("td:eq(2)")
548
						+ "/notifyOrder", JSON
531
							.html();
549
							.stringify(jsonObject), function(response) {
532
						var col6 = currentRow.find("td:eq(1)")
550
								if (response == 'true') {
533
							.html();
-
 
534
 
551
									alert("successfully notify");
535
						orderIds = {
552
									$('#notifyOrder').modal('hide');
536
							"orderId": col5,
553
									$('.modal-backdrop').remove();
-
 
554
									loadOrder("main-content");
537
							"olditemId": col6
555
								}
538
						}
-
 
539
						orderIdsJSon.push(orderIds)
556
							});
540
					}
557
				}
541
				});
558
 
542
 
-
 
543
			jsonObject['itemIds'] = ItemIdsJson;
-
 
544
			jsonObject['orderIds'] = orderIdsJSon;
559
			});
545
			jsonObject['message'] = message;
560
 
546
 
561
	$(document).on("click", ".change-notify-request",
-
 
562
			function(e) {
547
			console.log(jsonObject)
563
 
548
 
564
				var jsonObject = {};
-
 
565
				var orderIdsJSon = [];
549
			if (confirm("Are you sure you want to notify the order") == true) {
566
				var orderIds;
-
 
567
 
550
 
568
				$('#notify-cancel-order-list-table').find('tr').each(
551
				doPostAjaxRequestWithJsonHandler(context
569
					function() {
552
					+ "/notifyOrder", JSON
-
 
553
						.stringify(jsonObject), function(response) {
570
						var row = $(this);
554
							if (response == 'true') {
-
 
555
								alert("successfully notify");
-
 
556
								$('#notifyOrder').modal('hide');
-
 
557
								$('.modal-backdrop').remove();
-
 
558
								loadOrder("main-content");
-
 
559
							}
-
 
560
						});
-
 
561
			}
571
 
562
 
572
						console.log(row);
-
 
573
						if (row.find(
-
 
574
							'input[name="cancelOrderCheck"]')
-
 
575
							.is(':checked')) {
-
 
576
							var currentRow = $(this).closest("tr");
-
 
577
							var col5 = currentRow.find("td:eq(1)")
-
 
578
								.html();
563
		});
579
							var col6 = currentRow.find("td:eq(2)")
-
 
580
								.html();
-
 
581
 
564
 
-
 
565
	$(document).on("click", ".change-notify-request",
-
 
566
		function(e) {
-
 
567
 
-
 
568
			var jsonObject = {};
-
 
569
			var orderIdsJSon = [];
582
							orderIds = {
570
			var orderIds;
-
 
571
 
-
 
572
			$('#notify-cancel-order-list-table').find('tr').each(
-
 
573
				function() {
-
 
574
					var row = $(this);
-
 
575
 
583
								"orderId": col6,
576
					console.log(row);
-
 
577
					if (row.find(
-
 
578
						'input[name="cancelOrderCheck"]')
584
								"olditemId": col5
579
						.is(':checked')) {
-
 
580
						var currentRow = $(this).closest("tr");
-
 
581
						var col5 = currentRow.find("td:eq(1)")
-
 
582
							.html();
-
 
583
						var col6 = currentRow.find("td:eq(2)")
585
							}
584
							.html();
-
 
585
 
-
 
586
						orderIds = {
586
							orderIdsJSon.push(orderIds)
587
							"orderId": col6,
-
 
588
							"olditemId": col5
587
						}
589
						}
-
 
590
						orderIdsJSon.push(orderIds)
-
 
591
					}
588
					});
592
				});
589
				console.log(orderIdsJSon)
593
			console.log(orderIdsJSon)
590
				jsonObject['orderIds'] = orderIdsJSon;
594
			jsonObject['orderIds'] = orderIdsJSon;
591
				console.log(jsonObject)
595
			console.log(jsonObject)
592
				if (confirm("Are you sure you want to update notify order") == true) {
596
			if (confirm("Are you sure you want to update notify order") == true) {
593
 
597
 
594
					doPostAjaxRequestWithJsonHandler(context
598
				doPostAjaxRequestWithJsonHandler(context
595
						+ "/changeNotifyCancelRequest", JSON
599
					+ "/changeNotifyCancelRequest", JSON
596
							.stringify(jsonObject), function(response) {
600
						.stringify(jsonObject), function(response) {
597
								if (response == 'true') {
601
							if (response == 'true') {
598
									alert("successfully Update");
602
								alert("successfully Update");
599
									$('#notifyCancelOrderList').modal('hide');
603
								$('#notifyCancelOrderList').modal('hide');
600
									$('.modal-backdrop').remove();
604
								$('.modal-backdrop').remove();
601
									loadNotifyCancelOrder("main-content");
605
								loadNotifyCancelOrder("main-content");
602
								}
606
							}
603
							});
607
						});
604
				}
608
			}
605
			});
609
		});
606
 
610
 
607
});
611
});
608
 
612
 
609
function getItemColor(catalogId, itemId) {
613
function getItemColor(catalogId, itemId) {
610
	console.log(catalogId);
614
	console.log(catalogId);
Line 659... Line 663...
659
		$('#' + domId).html(response);
663
		$('#' + domId).html(response);
660
	});
664
	});
661
 
665
 
662
}
666
}
663
 
667
 
-
 
668
function loadPaymentPendingOrder(domId) {
-
 
669
	doGetAjaxRequestHandler(context + "/getPaymentPendingOrder", function(response) {
-
 
670
		$('#' + domId).html(response);
-
 
671
	});
-
 
672
 
-
 
673
}
-
 
674
 
664
function loadtabOrder(domId) {
675
function loadtabOrder(domId) {
665
	doGetAjaxRequestHandler(context + "/getKeepInTabOrder", function(response) {
676
	doGetAjaxRequestHandler(context + "/getKeepInTabOrder", function(response) {
666
		$('#' + domId).html(response);
677
		$('#' + domId).html(response);
667
	});
678
	});
668
 
679