Subversion Repositories SmartDukaan

Rev

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

$(document).on('click', 'a.category-level', function(){
        var table = $('#ticket-category').DataTable();
        table.$('td').removeClass('highlight');
        let category = $(this).data("category");
        let level = $(this).data("level");
        doGetAjaxRequestHandler(context + "/admin/resources?ticketCategoryId=" + category + "&escalationType=" + level, function (response) {
                response = JSON.parse(response);
                $("#access-resource").find(":input").each(function (index, element) {
                        console.log($(element).data("menuid"));
                        element.checked = response.indexOf($(element).data("menuid")) > -1;
                });
        });
        $("#access-resource th").html("Resources for " + $(this).html());
        $(this).closest('td').addClass('highlight');
});
$(document).on('change', '#access-resource :checkbox', function(){
        var menuId = $(this).data("menuid");
        if($("#ticket-category td.highlight").length == 0) {
                bootbox.alert("Please choose Category!");
                return false;
        }
        var highlightedAnchor = $("#ticket-category td.highlight").find('a');
        var category = highlightedAnchor.data("category");
        var level = highlightedAnchor.data("level");
        doGetAjaxRequestHandler(context + "/admin/toggleResourcePermission?ticketCategoryId="+category+"&escalationType="+level+"&menuId=" + menuId, function(response) {
        });
});