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

<div id="tab-corps" class="tab-pane fade card card-default border-0" role="tabpanel" aria-labelledby="tab-corps">
    <div class="card-body">
        {% if user_can_see_other_corps %}
            <header class="mb-3">
                <h4>
                    {% translate "Corporations" %}
                    <span class="small text-muted">({% translate "Click on an alliance name to see their corporations" %})</span>
                </h4>
            </header>
        {% endif %}

        <div class="accordion accordion-flush mb-0" id="accordion" id="accordionAlliances">
            {% if perms.afat.stats_corporation_other or perms.afat.manage_afat %}
                {% for key, value in data.items|dictsort:0 %}
                    {% if value|length > 0 %}
                        {% include "afat/partials/statistics/overview/tabs/alliance-accordion-item.html" %}
                    {% endif %}
                {% endfor %}
            {% elif perms.afat.stats_corporation_own %}
                <table class="table table-striped table-hover mb-0">
                    <tbody>
                        <tr>
                            <td>
                                <img class="rounded me-1" src="{{ data.0.0|corporation_logo_url:32 }}" alt="{{ data.0.1 }}">
                                {{ data.0.1 }}
                            </td>

                            <td class="text-end">
                                <a class="btn btn-primary btn-sm" href="{% url 'afat:statistics_corporation' data.0.0 year %}">
                                    <i class="fa-solid fa-eye"></i>
                                </a>
                            </td>
                        </tr>
                    </tbody>
                </table>
            {% endif %}
        </div>
    </div>
</div>
