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

{% block head_title %}Categories | {% endblock %}

{% block content %}
<article>
    <p>
        <a href="{% url 'dashboard:catalog' %}">&larr; Back to catalog</a>
    </p>
    <header class="object-header">
        <h1><img src="{% static 'images/cubes.png' %}"> Categories</h1>
        <div class="object-menu">
            <a href="{% url 'dashboard:category-create' %}" class="btn">+ New category</a>
        </div>
    </header>
    {% for category in category_list %}
    <section class="panel">
        <header class="panel-header">
            <h3>{{ category }}</h3>
            <a href="{% url 'dashboard:category-detail' category.pk %}" class="btn">View category &rarr;</a>
        </header>
        {% include 'dashboard/product/_table.html' with product_list=category.product_set.all category=category %}
    </section>
    {% endfor %}
</article>
{% endblock content %}
