{% extends '@SyliusShop/layout.html.twig' %}
{% import '@SyliusUi/Macro/headers.html.twig' as headers %}

{% form_theme form '@SyliusShop/Form/theme.html.twig' %}

{% set product = product_review.reviewSubject %}

{% block content %}
    <div class="container">
        <div class="row product-reviews-create-container" id="reviews">
            <div class="col-12">
                {{ headers.shop('sylius.ui.write_your_own_review'|trans, 'edit', 'sylius.ui.you_are_reviewing'|trans~' <strong>'~product.name~'</strong>') }}
            </div>

            <div class="col-md-4">
                {{ sylius_template_event('sylius.shop.product_review.create.product_box', _context) }}
            </div>

            <div class="col-md-8 d-flex">
                <div class="form-block w-100">

                    {{ sylius_template_event('sylius.shop.product_review.create.before_form', {'product_review': product_review}) }}

                    {{ form_start(form, {'action': path('sylius_shop_product_review_create', {'slug': product.slug, '_locale': product.translation.locale}), 'attr': {'class': 'loadable', 'novalidate': 'novalidate'}}) }}

                    {% include '@SyliusShop/ProductReview/_form.html.twig' %}

                    {{ sylius_template_event('sylius.shop.product_review.create.form', {'product_review': product_review, 'form': form}) }}

                    {{ form_row(form._token) }}

                    <button type="submit" class="btn btn-primary btn-block" {{ sylius_test_html_attribute('add') }}>
                        {{ 'sylius.ui.add'|trans }}
                    </button>

                    {{ form_end(form, {'render_rest': false}) }}
                </div>


            </div>
        </div>
    </div>
{% endblock %}
