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

{% load evelinks %}
{% load static %}
{% load i18n %}

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

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

    <h2>{% translate "Recent Activity" %}</h2>
{% endblock %}

{% block afat_body %}
    {% if msg %}
        <div class="alert alert-{{ msg.0 }} alert-dismissible" role="alert">
            <button type="button" class="close" data-dismiss="alert" aria-label="close">
                <span aria-hidden="true">&times</span>
            </button>

            {% if msg.0 != 'warning' %}
                <h4>
                    {% if msg.0 == 'danger' %}
                        {% translate "Oh No!" %}
                    {% elif msg.0 == 'success' %}
                        {% translate "Success!" %}
                    {% endif %}
                </h4>
            {% endif %}

            <p>{{ msg.1 }}</p>
        </div>
    {% endif %}

    {% include "afat/partials/afatview/tabs_navigation.html" %}

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

    {% include "afat/modals/delete-fat.html" %}
{% endblock %}

{% block extra_css %}
    <link rel="stylesheet" type="text/css" href="{% static 'afat/css/aa-bootstrap-fix.min.css' %}">
    <link rel="stylesheet" type="text/css" href="{% static 'afat/css/allianceauth-afat.min.css' %}">
{% endblock %}

{% block extra_javascript %}
    <script type="application/javascript">
        $('#deleteModal').on('show.bs.modal', function(event) {
            var button = $(event.relatedTarget); // Button that triggered the modal
            var url = button.data('url'); // Extract info from data-* attributes
            var name = button.data('name');
            var modal = $(this);

            modal.find('#fat-link').attr('href', url);
            modal.find('.modal-body').text('{% translate "Are you sure you want to delete" %} ' + name + '?');
        }).on('hide.bs.modal', function() {
            var modal = $(this);

            modal.find('.modal-body').html('');
        });
    </script>
{% endblock %}
