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

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

{% load ocyan_main %}

{% block extrahead %}
<link rel="canonical" href="{% absolute_url product.get_absolute_url %}">
{{ block.super }}
{% endblock %}

{% 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 class="review-list">
    <div class="row">
        {% if reviews %}
        <div class="col-lg-3">
            <div class="review-product">
                {% include 'oscar/catalogue/partials/product.html' %}
            </div>
        </div>
        <div class="col-lg-8">
            <form method="get">
                <div class="row align-items-center">
                    <div class="col-lg-8">
                        {% include "oscar/partials/form_fields_inline.html" with form=form %}
                    </div>
                </div>
            </form>

            <div class="review-wrapper">
            {% for review in reviews %}
            <div class="review-item">
                {% include 'oscar/catalogue/partials/review.html' %}
            </div>
            {% endfor %}
            </div>
            {% include 'oscar/partials/pagination.html' %}
        </div>
        {% else %}
        <div class="offset-lg-3 col-lg-6">
            <p>{% trans "This product does not have any reviews yet." %}</p>
        </div>
        {% endif %}
    </div>
</section>
{% endblock %}