Subversion Repositories SmartDukaan

Rev

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

Rev 27583 Rev 27596
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
	var brand = null;
-
 
15
	$('.cover').live('click', function() {
-
 
16
		console.log('hello');
14
 
17
 
-
 
18
		brand = $(this).data('stockbrand');
-
 
19
		console.log(brand);
-
 
20
		doGetAjaxRequestHandler(context + "/getCatalog?brand=" + brand,
-
 
21
			function(response) {
-
 
22
				$('#main-content').html(response);
-
 
23
			});
-
 
24
	});
15
 
25
 
16
	$('.add-compare-checkbox').live('change', function() {
26
	$('.add-compare-checkbox').live('change', function() {
17
  
27
 
18
		let catalogitemid = [$(this).data("catalogitemid")];
28
		let catalogitemid = [$(this).data("catalogitemid")];
19
		let  checked = $(this).is(':checked');
29
		let checked = $(this).is(':checked');
20
		console.log(checked);
30
		console.log(checked);
21
		$cbToModify = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
31
		$cbToModify = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
22
			return ($(this).data("catalogitemid") == catalogitemid && $(this).is(':checked') != checked);
32
			return ($(this).data("catalogitemid") == catalogitemid && $(this).is(':checked') != checked);
23
		});
33
		});
24
		
34
 
25
		let count=0;
35
		let count = 0;
26
		$cbToModify.prop("checked", checked).prop("disabled", checked);
36
		$cbToModify.prop("checked", checked).prop("disabled", checked);
27
		let cbToCondition = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
37
		let cbToCondition = $(this).closest('table').find('tr').find('input:checkbox').filter(function() {
28
			return ($(this).is(':checked') != checked);
38
			return ($(this).is(':checked') != checked);
29
		});
39
		});
30
		
40
 
31
		$('#add-to-compare-check').closest('table').find('tr').each(function() {
41
		$('#add-to-compare-check').closest('table').find('tr').each(function() {
32
 
42
 
33
			var row = $(this);
43
			var row = $(this);
34
 
44
 
35
			if (row.find('input[name="compare-check"]').is(':checked'))
45
			if (row.find('input[name="compare-check"]').is(':checked')) {
36
		    {
-
 
37
        	count++;
46
				count++;
38
        	
47
 
39
			}
48
			}
40
		});
49
		});
41
 
50
 
42
      console.log(count);
51
		console.log(count);
43
        $cbToModify.prop("checked", checked).prop("disabled", checked);
52
		$cbToModify.prop("checked", checked).prop("disabled", checked);
44
		 
53
 
45
	});
54
	});
46
 
55
 
47
	$("#Go-compare-button").live('click', function() {
56
	$("#Go-compare-button").live('click', function() {
48
 
57
 
49
		console.log('helo');
58
		console.log('helo');
50
		var gocatalogitemid = [];
59
		var gocatalogitemid = [];
51
 
60
 
52
		$('table').find('input[type="checkbox"]:enabled:checked').each(function(el){
61
		$('table').find('input[type="checkbox"]:enabled:checked').each(function(el) {
53
			gocatalogitemid.push($(this).data("catalogitemid"));
62
			gocatalogitemid.push($(this).data("catalogitemid"));
54
		});
63
		});
55
		console.log(gocatalogitemid);
64
		console.log(gocatalogitemid);
56
		if(gocatalogitemid.length <4 ){
65
		if (gocatalogitemid.length < 4) {
-
 
66
 
-
 
67
			doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + gocatalogitemid.join(","), "GET",
-
 
68
				function(response) {
-
 
69
					console.log(response)
-
 
70
					$('#' + "main-content").html(response);
-
 
71
				});
-
 
72
		}
57
 
73
 
58
		doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + gocatalogitemid.join(","), "GET", 
-
 
59
			function(response) {
-
 
60
				console.log(response)
-
 
61
			$('#' + "main-content").html(response);
-
 
62
			});
-
 
63
	}
-
 
64
	
-
 
65
	});
74
	});
66
 
75
 
67
 
76
 
68
	$(document).on('click', '#catalog-button', function() {
77
	$(document).on('click', '#catalog-button', function() {
69
 
78
 
Line 201... Line 210...
201
			var params = {};
210
			var params = {};
202
 
211
 
203
			if (searchItem) {
212
			if (searchItem) {
204
				params['itemId'] = currentItem.itemId;
213
				params['itemId'] = currentItem.itemId;
205
			}
214
			}
-
 
215
			console.log(brand);
-
 
216
			if(brand)
-
 
217
			{
-
 
218
			params['brand'] =brand;
-
 
219
			}
206
			params['searchTerm'] = searchText;
220
			params['searchTerm'] = searchText;
207
			loadPaginatedNextItems('/getPaginatedCatalog', params,
221
			loadPaginatedNextItems('/getPaginatedCatalog', params,
208
				'catalog-paginated', 'catalog-table', null);
222
				'catalog-paginated', 'catalog-table', null);
209
			$(this).blur();
223
			$(this).blur();
210
		});
224
		});
211
 
225
 
212
	$("#catalog-paginated .previous").live(
226
	$("#catalog-paginated .previous").live(
213
		'click',function() {
227
		'click', function() {
214
			var searchText = $("#catalog-search-text").val();
228
			var searchText = $("#catalog-search-text").val();
215
			if (typeof (searchText) == "undefined" || !searchText) {
229
			if (typeof (searchText) == "undefined" || !searchText) {
216
				searchText = "";
230
				searchText = "";
217
			}
231
			}
218
			var searchItem = $("#catalog-search-text-compare").val();
232
			var searchItem = $("#catalog-search-text-compare").val();
219
			console.log(searchItem)
233
			console.log(searchItem)
220
 
234
 
221
			var params = {};
235
			var params = {};
222
 
236
 
223
			if (searchItem)
237
			if (searchItem) {
224
		  {
-
 
225
				params['itemId'] = currentItem.itemId;
238
				params['itemId'] = currentItem.itemId;
226
		  }
239
			}
-
 
240
			console.log(brand);
-
 
241
			if(brand)
-
 
242
			{
-
 
243
			params['brand'] =brand;
-
 
244
			}
227
			params['searchTerm'] = searchText;
245
			params['searchTerm'] = searchText;
228
			loadPaginatedPreviousItems('/getPaginatedCatalog', params,
246
			loadPaginatedPreviousItems('/getPaginatedCatalog', params,
229
				'catalog-paginated', 'catalog-table', null);
247
				'catalog-paginated', 'catalog-table', null);
230
			$(this).blur();
248
			$(this).blur();
231
		});
249
		});
Line 624... Line 642...
624
		});
642
		});
625
 
643
 
626
}
644
}
627
 
645
 
628
 
646
 
629
 function loadOrder(domId) {
647
function loadOrder(domId) {
630
	doGetAjaxRequestHandler(context + "/getInProcessOrder", function(response) {
648
	doGetAjaxRequestHandler(context + "/getInProcessOrder", function(response) {
631
		$('#' + domId).html(response);
649
		$('#' + domId).html(response);
632
	});
650
	});
633
 
651
 
634
}
652
}