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

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item"><a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% trans "Product Type" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block header %}
    <div class="page-header">
        <a href="{% url 'dashboard:catalogue-class-create' %}" class="btn btn-primary float-right">
            <i class="fas fa-plus-circle"></i> {% trans "Create new product type" %}</a>
        <h1>{% trans "Product types" %}</h1>
    </div>
{% endblock header %}

{% block dashboard_content %}
    {% if classes %}
        <table class="table table-striped table-bordered table-hover">
            <caption><i class="fas fa-sitemap"></i> {% trans 'Product Types' %}</caption>
            <thead>
                <tr>
                    <th>{% trans "Name" %}</th>
                    <th>{% trans "Requires shipping" %}</th>
                    <th>{% trans "Track stock?" %}</th>
                    <th>&nbsp;</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="dropdown">
                                    <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                        {% trans "Actions" %}
                                    </button>
                                    <div class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownMenuButton">
                                        <a class="dropdown-item" href="{% url 'dashboard:catalogue-class-update' pk=class.id %}">
                                            {% trans "Edit product type" %}
                                        </a>
                                        <a class="dropdown-item" href="{% url 'dashboard:catalogue-class-delete' pk=class.id %}">
                                            {% trans "Delete" %}
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    {% else %}
        <p>{% trans "There are no product types." %}</p>
    {% endif %}
{% endblock dashboard_content %}
