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

{% load i18n %}

{% block page_title %}{% translate "Fleet Activity" %}{% endblock %}

{% block afat_header %}
    <br>
    {% include "afat/partials/menu.html" %}

    <h2>{% translate "All FAT Links" %}</h2>
{% endblock %}

{% block afat_body %}
    {% url "afat:fatlinks_overview" year_prev as url_previous_year %}
    {% url "afat:fatlinks_overview" year_next as url_next_year %}
    {% url "afat:fatlinks_overview" year_current as url_current_year %}
    {% include "afat/partials/year_navigation.html" with url_previous_year=url_previous_year url_next_year=url_next_year url_current_year=url_current_year %}

    <div class="panel panel-default">
        <div class="panel-body">
            <table class="table table-striped table-hover" id="link-list" style="width: 100%;">
                <thead>
                    <tr>
                        <th>{% translate "Fleet Name" %}</th>
                        <th>{% translate "Fleet Type" %}</th>
                        <th>{% translate "Creator" %}</th>
                        <th>{% translate "EVE Time" %}</th>
                        <th>{% translate "# of FATs" %}</th>
                        <th><!-- {% translate "Actions" %} --></th>
                    </tr>
                </thead>

                <tbody></tbody>

                <tfoot>
                    <tr>
                        <td colspan="{% if perms.afat.manage_afat %}6{% else %}5{% endif %}">
                            {% include "afat/partials/fatlinks/fatlink_list_legend.html" %}
                        </td>
                    </tr>
                </tfoot>
            </table>
        </div>
    </div>

    {% translate "Delete FAT Link" as translated_title %}
    {% include "afat/modals/general.html" with modal_name="deleteFatLink" modal_title=translated_title confirm_button_class="btn-danger" %}

    {% translate "Close ESI Fleet Tracking" as translated_title %}
    {% include "afat/modals/general.html" with modal_name="cancelEsiFleet" modal_title=translated_title confirm_button_class="btn-danger" %}
{% endblock %}

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

{% block extra_javascript %}
    {% include "bundles/datatables-js.html" %}
    {% include "bundles/moment-js.html" with locale=True %}
    {% include "afat/bundles/afat-js.html" %}

    <script>
        let afatSettings = {
            url: {
                linkList: '{% url "afat:fatlinks_ajax_get_fatlinks_by_year" year %}'
            },
            permissions: {
                addFatLink: {% if perms.afat.add_fatlink %}true{% else %}false{% endif %},
                manageAfat: {% if perms.afat.manage_afat %}true{% else %}false{% endif %}
            },
            translation: {
                dataTable: {
                    filter: {
                        viaEsi: '{% translate "via ESI" %}'
                    }
                },
            },
            modal: {
                deleteFatLinkModal: {
                    element: '#deleteFatLinkModal'
                },
                cancelEsiFleetModal: {
                    element: '#cancelEsiFleetModal'
                }
            }
        }
    </script>

    {% include "afat/bundles/afat-fatlist-js.html" %}
    {% include "bundles/filterdropdown-js.html" %}
{% endblock %}
