{% extends 'oscar/dashboard/layout.html' %}
{% load currency_filters %}
{% load sorting_tags %}
{% load i18n %}

{% block title %}
    {{ description }} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <ul class="breadcrumb">
        <li>
            <a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
        </li>
        <li class="active">{{ description }}</li>
    </ul>
{% endblock %}

{% block header %}
<div class="page-header">
    <a href="{% url 'dashboard:voucher-set-create' %}" class="btn btn-primary btn-large pull-right"><i class="icon-plus"></i> {% trans "Create new voucher set" %}</a>
    <h1>{% trans "Voucher sets" %}</h1>
</div>
{% endblock header %}


{% block dashboard_content %}

<table class="table table-striped table-bordered table-hover">
    {% if description != "All vouchers" %}
        <caption><i class="icon-money icon-large"></i>{{ description }}</caption>
    {% endif %}
    {% if vouchers %}
    <tr>
        <th>{% trans "Name" %}</th>
        <th>{% trans "Num" %}</th>
        <th>{% trans "Status" %}</th>
        <th>{% anchor 'num_basket_additions' _("Num baskets") %}</th>
        <th>{% anchor 'num_orders' _("Num orders") %}</th>
        <th>{% anchor 'date_created' _("Date created") %}</th>
        <th></th>
    </tr>
        {% for voucher in vouchers %}
        <tr>
            <td><a href="{% url 'dashboard:voucher-set' voucher.id %}">{{ voucher.name }}</a></td>
            <td>{{ voucher.count }}</td>
            <td>
                {% if voucher.is_active %}
                    <span class="label label-success">{% trans "Active" %}</span>
                {% else %}
                    <span class="label label-warning">{% trans "Inactive" %}</span>
                {% endif %}
            </td>
            <td>{{ voucher.num_basket_additions }}</td>
            <td>{{ voucher.num_orders }}</td>
            <td>{{ voucher.date_created }}</td>
            <td>
                <div class="btn-toolbar">
                    <div class="btn-group">
                    <button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
                        {% trans "Actions" %}
                        <span class="caret"></span>
                      </button>
                      <ul class="dropdown-menu pull-right">
                          <li><a href="{% url 'dashboard:voucher-set' pk=voucher.id %}">{% trans "Stats" %}</a></li>
                        <li><a href="{% url 'dashboard:voucher-set-update' pk=voucher.id %}">{% trans "Edit" %}</a></li>
                      </ul>
                    </div>
                </div>
            </td>
        </tr>
        {% endfor %}
    {% else %}
    <tr><td>{% trans "No vouchers found." %}</td></tr>
    {% endif %}
</table>
{% include "oscar/partials/pagination.html" %}
{% endblock dashboard_content %}
