$(function () {
    var $popupList = $('#popupList');
    var $datePicker = $('.datePicker');

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

    // Wysyłanie formularza paginacji (ile wyników na stronę).
    $('select[name=per_page]').change(function () {
        $(this).parent().submit();
    });

    if ($datePicker.length > 0) {
        $datePicker.datetimepicker({
            closeOnDateSelect: true,
            format: 'd-m-Y H:i',
            scrollInput: false,
            timepicker:true
        });
    }

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

