Subversion Repositories SmartDukaan

Rev

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

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

$(document).on('click', ".addSimilarModel", function () {
    let catalog_id = document.querySelector('select[name="catalogId"]').value;
    var selectElement = document.getElementById('contentModel');
    var selectedOptions = Array.from(selectElement.selectedOptions);
    var similarCatalogIds = selectedOptions.map(option => option.value);
    console.log('similarCatalogIds values:', similarCatalogIds);
    console.log("catalogId:", catalog_id);
    var data = {
        catalogId: catalog_id,
        similarCatalogIds: similarCatalogIds
    };
    if (confirm("Are you confirm to  add similar models")) {
        doPostAjaxRequestWithJsonHandler(`${context}/similar-model/create`, JSON.stringify(data), function (response) {
            reloadSimilarModel("main-content");
        });
    }

});

function reloadSimilarModel(domId) {
    doGetAjaxRequestHandler(`${context}/similar-model`,
        function (response) {
            $('#' + domId).html(response);
        });
}