{% extends "customer/baseaccountpage.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 action="." method="post" id="alerts_form">
	{% csrf_token %}
	<table class="table table-striped table-bordered">
		<tr>
			<th>{% trans "Product" %}</th>
			<th>{% trans "Status" %}</th>
			<th>{% trans "Date created" %}</th>
			<th></th>
		</tr>

		{% for alert in alerts %}
		<tr>
			<td>
				{% with product=alert.product %}
				<a href="{{ product.get_absolute_url }}">{{ product.get_title }}</a>
				{% endwith %}
			</td>
			<td>{{ 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>
</form>
{% endif %}

{% endblock tabcontent %}

