{% extends "dashboard.html" %}
{% load static %}

{% block content %}
<article>
    <header class="object__header">
        <h1><img src="{% static 'images/coupon.png' %}" alt=""> Coupons</h1>
        <div class="object__menu">
            <a href="{% url 'dashboard:coupon-create' %}" class="action-button order__fulfill">+ New coupon</a>
        </div>
    </header>
    <section class="object__list">
        <div class="object__item panel__header object__item--col5" href="coupon-detail">
            <span>Name</span>
            <span>Code</span>
            <span>Starts</span>
            <span>Ends</span>
            <span>Value</span>
        </div>
    {% for coupon in coupon_list  %}
        <a class="object__item object__item--link object__item--col5" href="{% url 'dashboard:coupon-detail' coupon.pk %}">
            <span>{{ coupon.name }}</span>
            <span>{{ coupon.code }}</span>
            <span>{{ coupon.valid_from|date:"SHORT_DATE_FORMAT" }}</span>
            <span>{{ coupon.valid_to|date:"SHORT_DATE_FORMAT" }}</span>
            <span>{{ coupon.discount_value }} {{ coupon.get_discount_value_type_display }}</span>
        </a>
    {% empty %}
        <span class="object__item">No coupons</span>
    {% endfor %}
    </section>
</article>
{% endblock content %}
