<commit_before>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'common/admin/academic/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}
    <div class="flashmessage success_message full_width academic_removed_success hide">
        <div class="title">Success</div>
        <div class="content">
            <p>The academic was successfully removed!</p>
        </div>
    </div>
    <div class="flashmessage error_message full_width academic_removed_error hide">
        <div class="title">Error</div>
        <div class="content">
            <p>An error occurred while trying to delete the academic.</p>
        </div>
    </div>

    <div class="flashmessage success_message full_width academic_printed_success hide">
        <div class="title">Success</div>
        <div class="content">
            <p>The membership card was successfully printed!</p>
        </div>
    </div>
    <div class="flashmessage error_message full_width academic_printed_error hide">
        <div class="title">Error</div>
        <div class="content">
            <p>An error occurred while trying to print the membership card.</p>
        </div>
    </div>

    <div id="controller_action">
        <div id="student_search" style="display: none;">
            <div style="padding: 4px; text-align: right">
                Search:
                <select id="searchField">
                    <option value="username">Username</option>
                    <option value="name">Name</option>
                    <option value="university_identification">University Identification</option>
                </select>
                is
                <input type="text" id="searchString" size="30" />
            </div>

            <table class="full_width manage">
                <tr>
                    <th>Username</th>
                    <th>Identification</th>
                    <th width="200px">Name</th>
                    <th width="200px">E-mail</th>
                    <th width="70px">Action</th>
                </tr>
            </table>
        </div>

        <div id="default_page">
            <table class="full_width manage">
                <thead>
                    <tr>
                        <th>Username</th>
                        <th>Identification</th>
                        <th width="200px">Name</th>
                        <th width="200px">E-mail</th>
                        <th width="70px">Action</th>
                    </tr>
                </thead>

                <tbody>
                    {% for academic in paginator %}
                        <tr class="item item-{{ academic.getId() }}">
                            <td>{{ academic.getUsername() }}</td>
                            <td>{{ academic.getUniversityIdentification() }}
                            <td>{{ academic.getFullName() }}</td>
                            <td>{{ academic.getEmail() }}</td>
                            <td class="actions">
                                {% if hasAccess('common_admin_academic', 'print') %}
                                    <a href="#" class="print" data-id="{{ academic.getId() }}" data-fullname="{{ academic.getFullName() }}">Print</a></li>
                                {% endif %}
                                {% if hasAccess('common_admin_academic', 'edit') %}
                                    <a href="{{ url('common_admin_academic', {"action": "edit", "id": academic.getId()}) }}" class="edit">Edit</a></li>
                                {% endif %}
                                {% if hasAccess('common_admin_academic', 'delete') %}
                                    <a href="#" class="delete" data-id="{{ academic.getId() }}" data-fullname="{{ academic.getFullName() }}">Delete</a>
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>

            {% include 'admin/partials/paginationControl.twig' %}
        </div>
    </div>

    <div class="modal fade" id="removeAcademic" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span>Litus Admin</span>
                    /Delete Academic
                </div>
                <div class="modal-body">
                    <p>
                        You are about to delete the following student: <b class="fullname"></b>?
                        Please note that this operation cannot be undone!
                    </p>
                    <p>
                        Are you sure you want to continue?
                    </p>
                    <div class="footer">
                        <button class="delete">Yes</button>
                        <button class="cancel" data-dismiss="modal">No</button>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="modal fade" id="printAcademic" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span>Litus Admin</span>
                    /Print Academic
                </div>
                <div class="modal-body">
                    <p>
                        You are about to print a membership card for the following student: <b class="fullname"></b>?
                        If you do so, please take back the old membership card and throw it in the trash!
                    </p>
                    <p>
                        Are you sure you want to continue?
                    </p>
                    <div class="footer">
                        <button class="print">Yes</button>
                        <button class="cancel" data-dismiss="modal">No</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            {% if hasAccess('common_admin_academic', 'search') %}
            $.searchDatabase({
                defaultPage: $('#default_page'),
                searchDiv: $('#student_search'),
                searchString: $('#searchString'),
                searchField: $('#searchField'),
                searchPage: '{{ url('common_admin_academic', {'action': 'manage'}) }}manage/',
                url: '{{ url('common_admin_academic', {'action': 'search'}) }}',
                display: function (data) {
                    $('#student_search table').find('tr.item').remove();
                    $(data).each(function () {
                        $('#student_search table').append(row = $('<tr>', {class: 'item item-' + this.id}));
                        row.append('<td>' + this.username + '</td>')
                            .append('<td>' + this.universityIdentification + '</td>')
                            .append('<td>' + this.fullName + '</td>')
                            .append('<td>' + this.email + '</td>')
                            .append(
                                $('<td>', {'class': 'actions'})
                                    .append('<a href="{{ url('common_admin_academic', {"action": "edit"}) }}' + this.id + '" class="edit">Edit</a>')
                                    .append(printButton = $('<a href="#" class="print">Print</a>'))
                                    .append(deleteButton = $('<a href="#" class="delete">Delete</a>'))
                                );
                            deleteButton.data({
                                id: this.id,
                                fullname: this.fullName
                            });
                            printButton.data({
                                id: this.id,
                                fullname: this.fullName
                            })
                    });
                    $('#student_search .delete').click(openDeleteModal);
                    $('#student_search .print').click(openPrintModal);
                    $('#student_search table').change();
                },
                clear: function () {
                    $('#student_search table').find('tr.item').remove();
                }
            });
            {% endif %}

            $('.item .delete').click(openDeleteModal);
            $('.item .print').click(openPrintModal);
        });

        function openDeleteModal(e) {
            var $this = $(this);
            e.preventDefault();
            var removeAcademic = $('#removeAcademic');
            removeAcademic.find('.fullname').html($(this).data('fullname'));
            removeAcademic.find('.cancel').one('click', function () {
                removeAcademic.modal('hide');
            });
            var id = $this.data('id');
            removeAcademic.find('.delete').unbind('click').click(function () {
                $.post('{{ url('common_admin_academic', {"action": "delete"})}}' + id, function (data) {
                    console.log(data);
                    if (data && 'success' == data.status) {
                        $('.flashmessage').addClass('hide');
                        $('.academic_removed_success').removeClass('hide');
                        $('.item-' + id).remove();
                        removeAcademic.modal('hide');
                    } else {
                        errorRemove();
                    }
                }, 'json').error(errorRemove);
            });
            removeAcademic.modal();
        }

        function openPrintModal(e) {
            var $this = $(this);
            e.preventDefault();
            var printAcademic = $('#printAcademic');
            printAcademic.find('.fullname').html($(this).data('fullname'));
            printAcademic.find('.cancel').one('click', function () {
                printAcademic.modal('hide');
            });
            var id = $this.data('id');
            printAcademic.find('.print').unbind('click').click(function () {
                $.post('{{ url('common_admin_academic', {"action": "print"})}}' + id, function (data) {
                    if (data && 'success' == data.status) {
                        $('.flashmessage').addClass('hide');
                        $('.academic_printed_success').removeClass('hide');
                        printAcademic.modal('hide');
                    } else {
                        errorRemove();
                    }
                }, 'json').error(errorPrint);
            });
            printAcademic.modal();
        }

        function errorRemove() {
            $('.flashmessage').addClass('hide');
            $('.academic_removed_error').removeClass('hide');
            $('#removeAcademic').modal('hide');
        }

        function errorPrint() {
            $('.flashmessage').addClass('hide');
            $('.academic_printed_error').removeClass('hide');
            $('#printAcademic').modal('hide');
        }
    </script>
{% endblock %}<commit_msg>Removed print in common academic to remove confusion<commit_after>{% extends 'admin/base.twig' %}

