$(function () {
    // Usuwanie.
    $('#delete_delete').change(function () {
        if (this.checked) {
            $('#AdminDeleteInput').removeAttr('disabled');
        } else {
            $('#AdminDeleteInput').attr('disabled', 'disabled');
        }
    });

    if ($('.select2').length > 0) {
        $('.select2').select2();
    }

    //wysyłanie formularza paginacji
    $('select[name=per_page]').change(function () {
        $(this).parent().submit();
    });

    var $fileCategoryList = $('#file-category-list');
    var $fileList = $('#file-list');

    if ($fileCategoryList.length > 0) {
        $fileCategoryList.dataTable({
            dom: '<f<t><"bottom"ilp>><"clear">',
            info: false,
            language: {
                url: language,
            },
            ordering: false,
            paging: false,
            searching: false
        });
    }

    if ($fileList.length > 0) {
        $fileList.dataTable({
            dom: '<f<t><"bottom"ilp>><"clear">',
            info: false,
            language: {
                url: language,
            },
            ordering: false,
            paging: false,
            searching: false
        });
    }
});
