{% extends "oscar/layout.html" %}

{% load history_tags %}
{% load i18n %}

{% block title %}
    {% trans "All reviews" %} | {{ product.title }} | {{ block.super }}
{% endblock %}

{% block breadcrumbs %}
    <nav aria-label="breadcrumb">
        <ol class="breadcrumb">
            <li class="breadcrumb-item">
                <a href="{{ homepage_url }}">{% trans "Home" %}</a>
            </li>
            {% with category=product.categories.all.0 %}
                {% for c in category.get_ancestors_and_self %}
                    <li class="breadcrumb-item">
                        <a href="{{ c.get_absolute_url }}">{{ c.name }}</a>
                    </li>
                {% endfor %}
                <li class="breadcrumb-item">
                    <a href="{{ product.get_absolute_url }}">{{ product.title }}</a>
                </li>
            {% endwith %}
            <li class="breadcrumb-item active" aria-current="page">{% trans "All reviews" %}</li>
        </ol>
    </nav>
{% endblock %}

{% block headertext %}
    {% trans "Customer reviews" %}
{% endblock  %}

{% block content %}

    <section>
        {% include 'oscar/catalogue/reviews/review_product.html' %}

        {% if reviews %}
            <form method="get" class="form-inline">
                {% include "oscar/partials/form_fields_inline.html" with form=form %}
                <button type="submit" class="btn btn-secondary">{% trans "Go" %}</button>
            </form>

            <hr>

            {% for review in reviews %}
                {% include 'oscar/catalogue/partials/review.html' %}
            {% endfor %}
            {% include 'oscar/partials/pagination.html' %}

        {% else %}
            <p>{% trans "This product does not have any reviews yet." %}</p>
        {% endif %}

    </section>
{% endblock %}