{% block content %}
    {% include 'common/admin/academic/partials/navigation.twig' %}

    {% include 'admin/partials/flashMessenger.twig' %}
    <div class="flashmessage success_message full_width academic_removed_success hide">
        <div class="title">Success</div>
        <div class="content">
            <p>The academic was successfully removed!</p>
        </div>
    </div>
    <div class="flashmessage error_message full_width academic_removed_error hide">
        <div class="title">Error</div>
        <div class="content">
            <p>An error occurred while trying to delete the academic.</p>
        </div>
    </div>

    <div id="controller_action">
        <div id="student_search" style="display: none;">
            <div style="padding: 4px; text-align: right">
                Search:
                <select id="searchField">
                    <option value="username">Username</option>
                    <option value="name">Name</option>
                    <option value="university_identification">University Identification</option>
                </select>
                is
                <input type="text" id="searchString" size="30" />
            </div>

            <table class="full_width manage">
                <tr>
                    <th>Username</th>
                    <th>Identification</th>
                    <th width="200px">Name</th>
                    <th width="200px">E-mail</th>
                    <th width="70px">Action</th>
                </tr>
            </table>
        </div>

        <div id="default_page">
            <table class="full_width manage">
                <thead>
                    <tr>
                        <th>Username</th>
                        <th>Identification</th>
                        <th width="200px">Name</th>
                        <th width="200px">E-mail</th>
                        <th width="70px">Action</th>
                    </tr>
                </thead>

                <tbody>
                    {% for academic in paginator %}
                        <tr class="item item-{{ academic.getId() }}">
                            <td>{{ academic.getUsername() }}</td>
                            <td>{{ academic.getUniversityIdentification() }}
                            <td>{{ academic.getFullName() }}</td>
                            <td>{{ academic.getEmail() }}</td>
                            <td class="actions">
                                {% if hasAccess('common_admin_academic', 'edit') %}
                                    <a href="{{ url('common_admin_academic', {"action": "edit", "id": academic.getId()}) }}" class="edit">Edit</a></li>
                                {% endif %}
                                {% if hasAccess('common_admin_academic', 'delete') %}
                                    <a href="#" class="delete" data-id="{{ academic.getId() }}" data-fullname="{{ academic.getFullName() }}">Delete</a>
                                {% endif %}
                            </td>
                        </tr>
                    {% endfor %}
                </tbody>
            </table>

            {% include 'admin/partials/paginationControl.twig' %}
        </div>
    </div>

    <div class="modal fade" id="removeAcademic" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <span>Litus Admin</span>
                    /Delete Academic
                </div>
                <div class="modal-body">
                    <p>
                        You are about to delete the following student: <b class="fullname"></b>?
                        Please note that this operation cannot be undone!
                    </p>
                    <p>
                        Are you sure you want to continue?
                    </p>
                    <div class="footer">
                        <button class="delete">Yes</button>
                        <button class="cancel" data-dismiss="modal">No</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

