{% extends 'oscar/dashboard/layout.html' %}
{% load category_tags %}
{% load i18n %}
{% load render_table from django_tables2 %}

{% block body_class %}{{ block.super }} catalogue{% endblock %}

{% block title %}
    {% trans "Categories" %} | {{ block.super }}
{% endblock %}

{% 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 "Categories" %}
            </li>
        </ol>
    </nav>
{% endblock %}

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

{% block dashboard_content %}
    <div class="alert alert-info">
        <div>{% trans "You are editing:" %}
            <strong><a href="{% url 'dashboard:catalogue-category-list' %}">{% trans "Home" %}</a></strong>
            {% if ancestors %}
                &gt;
                {% for ancestor in ancestors %}
                    <strong><a href="{% url 'dashboard:catalogue-category-detail-list' pk=ancestor.pk %}">{{ ancestor.name }}</a></strong>{% if not forloop.last %} > {% endif %}
                {% endfor %}
            {% endif %}
        </div>
    </div>

    {% render_table categories %}

    {% if not child_categories %}
        <p>{% trans "There are no categories." %}</p>
    {% endif %}
{% endblock dashboard_content %}
