{% load i18n %}
<table class="table table-striped align-middle" data-table-body>
    <thead><tr>
        <th data-sort="text">{% trans "Hull" %}</th>
        <th data-sort="text">{% trans "Ship name" %}</th>
        <th data-sort="num">{% trans "Price" %}</th>
        <th></th>
    </tr></thead>
    <tbody>
    {% for l in listings %}
        <tr data-name="{{ l.eve_type.name|lower }} {{ l.ship_name|lower }}">
            <td>
                {% include 'shop/_featured_star.html' with section='fitted' listing=l %}
                <img src="https://images.evetech.net/types/{{ l.eve_type_id }}/icon?size=32" width="24" height="24" class="me-1" alt="">
                {{ l.eve_type.name }}
            </td>
            <td>
                {{ l.ship_name|default:'—' }}
                {% if not l.stock %}<span class="badge bg-warning text-dark ms-1">{% trans "Build to order" %}</span>{% endif %}
            </td>
            <td data-sort-value="{{ l.price }}">{{ l.price_display }}</td>
            <td class="text-end">
                <button type="button" class="btn btn-sm btn-outline-theme edit-fitted-btn"
                        data-url="{% url 'backoffice:edit_fitted' shop.pk l.pk %}"
                        data-name="{{ l.eve_type.name }}"
                        data-price="{{ l.price }}"
                        data-persist="{{ l.persist|yesno:'1,' }}"
                        data-description="{{ l.description }}">
                    <i class="fa-solid fa-pen-to-square fa-fw"></i> {% trans "Edit" %}
                </button>
                <form method="post" action="{% url 'backoffice:remove_fitted' shop.pk l.pk %}" class="d-inline">
                    {% csrf_token %}
                    <button class="btn btn-sm btn-outline-danger">{% trans "Remove" %}</button>
                </form>
            </td>
        </tr>
    {% empty %}
        <tr><td colspan="4" class="text-muted">{% trans "No fitted ships yet — mark ships in-game with your filter text, then refresh." %}</td></tr>
    {% endfor %}
    </tbody>
</table>
