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

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

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

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

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

{% block afat_body %}
    {% include "afat/partials/fleet_edit/fatlink_name_form.html" %}

    <p>&nbsp;</p>

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

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

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

{% block extra_css %}
    {% include 'bundles/datatables-css.html' %}

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

{% block extra_javascript %}
    {% include 'bundles/datatables-js.html' %}
    {% include 'bundles/clipboard-js.html' %}

    <script type="application/javascript">
        $(document).ready(function(){
            $('#fat-chars').DataTable();

            var clipboard = new ClipboardJS('.copy-btn');

            clipboard.on('success', function() {
                $('.copy-btn').tooltip('show');
            });

            $('#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 + '?');
            });
        });
    </script>
{% endblock %}
