Subversion Repositories SmartDukaan

Rev

Rev 28142 | Rev 30252 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function () {
    $(document).on('click', ".price-circular", function () {
        loadPriceCircular("main-content");
    });

    $(document).on('click', ".partner-price-circular", function () {

        bootbox.confirm({
            message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>"
            ,
            buttons: {
                confirm: {
                    label: 'I agree',
                    className: 'btn-success'
                },
                cancel: {
                    label: 'I disagree',
                    className: 'btn-danger'
                }
            },
            callback: function (result) {
                if (result == true) {
                    loadPartnerPriceCircular("main-content");
                }
            }
        });

    });


    $(document).on('click', ".circular-request", function () {
        var brand = $(".criteria-item-brands").val();
        var partnerType = $("#partnerType").val();
        doGetAjaxRequestHandler(context + "/priceCircularByBrandAndPartnerType?brands=" + brand + "&partnerType=" +
            partnerType,
            function (response) {
                console.log(response)
                $('.circular-container').html(response);
            });
    });

    $(document).on('click', ".submit-circular-request", function () {
        let brand = $("#brands").val();
        let priceCircularUrl = `${context}/priceCircularByBrand?brand=${brand}`;
        if (typeof partnerId == "number") {
            priceCircularUrl = `${priceCircularUrl}&fofoId=${partnerId}`;
        }
        doGetAjaxRequestHandler(priceCircularUrl,
            function (response) {
                console.log(response)
                $('.price-circular-container').html(response);
            });
    });


});

function loadPriceCircular(domId) {
    doGetAjaxRequestHandler(context + "/priceCircular",
        function (response) {
            $('#' + domId).html(response);
        });
}

function loadPartnerPriceCircular(domId) {
    doGetAjaxRequestHandler(context + "/partnerPriceCircular",
        function (response) {
            $('#' + domId).html(response);
        });
}