<commit_before>var pathNameUrl = $(location).attr('pathname').split('/');

var settingStatusForButton = function(val) {
    var obj = (val === null) ? {
        name: 'Give the book',
        data_busy: false,
        disabled: true,
    } : {
        name: 'Pick up the book',
        data_busy: true,
        disabled: false,
    };
    $('.btnBookAction').text(obj.name).attr('data', obj.data_busy);
    $('#renewalOfBook').attr('disabled', obj.disabled);
};

var fillActionBook = function(data) {
    console.log(data.date);
    $('.nameOfDebtor').val(data.name);
    $('.phoneOfDebtor').val(data.phone);
    $('.emailOfDebtor').val(data.email);
    $('.termOfDebtor').val(data.term);
    $('.pawnOfDebtor').val(data.pawn);
    $('.dateOfDebtor').val((data.date === null) ?
        view.normalDateFormat(new Date()) :
        view.normalDateFormat(new Date(data.date)));
    settingStatusForButton(data.event);

};

doAjaxQuery('GET', '/admin/api/v1/books/' + pathNameUrl[3], null, function(res) {
    if (!res.success) {
        view.showError(res.msg);
        return;
    }
    view.fillBookInfo(res.data);
    fillActionBook(res.data);
});

$('.btnBookAction').click(function(event) {
    var status = $('.btnBookAction').attr('data');
    var data = {
        id: $('#bookID').attr('book-id')
    };
    if (status == 'true') {
        var isChecked = $('#renewalOfBook').prop('checked');
        var obj = (isChecked) ? {
            method: 'POST',
            url: '/admin/api/v1/books/' + data.id + '/renewal',
            func: function() {
                $('#renewalOfBook').prop('checked', false);
                view.disabledElement(false, '.nameOfDebtor', '.phoneOfDebtor', '.emailOfDebtor', '.pawnOfDebtor');
                settingStatusForButton(true);
                view.showSuccess('Человек стремится к знаниям! Ну разве это не прекрасно? ))');
            }
        } : {
            method: 'GET',
            url: '/admin/api/v1/books/' + data.id + '/take',<commit_msg>minor fix popups in admin books card<commit_after>var pathNameUrl = $(location).attr('pathname').split('/');

var settingStatusForButton = function(val) {
    var obj = (val === null) ? {
        name: 'Give the book',
        data_busy: false,
        disabled: true,
    } : {
        name: 'Pick up the book',
        data_busy: true,
        disabled: false,
    };
    $('.btnBookAction').text(obj.name).attr('data', obj.data_busy);
    $('#renewalOfBook').attr('disabled', obj.disabled);
};

var fillActionBook = function(data) {
    console.log(data.date);
    $('.nameOfDebtor').val(data.name);
    $('.phoneOfDebtor').val(data.phone);
    $('.emailOfDebtor').val(data.email);
    $('.termOfDebtor').val(data.term);
    $('.pawnOfDebtor').val(data.pawn);
    $('.dateOfDebtor').val((data.date === null) ?
        view.normalDateFormat(new Date()) :
        view.normalDateFormat(new Date(data.date)));
    settingStatusForButton(data.event);

};

doAjaxQuery('GET', '/admin/api/v1/books/' + pathNameUrl[3], null, function(res) {
    if (!res.success) {
        view.showError(res.msg);
        return;
    }
    view.fillBookInfo(res.data);
    fillActionBook(res.data);
});

$('.btnBookAction').click(function(event) {
    var status = $('.btnBookAction').attr('data');
    var data = {
        id: $('#bookID').attr('book-id')
    };
    if (status == 'true') {
        var isChecked = $('#renewalOfBook').prop('checked');
        var obj = (isChecked) ? {
            method: 'POST',
            url: '/admin/api/v1/books/' + data.id + '/renewal',
            func: function() {
                $('#renewalOfBook').prop('checked', false);
                view.disabledElement(false, '.nameOfDebtor', '.phoneOfDebtor', '.emailOfDebtor', '.pawnOfDebtor');
                settingStatusForButton(true);
                view.showSuccess('Человек стремится к знаниям!\nНу разве это не прекрасно? ))');
            }
        } : {
            method: 'GET',
            url: '/admin/api/v1/books/' + data.id + '/take',
{'fraction_non_alphanumeric': 0.1921929388363998, 'fraction_numerical': 0.001989060169070114, 'mean_word_length': 2.576, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1645711', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1310, 'n_words': 216}