{% extends "afat/base.html" %}

{% load i18n %}

{% block page_title %}
    {% translate "Fleet Activity Tracking logs" as page_title %}
    {{ page_title|title }}
{% endblock %}

{% block afat_header %}
    {% translate "Logs" as site_title %}
    {% include "framework/header/page-header.html" with title=site_title %}
{% endblock %}

{% block afat_body %}
    <div class="card card-default">
        <div class="card-body">
            <table class="table table-striped table-hover w-100" id="afat-logs">
                <thead>
                    <tr>
                        <th>{% translate "Time" %}</th>
                        <th>{% translate "Event" %}</th>
                        <th>{% translate "User" %}</th>
                        <th>{% translate "FAT link" %}</th>
                        <th>{% translate "Description" %}</th>
                    </tr>
                </thead>

                <tbody></tbody>
            </table>
        </div>
    </div>

    <p class="text-muted text-end mt-3">
        {% blocktranslate count log_duration as duration %}
            Logs are kept for {{ duration }} day. Logs older than that are removed automatically.
        {% plural %}
            Logs are kept for {{ duration }} days. Logs older than that are removed automatically.
        {% endblocktranslate %}
    </p>
{% endblock %}

{% block extra_css %}
    {% include "bundles/datatables-css-bs5.html" %}
    {% include "afat/bundles/afat-css.html" %}
{% endblock %}

{% block extra_javascript %}
    <script>
        const afatJsSettingsOverride = {
            url: {
                logs: '{% url "afat:logs_ajax_get_logs" %}'
            },
        };
    </script>

    {% include "bundles/datatables-js-bs5.html" %}
    {% include "bundles/moment-js.html" with locale=True %}
    {% include "afat/bundles/afat-js.html" %}
    {% include "afat/bundles/afat-logs-js.html" %}
    {% include "bundles/filterdropdown-js.html" %}
{% endblock %}
