Subversion Repositories SmartDukaan

Rev

Rev 33443 | Blame | Compare with Previous | Last modification | View Log | RSS feed

$(function () {
    $(document).on('click', ".print-resource", function () {
        loadPrintResource("main-content");
    });

    $(document).on('click', ".print-resource-button-mk", function (event) {
        event.preventDefault();

        if (confirm("Are you sure?")) {

            let title = $("#title").val();
            let startDate = $("#startDate").val();
            let endDate = $("#endDate").val();
            let imgurl = $("#imgurl").val();
            let thumbnailurl = $("#thumbnailurl").val();
            let region = $("#region").val();

            let param = {
                title: title,
                startDate: startDate,
                endDate: endDate,
                imgUrl: imgurl,
                thumbnailUrl: thumbnailurl,
                region: region
            }

            console.log('param', param);

            doPostAjaxRequestWithJsonHandler(context + "/postPrintResource", JSON.stringify(param), function (response) {
                if (response == 'true') {
                    bootbox.alert("Print Resource Submit Successfully");
                    loadPrintResource("main-content");
                }

            });
        }
    });

    let dateChangePrintId = 0;
    $(document).on('click', ".change-end-date-btn", function () {
        dateChangePrintId = $(this).data('printid');
    });

    $(document).on('click', ".change-end-date-submit-mk", function () {
        let date = $('.change-date-input-mk').val();
        doPostAjaxRequestHandler(context + "/changeEndDate?date=" + date + "&resourceId=" + dateChangePrintId, function (response) {
            if (response == 'true') {
                alert("Date Change Successfully");
                loadAllPrintResource("main-content");
            }
        });
    });

    $(document).on('click', ".partner_print_resources", function () {

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

    $(document).on('click', ".all-print-resource", function () {

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

});

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

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


function loadPartnerPrintResource(domId) {
    doGetAjaxRequestHandler(context + "/partnerPrintResources", function (response) {
        $('#' + domId).html(response);

    });
}