{% extends 'oscar/dashboard/layout.html' %}
{% load currency_filters %}
{% load i18n %}

{% block body_class %}{{ block.super }} create-page{% endblock %}

{% block title %}
    {% trans "Update review" %} | {{ 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"><a href="{% url 'dashboard:reviews-list' %}">{% trans "Reviews" %}</a></li>
            <li class="breadcrumb-item active" aria-current="page">{% blocktrans %}Review #{{ review.id }}{% endblocktrans %}</li>
        </ol>
    </nav>
{% endblock %}

{% block headertext %}
    {% blocktrans with review_id=review.id %}Review #{{ review_id }}{% endblocktrans %}
{% endblock %}

{% block dashboard_content %}
    <form id="create_update_review_form" method="post" class="form-stacked" enctype="multipart/form-data">
        {% csrf_token %}
        <div class="table-header">
            <h3>{% trans "Review information" %}</h3>
        </div>
        <div class="card card-body bg-light">
            <div class="clearfix">
                {{ form.first }}
                {% for field in form %}
                    {# display title (first) and body (last) as full lines #}
                    {% if forloop.counter < 3 %}
                        <div class="form-group">
                            {% if field.is_hidden %}
                                {{ field }}
                            {% else %}
                                {{ field.label_tag }}
                                <div class="controls">
                                    {{ field }}
                                    {% for error in field.errors %}
                                        <span class="error-block">
                                            {{ error|escape }}
                                        </span>
                                    {% endfor %}
                                    {% if field.help_text %}
                                        <small class="form-text text-muted">
                                            {{ field.help_text }}
                                        </small>
                                    {% endif %}
                                </div>
                            {% endif %}
                        </div>
                    {% else %}
                        <div class="form-inline float-left">
                            {% if field.is_hidden %}
                                {{ field }}
                            {% else %}
                                <span class="form-group">
                                    {{ field.label_tag }}
                                    {{ field }}
                                    {% for error in field.errors %}
                                        <ul class="error-block">
                                            <li>{{ error|escape }}</li>
                                        </ul>
                                    {% endfor %}
                                </span>
                            {% endif %}
                        </div>
                    {% endif %}
                {% endfor %}
            </div>
            <div class="form-actions">
                <button class="btn btn-primary" type="submit" data-loading-text="{% trans 'Saving...' %}">{% trans "Save" %}</button> {% trans "or" %}
                <a href="{% url 'dashboard:reviews-list' %}">{% trans "cancel" %}</a>
            </div>
        </div>
    </form>
{% endblock dashboard_content %}
