Subversion Repositories SmartDukaan

Rev

Rev 27754 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
26493 tejbeer 1
$(function() {
27754 amit.gupta 2
	$(document).on('click', ".product-detail", function() {
26493 tejbeer 3
		loadItems("main-content");
4
	});
27755 amit.gupta 5
	$(document).on('click', ".product-info",
26493 tejbeer 6
			function() {
7
				console.log(itemCatalogId);
8
				doAjaxRequestHandler(context + "/getProductInfo?catalogId="
9
						+ itemCatalogId, "GET", function(response) {
10
					$('.product-info-container').html(response);
26512 amit.gupta 11
					$("#compareItem").hide();
26493 tejbeer 12
				});
13
			});
14
 
27754 amit.gupta 15
	$(document).on('click', ".compare-with", function() {
26512 amit.gupta 16
		$("#compareItem").show();
26493 tejbeer 17
	});
18
 
27047 amit.gupta 19
	catalogIds = [1021975, 1022020];
27754 amit.gupta 20
	$(document).on('click', ".product-compare-info",function() {
27047 amit.gupta 21
		changedIndex = $(this).closest('th').index()-1;
26744 amit.gupta 22
		if(typeof compareCatalogId!="undefined") {
27047 amit.gupta 23
			//always push to last
24
			if(changedIndex==-2) {
25
				catalogIds[2] = compareCatalogId;
26
			} else {
27
				catalogIds[changedIndex] = compareCatalogId;
28
			}
26744 amit.gupta 29
		}
30
		doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + catalogIds.join(","), "GET", 
31
		function(response) {
32
			console.log(response)
33
			$('#' + "main-content").html(response);
34
		});
35
	});
27754 amit.gupta 36
	$(document).on('click', ".catalog_items",function() {
27184 amit.gupta 37
		doAjaxRequestHandler(`${context}/catalog-item`, "GET",function(response) {
38
			$('#' + "main-content").html(response);
39
		});
40
	});
26493 tejbeer 41
});
42
 
43
function loadItems(domId) {
44
	doAjaxRequestHandler(context + "/getProducts", "GET", function(response) {
45
		$('#' + domId).html(response);
46
	});
47
}