{% extends "oscar/customer/alerts/alert_list.html" %}
{% load i18n %}

{% block tabcontent %}
{% if not alerts %}
<p>{% trans "You do not have any active alerts for out-of-stock products." %}</p>
{% else %}
<form method="post" id="alerts_form">
    {% csrf_token %}
    <table class="table table-card align-data-middle">
    <thead>
        <tr>
            <th class="border-0">{% trans "Product" %}</th>
            <th class="border-0">{% trans "Status" %}</th>
            <th class="border-0">{% trans "Date created" %}</th>
            <th class="border-0"></th>
        </tr>
    </thead>

        {% for alert in alerts %}
        <tr>
            <td>
            {% with product=alert.product %}
            {% if product.is_public %}
                <a href="{{ product.get_absolute_url }}">{{ product.get_title }}</a>
            {% else %}
                {{ product.get_title }}
            {% endif %}
            {% endwith %}
            </td>
            <td aria-live="assertive">{{ alert.status }}</td>
            <td>{{ alert.date_created }}</td>
            <td>
                {% if alert.can_be_cancelled %}
                <a href="{% url 'customer:alerts-cancel-by-pk' pk=alert.pk %}?next={% url 'customer:alerts-list' %}" class="btn btn-danger">{% trans "Cancel" %}</a>
                {% endif %}
            </td>
        </tr>
        {% endfor %}
    </table>
    {% include "oscar/partials/pagination.html" %}
</form>
{% endif %}
{% endblock tabcontent %}