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

{% load i18n %}

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

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

    <h2>{% translate "FAT Link Details" %}</h2>
{% endblock %}

{% block afat_body %}
    {% if perms.afat.manage_afat %}
        {% include "afat/partials/fatlinks/details/fatlink_name_form.html" %}
    {% endif %}

    {% include "afat/partials/fatlinks/details/fatlink_info.html" %}
    {% include "afat/partials/fatlinks/details/tabs_navigation.html" %}

    <div class="tab-content">
        {% include "afat/partials/fatlinks/details/tabs/fats.html" %}
        {% include "afat/partials/fatlinks/details/tabs/manualfat.html" %}
    </div>

    {% translate "Delete FAT" as translated_title %}
    {% include "afat/modals/general.html" with modal_name='deleteFat' 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 "afat/bundles/afat-js.html" %}
    {% include "bundles/datatables-js.html" %}
    {% include "bundles/clipboard-js.html" %}

    <script>
        let afatSettings = {
            url: '{% url "afat:fatlinks_ajax_get_fats_by_fatlink" 0 %}'.replace(
                    '0',
                    '{{ link.hash }}'
                ),
            modal: {
                deleteFatModal: {
                    element: '#deleteFatModal',
                },
                reopenFatLinkModal: {
                    element: '#reopenFatLinkModal',
                },
                cancelEsiFleetModal: {
                    element: '#cancelEsiFleetModal',
                }
            },
            reloadDatatable: {{ link_ongoing|yesno:"true,false" }}
        }
    </script>

    {% include "afat/bundles/afat-fatlink-details-js.html" %}
{% endblock %}
