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

{% load i18n %}
{% load afat %}

{% block page_title %}
    {% translate "Fleet Activity Tracking statistics" as page_title %}
    {{ corporation }} {{ page_title|title }}
{% endblock %}

{% block afat_header %}
    {% translate "Fleet activity" as site_title %}
    {% include "framework/header/page-header.html" with title=site_title sub_title=corporation %}
{% endblock %}

{% block afat_body %}
    {% url "afat:statistics_corporation" corpid year_prev as url_previous_year %}
    {% url "afat:statistics_corporation" corpid year_next as url_next_year %}
    {% url "afat:statistics_corporation" corpid year_current as url_current_year %}

    {% include "afat/partials/common/navigation/year-navigation.html" with url_previous_year=url_previous_year url_next_year=url_next_year url_current_year=url_current_year %}

    <div class="row">
        <div class="col-md-4 col-lg-3 mb-3">
            <div class="card card-default">
                <div class="card-body">
                    <div class="text-center">
                        <figure>
                            <img
                                src="{{ corpid|corporation_logo_url:256 }}"
                                class="rounded"
                                alt="{{ corporation }}"
                            >
                            <figcaption class="figure-caption">{{ corporation }}</figcaption>
                        </figure>

                        <p>
                            {% blocktranslate %}
                                Fleet Activity Tracking statistics for <strong>{{ corporation }}</strong> for the year <strong>{{ year }}</strong>.
                            {% endblocktranslate %}
                        </p>

                        <p>
                            {% blocktranslate %}
                                Total FATs for {{ year }}: <strong>{{ fats_per_year }}</strong>
                            {% endblocktranslate %}
                        </p>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-8 col-lg-9">
            <div class="card card-default">
                <div class="card-body">
                    <table class="table table-striped table-hover">
                        <thead>
                            <tr>
                                <th>{% translate "Month" %}</th>
                                <th>{% translate "FATs" %}</th>

                                {% if type == 0 %}
                                    <th>{% translate "Avg FATs" %}</th>
                                {% endif %}

                                <th></th>
                            </tr>
                        </thead>

                        <tbody>
                            {% for month in months %}
                                <tr>
                                    <td>{{ month.0|month_name }}</td>
                                    <td>{{ month.1 }}</td>

                                    {% if type == 0 %}
                                        <td>{{ month.2 }}</td>
                                    {% endif %}

                                    <td class="text-end">
                                        {% if corporation != "No Alliance" %}
                                            <a
                                                href="{% url 'afat:statistics_corporation' corpid year month.0 %}"
                                                class="btn btn-primary btn-sm"
                                                data-bs-toggle="tooltip"
                                                data-bs-html="true"
                                                data-bs-title="{% translate 'View detailed corporation statistics for: ' %}<br>{{ month.0|month_name }} {{ year }}"
                                            >
                                                <i class="fa-solid fa-eye"></i>
                                            </a>
                                        {% endif %}
                                    </td>
                                </tr>
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
{% endblock %}

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