<div class="cireview-wrap">
  {% for review in reviews %}
    <div class="cireview-list cireviews {% if review.verified %}ci-verified{% endif %} {% if review.imp %}ci-imp{% endif %}">
      <div class="row flex">
        <div class="col-sm-4 col-md-4 col-xs-12 xl-30 sm-100 xs-100 all-rating-wrap">
          {% if review.product %}
            <h3>{{ text_product }}</h3>
            <div class="cireview-product-thumb">
               <a href="{{ review.product.href }}">
                <img src="{{ review.product.thumb }}" alt="{{ review.product.name }}" class="img-responsive" /> <br/>
                {{ review.product.name }}
                </a>
            </div>
          {% endif %}
        </div>
        {% set mdcol = 8 %}
        {% set smcol = 8 %}
        {% set jmdcol= 65 %}
        {% set jsmcol= 65 %}

        {% if (review.cireview_ratings) %}
          {% set mdcol = 5 %}
          {% set smcol = 4 %}
          {% set jmdcol= 40 %}
          {% set jsmcol= 25 %}
        {% endif %}
        <div class="col-sm-{{ smcol }} col-md-{{ mdcol }} col-xs-12 sm-100 md-{{ jmdcol }} xl-{{ jmdcol }} xs-100 all-rating-wrap">
          {% if review.verified %}
            <div class="verified">{{ text_verified }} <i class="fa fa-check-circle"></i></div>
          {% endif %}
          {% if review.author %}<h3>{% if review.author_fl %}<div class="ciname_fl">{{ review.author_fl }}</div>{% endif %} {% if not reviewpagetitletxthide %}{{ text_author }}{% endif %} {{ review.author }}{% if review.author_flag %}<span> - <img src="{{ review.author_flag }}" /></span>{% endif %}</h3>{% endif %}
          {% if review.reviewtitle %}
            <h4>{% if not reviewpagetitletxthide %}<label class="control-label">{{ text_title }}</label>{% endif %} {{ review.reviewtitle }}</h4>
          {% endif %}
          <div class="all-rating">
            <ul class="list-unstyled average rating">
              <li>{% if not reviewpagetitletxthide %}{{ text_date_added }}{% endif %} {{ review.date_added }}</li>
              {% if review.rating %}
                <li>
                  {% if not reviewpagetitletxthide %}{{ text_rating }}{% endif %}
                  <!-- /*17-09-2019 half start starts*/ -->
                  {#
                  {% for i in 1..ratingstars %}
                    {% if review.rating < i %}
                      <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
                    {% else %}
                      <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
                    {% endif %}
                  {% endfor %}
                  #}
                  {{ review.html_rating }}
                  <!-- /*17-09-2019 half start ends*/ -->
                  {% if reviewratingcount %}<span class="ciratingcount"> ({{ review.rating }}) </span>{% endif %}
                </li>
              {% endif %}
            </ul>
          </div>
          <p>{{ review.text }}</p>
          {% if reviewvote %}
            <span class="vote-result">
              {{ review.votes.after_text }}
            </span>
          {% endif %}
        </div>
        {% if review.cireview_ratings %}
          <div class="col-sm-4 col-md-3 col-xs-12 xl-30 sm-100 xs-100 all-rating-wrap">
            {% if review.cireview_ratings and review.cireview_ratings|length > 1 %}
              <h3>{{ text_allrating }}</h3>
              <div class="all-rating">
                <ul class="list-unstyled">
                  {% for cireview_rating in review.cireview_ratings %}
                    <li class="cireview_rating-{{ review.review_id }}-{{ cireview_rating.cireview_rating_id }} ">
                      {{ cireview_rating.ciratingtype_name }} :
                      <div class="stars rating">
                        <!-- /*17-09-2019 half start starts*/ -->
                        {#
                        {% for i in 1..ratingstars %}
                          {% if cireview_rating.rating < i %}
                            <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>
                          {% else %}
                            <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>
                          {% endif %}
                        {% endfor %}
                        #}
                        {{ cireview_rating.html_rating }}
                        <!-- /*17-09-2019 half start ends*/ -->
                        <span class="ciratingcount"> ({{ cireview_rating.show_rating }}) </span>
                      </div>
                    </li>
                  {% endfor %}
                </ul>
              </div>
            {% endif %}
          </div>
        {% endif %}
      </div>
      {% if review.attach_images %}
        <div class="row">
          <div class="col-sm-12 col-xs-12 xl-100 xs-100">
            {% if not reviewpagetitletxthide %}<h3>{{ text_attachments }}</h3>{% endif %}
            <ul class="list list-inline cireviewattach_images" id="cireviewattach_images-{{ review.review_id }}">
              {% for attach_image in review.attach_images %}
                <li id="cireviewattach_image-{{ attach_image.cireview_image_id }}">
                <a href="{{ attach_image.popup }}" title="{{ attach_image.title }}"> <img src="{{ attach_image.thumb }}" alt="{{ attach_image.alt }}" title="{{ attach_image.title }}" /> </a>
                </li>
              {% endfor %}
            </ul>
          </div>
        </div>
      {% endif %}
      {% if review.comment %}
        <div class="row">
          <div class="col-sm-12 col-xs-12 xl-100 xs-100">
            <div class="cireviewcomment">
              <label class="control-label">{{ text_replyby }}: {{ reviewreplyauthor }} </label> <br/>
              {{ review.comment }}
            </div>
          </div>
        </div>
      {% endif %}
    </div>
  {% endfor %}
  <div class="row j-margin">
    <div class="col-md-6 col-sm-12 xl-50 xs-100">
      <div class="text-left">{{ results }}</div>
    </div>
    <div class="col-md-6 col-sm-12 xl-50 xs-100">
      <div class="text-right">{{ pagination }}</div>
    </div>
  </div>
  <script type="text/javascript">
    if($.fn.magnificPopup) {
      $('.cireviewattach_images').each(function() {
        $(this).magnificPopup({
          type:'image',
          delegate: 'a',
          gallery: {
            enabled:true
          }
        });
      });
    }
  </script>
</div>