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

{% block extrahead %}
<meta name="robots" content="noindex">
{{ block.super }}
{% endblock %}

{% block breadcrumbs %}
{% include 'oscar/partials/breadcrumbs.html' with product=product %}
{% endblock breadcrumbs %}

{% block content %}
<section class="add_review_form">
    <div class="row">
        <div class="col-lg-7">
            <div id="reviews" class="review-header">
                <h1>{% trans "Product review" %}</h1>
            </div>
            <form class="review_form" id="add_review_form" method="post" action="#addreview">
                <fieldset>
                    {% csrf_token %}
                    <div class="reviewrating form-group {% if form.score.errors %}error{% endif %}">
                        <label for="{{ form.score.auto_id }}" class="col-form-label required">
                            {{ form.score.label|safe }}
                        </label>
                        <div class="controls">
                            {{ form.score }}
                            <div class="product-rating {{form.score.value}}">
                                {% include "oscar/catalogue/reviews/partials/stars.html" with rating=0 %}
                            </div>

                            {% for error in form.score.errors %}
                            <span class="error-block"><i class="fa fa-exclamation"></i> {{ error }}</span>
                            {% endfor %}
                        </div>

                        {% comment %}
                        {% include 'oscar/partials/form_field.html' with field=form.score %}
                        {% endcomment %}
                    </div>

                    {% include 'oscar/partials/form_field.html' with field=form.title %}

                    {% trans "Message" as message %}
                    {% include 'oscar/partials/form_field.html' with field=form.body label=message %}
                    {% if form.name %}
                    {% include 'oscar/partials/form_field.html' with field=form.name %}
                    {% endif %}
                    {% if form.email %}
                    {% include 'oscar/partials/form_field.html' with field=form.email %}
                    {% endif %}
                    {% if form.captcha %}
                    {% include 'oscar/partials/form_field.html' with field=form.captcha %}
                    {% endif %}

                <div class="review-bottom">
                    <button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Saving...' %}">{% trans "Save review" %}</button>
                    <a href="{{ product.get_absolute_url }}" class="btn btn-grey">{% trans "cancel" %}</a>
                </div>
                </fieldset>
            </form>
        </div>
        <div class="col-lg-4 offset-lg-1">
            <div class="card">
                <div class="card-body">
                    {% include 'oscar/catalogue/partials/product.html' with product=product %}
                </div>
            </div>
        </div>
    </div>
</section>
{% endblock %}
