{% extends "allianceauth/base.html" %}
{% load staticfiles %}
{% load i18n %}

{% block page_title %}{{ group }} {% trans "Audit Log" %}{% endblock page_title %}

{% block content %}
    <div class="col-lg-12">
        <br>
        {% include 'groupmanagement/menu.html' %}
        <div>
            <h3>{{ group }} Audit Log</h3>
            <p> All times displayed are EVE/UTC.</p>
            {% if entries %}
                <div class="table-responsive">
                    <table class="table table-striped" id="log-entries">
                        <thead>
                            <th class="text-center" scope="col">{% trans "Date/Time" %}</th>
                            <th class="text-center" scope="col">{% trans "Requestor" %}</th>
                            <th class="text-center" scope="col">{% trans "Main Character" %}</th>
                            <th class="text-center" scope="col">{% trans "Group" %}</th>
                            <th class="text-center" scope="col">{% trans "Type" %}</th>
                            <th class="text-center" scope="col">{% trans "Action" %}</th>
                            <th class="text-center" scope="col">{% trans "Actor" %}</th>
                        </thead>
                        <tbody>
                        {% for entry in entries %}
                            <tr>
                                <td class="text-center">{{ entry.date }}</td>
                                <td class="text-center">{{ entry.requestor }}</td>
                                <td class="text-center">{{ entry.req_char }}</td>
                                <td class="text-center">{{ entry.group }}</td>
                                <td class="text-center">{{ entry.type_to_str }}</td>
                                {% if entry.request_type is None %}
                                    <td class="text-center"> Removed</td>
                                {% else %}
                                    <td class="text-center">{{ entry.action_to_str }}</td>
                                {% endif %}
                                <td class="text-center">{{ entry.request_actor }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                </div>
            {% else %}
                <div class="alert alert-warning text-center">{% trans "No entries found for this group." %}</div>
            {% endif %}
        </div>
    </div>
{% endblock %}
{% block extra_javascript %}
    {% include 'bundles/datatables-js.html' %}
{% endblock %}
{% block extra_css %}
    {% include 'bundles/datatables-css.html' %}
{% endblock %}
{% block extra_script %}
    $(document).ready(function(){
        $('#log-entries').DataTable();
    });
{% endblock %}

