{% extends 'dashboard/layout.html' %}
{% load url from future %}
{% load i18n %}

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

{% block header %}
    <div class="page-header">
        <a href="{% url 'dashboard:catalogue-class-create' %}" class="btn btn-primary btn-large pull-right"><i class="icon-plus"></i> {% trans "Create new product type" %}</a>
        <h1>{% trans "Product type management" %}</h1>
    </div>
{% endblock header %}

{% block dashboard_content %}
    {% if classes %}
        <table class="table table-striped table-bordered table-hover">
            <caption><i class="icon-sitemap icon-large"></i>{% trans 'Product Types' %}</caption>
            <thead>
                <tr>
                    <th>{% trans "Name" %}</th>
                    <th>{% trans "Requires shipping" %}</th>
                    <th>{% trans "Track stock?" %}</th>
                </tr>
            </thead>
            <tbody>
                {% for class in classes %}
                    <tr>
                        <td><a href="{% url 'dashboard:catalogue-class-update' class.id %}">{{ class.name }}</a></td>
                        <td><a href="{% url 'dashboard:catalogue-class-update' class.id %}">{{ class.requires_shipping|yesno }}</a></td>
                        <td><a href="{% url 'dashboard:catalogue-class-update' class.id %}">{{ class.track_stock|yesno }}</a></td>
                        <td>
                            <div class="btn-toolbar">
                                <div class="btn-group">
                                    <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                                        {% trans "Actions" %}
                                        <span class="caret"></span>
                                    </a>
                                    <ul class="nav dropdown-menu pull-right">
                                        <li><a href="{% url 'dashboard:catalogue-class-update' pk=class.id %}">{% trans "Edit product type" %}</a></li>                                    
                                        <li><a href="{% url 'dashboard:catalogue-class-delete' pk=class.id %}">{% trans "Delete" %}</a></li>
                                    </ul>
                                </div>
                            </div>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>{% trans "There are no product types." %}</p>
    {% endif %}
{% endblock dashboard_content %}
