{% extends "allianceauth/base.html" %}
{% load bootstrap %}
{% load static %}
{% load i18n %}

{% block page_title %}{% trans "Fatlink view" %}{% endblock page_title %}

{% block content %}
    <div class="col-lg-12">
        <h1 class="page-header text-center">{% trans "Participation data" %}</h1>
        <table class="table">
                <tr>
                    <th class="col-md-11">
                        <h4><b>{% trans "Most recent clicked fatlinks" %}</b>
                        </h4>
                    </th>
                    <th class="col-md-1">
                        <a href="{% url 'fatlink:personal_statistics' %}" class="btn btn-info">
                            {% trans "Personal statistics" %}
                        </a>
                    </th>
                </tr>
        </table>
        {% if fats %}
        <table class="table table-responsive">
            <tr>
                <th class="text-center">{% trans "Fleet" %}</th>
                <th class="text-center">{% trans "Character" %}</th>
                <th class="text-center">{% trans "System" %}</th>
                <th class="text-center">{% trans "Ship" %}</th>
                <th class="text-center">{% trans "Eve Time" %}</th>
            </tr>
            {% for fat in fats %}
            <tr>
                <td class="text-center">{{ fat.fatlink.fleet }}</td>
                <td class="text-center">{{ fat.character.character_name }}</td>
                {%  if fat.station != "No Station" %}
                <td class="text-center">{% blocktrans %}Docked in {% endblocktrans %}{{ fat.system }}</td>
                {% else %}
                <td class="text-center">{{ fat.system }}</td>
                {% endif %}
                <td class="text-center">{{ fat.shiptype }}</td>
                <td class="text-center">{{ fat.fatlink.fatdatetime }}</td>
            </tr>
            {% endfor %}
        </table>
        {% else %}
        <div class="alert alert-warning text-center">{% trans "No fleet activity on record." %}</div>
        {% endif %}

        {% if perms.auth.fleetactivitytracking%}
            <table class="table">
                <tr>
                    <th class="col-md-10">
                        <h4><b>{% trans "Most recent fatlinks" %}</b>
                        </h4>
                    </th>
                    <th class="col-md-1">
                        <a href="{% url 'fatlink:statistics' %}" class="btn btn-info">
                            {% trans "View statistics" %}
                        </a>
                    </th>
                    <th class="col-md-1">
                        <a href="{% url 'fatlink:create' %}" class="btn btn-success">
                            {% trans "Create fatlink" %}
                        </a>
                    </th>
                </tr>
            </table>
        {% if fatlinks %}
        <table class="table">
            <tr>
                <th class="text-center">{% trans "Name" %}</th>
                <th class="text-center">{% trans "Creator" %}</th>
                <th class="text-center">{% trans "Fleet" %}</th>
                <th class="text-center">{% trans "Eve Time" %}</th>
                <th class="text-center">{% trans "Duration" %}</th>
                <th class="text-center">{% trans "Edit" %}</th>
            </tr>
            {% for link in fatlinks %}
            <tr>
                <td class="text-center"><a href="{%  url 'fatlink:click' link.hash %}" class="label label-primary">{{ link.fleet }}</a></td>
                <td class="text-center">{{ link.creator.username }}</td>
                <td class="text-center">{{ link.fleet }}</td>
                <td class="text-center">{{ link.fatdatetime }}</td>
                <td class="text-center">{{ link.duration }}</td>
                <td class="text-center">
                    <a href="{%  url 'fatlink:modify' link.hash %}" class="btn btn-info">
                        <span class="glyphicon glyphicon-edit"></span>
                    </a>
                </td>
            </tr>
            {%  endfor %}

        </table>
        {% else %}
        <div class="alert alert-warning text-center">{% trans "No created fatlinks on record." %}</div>
        {% endif %}
        {% endif %}
    </div>
{% endblock content %}
