{% extends 'base.html.twig' %}
{% form_theme form with app_form_themes() only %}

{% block title %}{{ 'marketing.review_report.form.page_title'|trans }}{% endblock %}

{% block meta %}
    <meta name="robots" content="noindex,nofollow">
{% endblock %}

{% block header %}
    {{ component('announcement:Banner') }}
{% endblock %}

{% block main %}
    <header class="theme-product-header">
        {% include 'partials/_nav.html.twig' %}
    </header>
    <section class="theme-review-page">
        <div class="theme-container theme-review-page__container">
            <header class="theme-review-page__header">
                <h1>{{ 'marketing.review_report.form.heading'|trans }}</h1>
                <p>{{ 'marketing.review_report.form.intro'|trans }}</p>
            </header>

            {% for message in app.flashes('review-report-success') %}
                <div class="theme-review-status theme-review-status--success" role="status">{{ message }}</div>
            {% endfor %}

            <article class="theme-review-report-card">
                <p class="theme-review-report-card__rating">{{ review.product.fullName }} — {{ review.rating }}/5</p>
                {% if review.title %}<h2>{{ review.title }}</h2>{% endif %}
                <p class="whitespace-pre-line">{{ review.comment }}</p>
            </article>

            {% if already_reported %}
                <p class="theme-review-status" role="status">{{ 'marketing.review_report.form.already_saved'|trans }}</p>
            {% else %}
                {{ form_start(form, { attr: { class: 'theme-auth-form' } }) }}
                    <div class="theme-form-field">{{ form_row(form.reason) }}</div>
                    <div class="theme-form-field">{{ form_row(form.comment) }}</div>
                    <div class="theme-form-field">{{ form_row(form.captcha) }}</div>
                    <div class="theme-form-actions">
                        <button class="theme-button-fill" type="submit">{{ 'marketing.review_report.form.submit'|trans }}</button>
                        {% if review.product.category %}
                            <a class="theme-button-stroke" href="{{ path('shop_product', {
                                categorySlug: review.product.category.slug,
                                slug: review.product.slug
                            }) }}">
                                {{ 'marketing.review_report.form.cancel'|trans }}
                            </a>
                        {% endif %}
                    </div>
                {{ form_end(form) }}
            {% endif %}
        </div>
    </section>
{% endblock %}
