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

{% block title %}
{% trans "Range management" %} | {{ block.super }}
{% endblock %}

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

{% block header %}
{% endblock header %}

{% block dashboard_content %}
<div class="well well-success">
    <h3><i class="icon-file"></i> {% trans "Create new range" %}</h3>
	<a href="{% url dashboard:range-create %}" class="btn btn-primary">{% trans "Create new range" %}</a>
</div>

{% if ranges.count %}
    <table class="table table-striped table-bordered">
        <thead>
            <tr>
                <th>{% trans "Name" %}</th>
                <th>{% trans "Num products" %}</th>
                <th>{% trans "Date created" %}</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
        {% for range in ranges %}
        <tr>
            <td>{{ range.name }}</td>
            <td>{{ range.num_products|default:"-" }}</td>
            <td>{{ range.date_created }}</td>
            <td>
                <a class="btn btn-primary" href="{% url dashboard:range-update range.id %}">{% trans "Edit" %}</a>
                {% if not range.includes_all_products %}
                <a class="btn btn-info" href="{% url dashboard:range-products range.id %}">{% trans "Edit products" %}</a>
                {% endif %}
                <a class="btn btn-danger" href="{% url dashboard:range-delete range.id %}">{% trans "Delete" %}</a>
            </td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
    {% include "partials/pagination.html" %}
{% else %}
    <p>{% trans "No ranges found." %}</p>
{% endif %}
{% endblock dashboard_content %}
