{% extends 'base.html.twig' %}

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

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

{% block main %}
    <section class="mx-auto max-w-3xl px-4 py-16 sm:px-6 lg:px-8">
        <header class="mb-10">
            <h1 class="text-3xl font-semibold">{{ 'marketing.review_report.form.heading'|trans }}</h1>
            <p class="mt-4">{{ 'marketing.review_report.form.intro'|trans }}</p>
        </header>

        {% for message in app.flashes('review-report-success') %}
            <div class="mb-8 rounded border border-green-300 bg-green-50 p-4 text-green-900" role="status">
                {{ message }}
            </div>
        {% endfor %}

        <article class="mb-8 rounded border p-6">
            <p class="font-semibold">{{ review.product.fullName }} — {{ review.rating }}/5</p>
            {% if review.title %}
                <h2 class="mt-3 text-lg font-semibold">{{ review.title }}</h2>
            {% endif %}
            <p class="mt-3 whitespace-pre-line">{{ review.comment }}</p>
        </article>

        {% if already_reported %}
            <p class="rounded border p-6" role="status">
                {{ 'marketing.review_report.form.already_saved'|trans }}
            </p>
        {% else %}
            {{ form_start(form, {attr: {class: 'space-y-6'}}) }}
                {{ form_row(form.reason) }}
                {{ form_row(form.comment) }}
                {{ form_row(form.captcha) }}
                <div class="flex flex-wrap gap-4">
                    <button class="inline-flex items-center justify-center rounded px-6 py-3 font-semibold" type="submit">
                        {{ 'marketing.review_report.form.submit'|trans }}
                    </button>
                    {% if review.product.category %}
                        <a 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 %}
    </section>
{% endblock %}
