{% extends "fitcheck/base.html" %}

{% load i18n %}

{% block fitcheck_content %}
    <div class="card mb-3">
        <div class="card-body d-flex align-items-center gap-3">
            <img src="https://images.evetech.net/types/{{ fit.ship_type_id }}/icon?size=64"
                 alt="" width="48" height="48">
            <div>
                <div class="fc-eyebrow">{% translate "Version history" %} &middot; {% translate "Fit" %} v{{ fit.version }} ({% translate "current" %})</div>
                <h4 class="mb-0">{{ fit.name }}</h4>
            </div>
            <a class="btn btn-secondary ms-auto" href="{% url 'fitcheck:fit_detail' fit.pk %}">
                <i class="fa-solid fa-arrow-left"></i> {% translate "Back to fit" %}
            </a>
        </div>
    </div>

    {% for archive in archives %}
        <div class="fc-finding-section fc-sec-CARGO mb-3">
            <div class="fc-finding-section-head">
                <i class="fa-solid fa-clock-rotate-left"></i>
                <span class="ms-1">{% translate "Fit" %} v{{ archive.version }}</span>
                <span class="ms-auto small fw-normal text-muted">
                    {% translate "archived" %} {{ archive.archived_at|date:"Y-m-d H:i" }}
                    {% if archive.archived_by %}&middot; {{ archive.archived_by.username }}{% endif %}
                </span>
            </div>
            <div class="card-body">
                <div class="d-flex flex-wrap gap-3 small text-muted mb-2">
                    <span>{{ archive.policy_snapshot.items|length }} {% translate "module rows" %}</span>
                </div>
                <details>
                    <summary class="small">{% translate "EFT source" %}</summary>
                    <pre class="small mt-2 mb-0">{{ archive.eft_source }}</pre>
                </details>
            </div>
        </div>
    {% empty %}
        <div class="alert alert-secondary">{% translate "No archived versions yet. Updating the fit's module list will archive the current version here." %}</div>
    {% endfor %}
{% endblock %}
