Subversion Repositories SmartDukaan

Rev

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

$(function () {

    $(document).on('click', ".partner-credit-detail", function () {

        loadCreditDetail("main-content");
    });


    $(document).on('click', '.activate-partner-kred', function () {
        var row = $(this).closest("tr");
        var id = $(this).data('id');
        let gateway = $(row).find('select').val();
        if(typeof gateway==="undefined"){
            gateway = row.find('.mk_gateway').data("gateway");
        }
        console.log(id)
        if (confirm(`Are you sure you want to activate ${gateway}?`)) {
            doPostAjaxRequestHandler(`${context}/activateKred?id=${id}&gateway=${gateway}`,
                function (response) {
                    row.html(response);
                    alert(`${gateway} successfully activated`);


                });
        }
    });

    $(document).on('click', '.deactivate-partner-kred', function () {
        var row = $(this).closest("tr");
        var id = $(this).data('id');
        let gateway = $(row).find('select').val();
        if(typeof gateway==="undefined"){
            gateway="SDDIRECT";
        }
        if (confirm('Are you sure you want to deactivate?')) {
            doPostAjaxRequestHandler(context + "/deactivateKred?id=" + id,
                function (response) {
                    row.html(response);
                    alert(`${gateway} successfully deactivated`);
                });
        }
    });

});

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


}