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

{% block head_title %}{{ category }} | {% endblock %}

{% block content %}
<article>
    <p>
        <a href="{% url 'dashboard:catalog' %}">&larr; Back to catalog</a>
    </p>
    <header class="object-header">
        <div>
            <h1><img src="{% static 'images/cubes.png' %}"> {{ category.name }}</h1>
            <p><strong>Is a main category</strong>: {{ category.main_category|yesno:"Yes,No" }}</p>
        </div>
        <div class="object-menu">
            {% if perms.core.delete_productcategory %}
            <a href="{% url 'dashboard:category-delete' category.pk %}" class="btn btn-warning">Delete</a>
            {% endif %}
            {% if perms.core.change_productcategory %}
            <a href="{% url 'dashboard:category-update' category.pk %}" class="btn">Edit</a>
            {% endif %}
        </div>
    </header>
    <section class="panel">
        <header class="panel-header">
            <h4>Products</h4>
        </header>
        {% include 'dashboard/product/_table.html' with product_list=category.product_set.all %}
    </section>
</article>
{% endblock content %}
