Subversion Repositories SmartDukaan

Rev

Rev 27754 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function() {
        $(document).on('click', ".product-detail", function() {
                loadItems("main-content");
        });
        $(document).on('click', ".product-info",
                        function() {
                                console.log(itemCatalogId);
                                doAjaxRequestHandler(context + "/getProductInfo?catalogId="
                                                + itemCatalogId, "GET", function(response) {
                                        $('.product-info-container').html(response);
                                        $("#compareItem").hide();
                                });
                        });

        $(document).on('click', ".compare-with", function() {
                $("#compareItem").show();
        });

        catalogIds = [1021975, 1022020];
        $(document).on('click', ".product-compare-info",function() {
                changedIndex = $(this).closest('th').index()-1;
                if(typeof compareCatalogId!="undefined") {
                        //always push to last
                        if(changedIndex==-2) {
                                catalogIds[2] = compareCatalogId;
                        } else {
                                catalogIds[changedIndex] = compareCatalogId;
                        }
                }
                doAjaxRequestHandler(`${context}/getProductCompareInfo?catalogIds=` + catalogIds.join(","), "GET", 
                function(response) {
                        console.log(response)
                        $('#' + "main-content").html(response);
                });
        });
        $(document).on('click', ".catalog_items",function() {
                doAjaxRequestHandler(`${context}/catalog-item`, "GET",function(response) {
                        $('#' + "main-content").html(response);
                });
        });
});

function loadItems(domId) {
        doAjaxRequestHandler(context + "/getProducts", "GET", function(response) {
                $('#' + domId).html(response);
        });
}