Subversion Repositories SmartDukaan

Rev

View as "text/plain" | Blame | Last modification | View Log | RSS feed

$(function() {
        $(document).on('click', ".high_demand_item", function() {
                loadHighDemandOrder("main-content");
        });


        $(document).on('click', ".add-high-demand-item",
                function() {
                        var itemQty = $('#item-qty').val();
                        var catalogId = catalogItemId
                        if (confirm("Are you sure you want add qty!") == true) {
                                doPostAjaxRequestHandler(context + "/addHighDemandItem?catalogId="
                                        + catalogId + "&qty="
                                        + itemQty, function(response) {
                                                if (response == 'true') {
                                                        alert("successfully submit");

                                                        loadHighDemandOrder("main-content");
                                                }

                                                return false;
                                        });
                        }
                });

        $(document).on('click', ".remove-hdi-model",
                function() {
                        var id = $(this).data('requestid');
                        if (confirm("Are you sure you want to remove the Item") == true) {
                                console.log(id);
                                doDeleteAjaxRequestHandler(context
                                        + "/removeHighDemandItem?id=" + id,
                                        function(response) {
                                                if (response == 'true') {
                                                        alert("successfully Removed");
                                                        loadHighDemandOrder("main-content");
                                                }

                                        });
                        }

                });
})

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