{{ header }}
<div class="container j-container {{ journal_class }}" id="container">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
      <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
  <style type="text/css">
  .ciname_fl {
    {% if reviewauthorfl_bgcolor %}
    background: {{ reviewauthorfl_bgcolor }};
    {% endif %}
    {% if reviewauthorfl_color %}
    color: {{ reviewauthorfl_color }};
    {% endif %}
    border-radius: {{ reviewauthorradius }}%;
    -webkit-border-radius: {{ reviewauthorradius }}%;
  }
  </style>
  {% if customcss %}<style type="text/css">{{ customcss }}</style>{% endif %}
  <div class="row">{{ column_left }}
    {% if theme_name == 'journal2' %}
      {{ column_right }}
    {% endif %}
    {% if column_left and column_right %}
      {% set class = 'col-sm-6 xl-50' %}
    {% elseif column_left or column_right %}
      {% set class = 'col-sm-9 xl-75' %}
    {% else %}
      {% set class = 'col-sm-12 xl-100' %}
    {% endif %}
    <div id="content" class="{{ class }}">{{ content_top }}
      <h2>{{ heading_title }}</h2>
      <p>{{ description }}</p>
      {% if reviewsortshow %}
      <div class="row">
        {% set mods = 0 %}
        {% if reviewimagefilters %} {% set mods = mods + 1 %} {% endif %}
        {% if sorts %} {% set mods = mods + 1 %} {% endif %}
        {% if limits %} {% set mods = mods + 1 %} {% endif %}
        {% if reviewsearch %} {% set mods = mods + 1 %} {% endif %}
        {% set colmd = 12 %}
        {% set jxl = 100 %}
        {% if mods %}
          {% set colmd = 12 / mods %}
          {% set jxl = 100 / mods %}
        {% endif %}

        {% if reviewimagefilters %}
          <div class="col-md-{{ colmd }} col-xs-12 xl-{{ jxl }} xs-100 imagefilter">
            <div class="form-group">
              <label class="control-label" for="input-imagefilter"><b>{{ text_imagefilter }}</b></label>
              <select  id="input-imagefilter" class="form-control" onchange="location = this.value;">
                {% for imagefilter_ in imagefilters %}
                  <option value="{{ imagefilter_.href }}" {% if imagefilter_.selected %}selected="selected"{% endif %}>{{ imagefilter_.text }}</option>
                {% endfor %}
              </select>
            </div>
          </div>
        {% endif %}

        {% if sorts %}
          <div class="col-md-{{ colmd }} col-xs-12 xl-{{ jxl }} xs-100 sort">
            <div class="form-group">
              <label class="control-label" for="input-sort"><b>{{ text_sort }}</b></label>
              <select id="input-sort" class="form-control" onchange="location = this.value;">
                {% for sorts_ in sorts %}
                  <option value="{{ sorts_.href }}" {% if sorts_.selected %}selected="selected"{% endif %}>{{ sorts_.text }}</option>
                {% endfor %}
              </select>
            </div>
          </div>
        {% endif %}
        {% if limits %}
          <div class="col-md-{{ colmd }} col-xs-12 xl-{{ jxl }} xs-100 limit">
            <div class="form-group">
              <label class="control-label" for="input-limit"><b>{{ text_limit }}</b></label>
              <select id="input-limit" class="form-control" onchange="location = this.value;">
                {% for limits_ in limits %}
                  <option value="{{ limits_.href }}" {% if limits_.selected %}selected="selected"{% endif %}>{{ limits_.text }}</option>
                {% endfor %}
              </select>
            </div>
          </div>
        {% endif %}
        {% if reviewsearch %}
          <div class="col-md-{{ colmd }} col-xs-12 xl-{{ jxl }} xs-100 cireviewsearch">
            <div class="form-group">
              <label class="control-label" for="input-cireviewsearch"><b>{{ text_cisearch }}</b></label>
              <div id="cireviewsearch" class="form-group input-group">
                <input type="text" name="cireviewsearch" value="{{ cireviewsearch }}" placeholder="{{ text_cisearch }}" class="form-control" id="input-cireviewsearch" /><span class="input-group-btn"><button type="button" class="btn btn-default"><i class="fa fa-search"></i></button></span>
              </div>
            </div>
          </div>
        {% endif %}
      </div>
      {% endif %}
      {% if reviews %}
        {{ reviews_view }}
      {% else %}
        <div class="row">
          <div class="col-sm-12 xl-100 xs-100">
             <h4 class="text-center">{{ text_no_reviews }}</h4>
          </div>
        </div>
      {% endif %}

      {% if promo_products %}
        <div class="row">
          <div class="col-sm-12 xl-100 xs-100">
            <h2 class="text-{{ reviewpromoalign }}">{{ text_promoproduct_title }}</h2>
            <ul class="list-inline list">
              {% for promo_product in promo_products %}
              <li>
                <div class="cireview-product-thumb">
                  <a href="{{ promo_product.href }}">
                    {% if promo_product.thumb %}
                      <img src="{{ promo_product.thumb }}" alt="{{ promo_product.name }}" class="img-responsive" /><br/>
                    {% endif %}
                    {% if reviewpromoproductnameshow %}
                      <h5>{{ promo_product.name }}</h5>
                    {% endif %}
                    {% if promo_product.rating %}
                      <div class="rating">
                        <!-- /*17-09-2019 half start starts*/ -->
                        {#
                        {% for i in 1..5 %}
                          {% if promo_product.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 %}
                        #}
                        {{ promo_product.html_rating }}
                        <!-- /*17-09-2019 half start ends*/ -->
                      </div>
                    {% endif %}
                    {% if promo_product.price %}
                      <p class="price">
                        {% if not promo_product.special %}
                          {{ promo_product.price }}
                        {% else %}
                          <span class="price-new">{{ promo_product.special }}</span> <span class="price-old">{{ promo_product.price }}</span>
                        {% endif %}
                        {% if promo_product.tax %}
                          <span class="price-tax">{{ text_tax }} {{ promo_product.tax }}</span>
                        {% endif %}
                      </p>
                    {% endif %}
                  </a>
                </div>
              </li>
              {% endfor %}
            </ul>
          </div>
        </div>
      {% endif %}

      {% if promo_categories %}
        <div class="row">
          <div class="col-sm-12 xl-100 xs-100">
            <h2 class="text-{{ reviewpromoalign }}">{{ text_promocategory_title }}</h2>
            <ul class="list-inline list">
              {% for promo_category in promo_categories %}
                <li>
                  <div class="cireview-product-thumb">
                    <a href="{{ promo_category.href }}">
                      {% if promo_category.thumb %}
                        <img src="{{ promo_category.thumb }}" alt="{{ promo_category.name }}" class="img-responsive" /><br/>
                      {% endif %}
                      {% if reviewpromocategorynameshow %}
                        <h5>{{ promo_category.name }}</h5>
                      {% endif %}
                    </a>
                  </div>
                </li>
              {% endfor %}
            </ul>
          </div>
        </div>
      {% endif %}

      {% if promo_manufacturers %}
        <div class="row">
          <div class="col-sm-12 xl-100 xs-100">
            <h2 class="text-{{ reviewpromoalign }}">{{ text_promomanufacturer_title }}</h2>
            <ul class="list-inline list">
              {% for promo_manufacturer in promo_manufacturers %}
                <li>
                  <div class="cireview-product-thumb">
                    <a href="{{ promo_manufacturer.href }}">
                      {% if promo_manufacturer.thumb %}
                        <img src="{{ promo_manufacturer.thumb }}" alt="{{ promo_manufacturer.name }}" class="img-responsive" /><br/>
                      {% endif %}
                      {% if reviewpromomanufacturernameshow %}
                        <h5>{{ promo_manufacturer.name }}</h5>
                      {% endif %}
                    </a>
                  </div>
                </li>
              {% endfor %}
            </ul>
          </div>
        </div>
      {% endif %}
      {{ content_bottom }}</div>
    {% if theme_name != 'journal2' %}
    {{ column_right }}
    {% endif %}
  </div>

  {% if reviewsortshow %}
    {% if reviewsearch %}
    <script type="text/javascript">
       /* Search */
      $('#cireviewsearch input[name=\'cireviewsearch\']').parent().find('button').on('click', function() {
        var url = $('base').attr('href') + 'index.php?route=extension/cireviewpro/cireviews';

        {% if filter_cireview_product_id %}
        url += '&cireview_product_id=' + encodeURIComponent('{{ filter_cireview_product_id }}');
        {% endif %}
        {% if filter_review_id %}
        url += '&review_id=' + encodeURIComponent('{{ filter_review_id }}');
        {% endif %}

        var value = $('#cireviewsearch input[name=\'cireviewsearch\']').val();
        if (value) {
          url += '&cireviewsearch=' + encodeURIComponent(value);
        }

        {% if reviewlimitshow %}
        url += '&limit=' + encodeURIComponent('{{ limit }}');
        {% endif %}
        {% if sorts %}
        url += '&sort=' + encodeURIComponent('{{ sort }}');
        url += '&order=' + encodeURIComponent('{{ order }}');
        {% endif %}
        {% if reviewimagefilters and dofilter_image  is not empty %}
        url += '&dofilter_image=' + encodeURIComponent('{{ dofilter_image }}');
        {% endif %}
        location = url;
      });

      $('#cireviewsearch input[name=\'cireviewsearch\']').on('keydown', function(e) {
        if (e.keyCode == 13) {
          $('#cireviewsearch input[name=\'cireviewsearch\']').parent().find('button').trigger('click');
        }
      });
    </script>
    {% endif %}
  {% endif %}
</div>
{{ footer }}