{% trans_default_domain 'products' %}
<div data-reload="product_question" {{ attributes }}>
   {% if this.alreadyRated %}
      <span>{{ 'alreadyRated.alert'|trans }}</span>
   {% else %}
      {% if this.allowAnonymous %}
         <p class="title-default"{{ 'reviews.add.noverify'|trans }}></p>
      {% else %}
         <p class="title-default">{{ 'reviews.add.verified'|trans }}</p>
      {% endif %}
      {{ form_start(form, {
         attr: {
            'data-action': 'live#action',
            'data-live-action-param': 'handleWriteForm',
            'data-recaptcha-lazy': '',
         },
      }) }}
      <div class="form-group required">
         <label>{{ 'rating'|trans }}</label>
         <div class="review-stars-picker {{ form.rating.vars.errors ? 'form-error' : '' }}">
            {% for choice_form in form.rating %}
               {{ form_widget(choice_form) }}
               <label for="{{ choice_form.vars.id }}">
                  <twig:ux:icon name="star" class="c-icon"/>
               </label>
            {% endfor %}
         </div>
      </div>
      <div class="form-group">
         {{ form_row(form.review, {attr: {class: 'form-control hidden-row'}}) }}
      </div>
      <div class="form-group form-group-pros">
         {{ form_row(form.positives, {attr: {class: 'form-control hidden-row'}}) }}
      </div>
      <div class="form-group form-group-cons">
         {{ form_row(form.negatives, {attr: {class: 'form-control hidden-row'}}) }}
      </div>

      {% if this.allowAnonymous %}
         <div class="form-group required">
            {{ form_row(form.email, {attr: {class: 'form-control hidden-row'}, required: true}) }}
         </div>
         <div class="form-group required">
            {{ form_row(form.name, {attr: {class: 'form-control hidden-row'}, required: true}) }}
         </div>
      {% endif %}

      <p>
      {{ 'review.info'|trans|raw }}
         </p>
      <button type="submit" class="btn btn-primary btn-block">{{ 'send'|trans }}</button>
      {{ form_end(form, {render_rest: false}) }}
   {% endif %}
</div>