{% block content_script %}
    <script type="text/javascript">
        $(document).ready(function () {
            {% if hasAccess('common_admin_academic', 'search') %}
            $.searchDatabase({
                defaultPage: $('#default_page'),
                searchDiv: $('#student_search'),
                searchString: $('#searchString'),
                searchField: $('#searchField'),
                searchPage: '{{ url('common_admin_academic', {'action': 'manage'}) }}manage/',
                url: '{{ url('common_admin_academic', {'action': 'search'}) }}',
                display: function (data) {
                    $('#student_search table').find('tr.item').remove();
                    $(data).each(function () {
                        $('#student_search table').append(row = $('<tr>', {class: 'item item-' + this.id}));
                        row.append('<td>' + this.username + '</td>')
                            .append('<td>' + this.universityIdentification + '</td>')
                            .append('<td>' + this.fullName + '</td>')
                            .append('<td>' + this.email + '</td>')
                            .append(
                                $('<td>', {'class': 'actions'})
                                    .append('<a href="{{ url('common_admin_academic', {"action": "edit"}) }}' + this.id + '" class="edit">Edit</a>')
                                    .append(deleteButton = $('<a href="#" class="delete">Delete</a>'))
                                );
                            deleteButton.data({
                                id: this.id,
                                fullname: this.fullName
                            });
                    });
                    $('#student_search .delete').click(openDeleteModal);
                    $('#student_search table').change();
                },
                clear: function () {
                    $('#student_search table').find('tr.item').remove();
                }
            });
            {% endif %}

            $('.item .delete').click(openDeleteModal);
        });

        function openDeleteModal(e) {
            var $this = $(this);
            e.preventDefault();
            var removeAcademic = $('#removeAcademic');
            removeAcademic.find('.fullname').html($(this).data('fullname'));
            removeAcademic.find('.cancel').one('click', function () {
                removeAcademic.modal('hide');
            });
            var id = $this.data('id');
            removeAcademic.find('.delete').unbind('click').click(function () {
                $.post('{{ url('common_admin_academic', {"action": "delete"})}}' + id, function (data) {
                    console.log(data);
                    if (data && 'success' == data.status) {
                        $('.flashmessage').addClass('hide');
                        $('.academic_removed_success').removeClass('hide');
                        $('.item-' + id).remove();
                        removeAcademic.modal('hide');
                    } else {
                        errorRemove();
                    }
                }, 'json').error(errorRemove);
            });
            removeAcademic.modal();
        }

        function errorRemove() {
            $('.flashmessage').addClass('hide');
            $('.academic_removed_error').removeClass('hide');
            $('#removeAcademic').modal('hide');
        }
    </script>
{% endblock %}
{'fraction_non_alphanumeric': 0.1527072758037225, 'fraction_numerical': 0.0021679357021996614, 'mean_word_length': 1.2963817387081107, 'pattern_counts': {'":': 9, '<': 290, '<?xml version=': 0, '>': 290, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5629744', 'n_tokens_mistral': 4853, 'n_tokens_neox': 4483, 'n_words': 884}