{% form_theme form with app_form_themes() only %}

<div {{ attributes.defaults({ 'data-review-form': '', class: 'theme-review-form' }) }}>
    {% if saved %}
        <div data-review-status class="theme-review-status theme-review-status--success" role="status">
            {{ (this.hasEligibleProducts ? 'marketing.review.form.saved_next' : 'marketing.review.form.saved')|trans }}
        </div>
    {% endif %}

    {% if this.hasEligibleProducts %}
        {{ form_start(form, {
            attr: {
                class: 'theme-auth-form',
                'data-action': 'live#action:prevent',
                'data-live-action-param': 'submitReview',
                'data-model': 'norender|*',
                novalidate: 'true'
            }
        }) }}
            <div class="theme-form-error">{{ form_errors(form) }}</div>
            <div class="theme-form-field">{{ form_row(form.productId) }}</div>
            <div class="theme-form-field">{{ form_row(form.rating) }}</div>
            <div class="theme-form-field">{{ form_row(form.comment) }}</div>

            <button
                class="theme-button-fill theme-review-form__submit"
                type="submit"
                data-loading="addAttribute(disabled)"
            >
                <span data-loading="hide">{{ 'marketing.review.form.submit'|trans }}</span>
                <span class="hidden" data-loading="show">{{ 'marketing.review.form.submit'|trans }}</span>
            </button>

            <div class="hidden">{{ form_rest(form) }}</div>
        {{ form_end(form) }}
    {% else %}
        <div data-review-status class="theme-review-status" role="status">
            <h2>{{ 'marketing.review.form.complete_title'|trans }}</h2>
            <p>{{ 'marketing.review.form.complete_text'|trans }}</p>
        </div>
    {% endif %}
</div>
