{% macro productStats(context) %}
  <div class="product-stats">
    <ul class="list-unstyled">
      {% if context.journal3_product_stock %}
        <li class="product-stock {{ context.journal3_product_stock_class }}"><b>{{ context.journal3_product_stock_text }}:</b> <span>{{ context.journal3_product_stock_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_manufacturer %}
        <li class="product-manufacturer"><b>{{ context.journal3_product_manufacturer_text }}:</b> <a href="{{ context.journal3_product_manufacturer_href }}">{{ context.journal3_product_manufacturer_value }}</a></li>
      {% endif %}
      {% if context.journal3_product_reward %}
        <li class="product-reward"><b>{{ context.journal3_product_reward_text }}:</b> <span>{{ context.journal3_product_reward_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_model %}
        <li class="product-model"><b>{{ context.journal3_product_model_text }}:</b> <span>{{ context.journal3_product_model_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_weight %}
        <li class="product-weight"><b>{{ context.journal3_product_weight_text }}:</b> <span>{{ context.journal3_product_weight_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_dimensions %}
        <li class="product-dimension"><b>{{ context.journal3_product_dimensions_text }}:</b> <span>{{ context.journal3_product_dimensions_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_sku %}
        <li class="product-sku"><b>{{ context.journal3_product_sku_text }}:</b> <span> {{ context.journal3_product_sku_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_upc %}
        <li class="product-upc"><b>{{ context.journal3_product_upc_text }}:</b> <span>{{ context.journal3_product_upc_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_ean %}
        <li class="product-ean"><b>{{ context.journal3_product_ean_text }}:</b> <span>{{ context.journal3_product_ean_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_jan %}
        <li class="product-jan"><b>{{ context.journal3_product_jan_text }}:</b> <span>{{ context.journal3_product_jan_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_isbn %}
        <li class="product-isbn"><b>{{ context.journal3_product_isbn_text }}:</b> <span>{{ context.journal3_product_isbn_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_mpn %}
        <li class="product-mpn"><b>{{ context.journal3_product_mpn_text }}:</b> <span>{{ context.journal3_product_mpn_value }}</span></li>
      {% endif %}
      {% if context.journal3_product_location %}
        <li class="product-location"><b>{{ context.journal3_product_location_text }}:</b> <span>{{ context.journal3_product_location_value }}</span></li>
      {% endif %}
    </ul>
    {% if context.journal3_product_manufacturer and context.journal3_product_manufacturer_display == 'image' %}
      <div class="brand-image product-manufacturer">
        <a href="{{ context.journal3_product_manufacturer_href }}">
          {% if context.journal3_product_manufacturer_image %}
          <img src="{{context.journal3_product_manufacturer_image }}" {% if context.journal3_product_manufacturer_image2x %}srcset="{{ context.journal3_product_manufacturer_image }} 1x, {{context.journal3_product_manufacturer_image2x }} 2x"{% endif %} alt="{{ context.manufacturer }}" width="{{ context.journal3.get('image_dimensions_manufacturer_logo.width') }}" height="{{ context.journal3.get('image_dimensions_manufacturer_logo.height') }}"/>
        {% endif %}
          <span>{{ context.manufacturer }}</span>
        </a>
      </div>
    {% endif %}
    {% if context.journal3_product_sold or context.journal3_product_views %}
      <div class="custom-stats">
        {% if context.journal3_product_sold %}
          <div class="product-sold">{{ context.journal3_product_sold }}</div>
        {% endif %}
        {% if context.journal3_product_views %}
          <div class="product-views">{{ context.journal3_product_views }}</div>
        {% endif %}
      </div>
    {% endif %}
  </div>
{% endmacro %}
{{ header }}
{% if journal3.get('pageTitlePosition') == 'top' %}
  <h1 class="title page-title {{ journal3.get('title_color_scheme') }}"><span class="page-title-text">{{ heading_title }}</span></h1>
{% endif %}
<div class="breadcrumbs {{ journal3.get('breadcrumbs_color_scheme') }}">
  <ul class="breadcrumb">
    {% for breadcrumb in breadcrumbs %}
      <li><a href="{{ breadcrumb.href }}">{{ breadcrumb.text }}</a></li>
    {% endfor %}
  </ul>
</div>
{{ journal3_top }}
<div id="product-product" class="container">
  <div class="row">{{ column_left }}
    {% if column_left and column_right %}
    {% set class = 'col-sm-6' %}
    {% elseif column_left or column_right %}
    {% set class = 'col-sm-9' %}
    {% else %}
    {% set class = 'col-sm-12' %}
    {% endif %}
    <div id="content" class="{{ class }}">
      {% if journal3.get('pageTitlePosition') == 'default' or journal3.is_quickview_popup %}
      <h1 class="title page-title {{ journal3.get('title_color_scheme') }}">{{ heading_title }}</h1>
      {% endif %}
      {{ content_top }}
      {{ journal3_product_tabs_blocks_content_top }}
      <div class="product-info {{ journal3.classes(journal3_product_classes) }}">
        {% if not journal3.is_options_popup %}
        <div class="product-left">
          <div class="product-left-wrapper">
            <div class="product-image direction-{{ journal3_images_additional_direction }} position-{{ journal3_images_additional_position }}">
              <div class="swiper main-image" data-options='{{ journal3.jsonAttrs(journal3_images_carousel) }}' {{ journal3_images_style }}>
                <div class="swiper-container" {% if journal3.is_rtl %}dir="rtl"{% endif %}>
                  <div class="swiper-wrapper">
                    {% for index, image in images %}
                      <div class="swiper-slide" {% if journal3_images_gallery %}data-gallery=".lightgallery-product-images" data-index="{{ index }}"{% endif %}>
                        {% if index and journal3_image_placeholder %}
                          <img class="lazyload" src="{{ journal3_image_placeholder }}" data-src="{{ image.thumb }}" {% if image.thumb2x %}data-srcset="{{ image.thumb }} 1x, {{ image.thumb2x }} 2x"{% endif %} width="{{ journal3_image_thumb_width }}" height="{{ journal3_image_thumb_height }}" alt="{{ heading_title }}" title="{{ heading_title }}" data-largeimg="{{ image.popup }}"/>
                        {% else %}
                          <img src="{{ image.thumb }}" {% if image.thumb2x %}srcset="{{ image.thumb }} 1x, {{ image.thumb2x }} 2x"{% endif %} width="{{ journal3_image_thumb_width }}" height="{{ journal3_image_thumb_height }}" alt="{{ heading_title }}" title="{{ heading_title }}" data-largeimg="{{ image.popup }}"/>
                        {% endif %}
                      </div>
                    {% endfor %}
                  </div>
                </div>
                <div class="swiper-controls">
                  <div class="swiper-buttons">
                    <div class="swiper-button-prev"></div>
                    <div class="swiper-button-next"></div>
                  </div>
                  <div class="swiper-pagination"></div>
                </div>
                {% if journal3_product_labels.default %}
                  <div class="product-labels">
                    {% for id, label in journal3_product_labels.default %}
                      <span class="product-label product-label-{{ id }} product-label-{{ label.display }} product-label-{{ label.positionDefault }} {{ journal3.classes(label.classes) }}"><strong>{{ label.label }}</strong></span>
                    {% endfor %}
                  </div>
                {% endif %}
              </div>
              {% if journal3_images_additional %}
                {% if journal3_images_additional_carousel %}
                  <div class="swiper additional-images" data-options='{{ journal3.jsonAttrs(journal3_images_additional_carousel_options) }}' {{ journal3_images_additional_style }}>
                    <div class="swiper-container" {% if journal3.is_rtl %}dir="rtl"{% endif %}>
                      <div class="swiper-wrapper">
                        {% for index, image in journal3_images_additional %}
                          <div class="swiper-slide additional-image {% if loop.first %}swiper-slide-active{% endif %}" data-index="{{ index }}">
                            <img src="{{ image.additional }}" {% if image.additional2x %}srcset="{{ image.additional }} 1x, {{ image.additional2x }} 2x"{% endif %} width="{{ journal3.get('image_dimensions_additional.width') }}" height="{{ journal3.get('image_dimensions_additional.height') }}" alt="{{ heading_title }}" title="{{ heading_title }}"/>
                          </div>
                        {% endfor %}
                      </div>
                    </div>
                    <div class="swiper-buttons">
                      <div class="swiper-button-prev"></div>
                      <div class="swiper-button-next"></div>
                    </div>
                    <div class="swiper-pagination"></div>
                  </div>
                {% else %}
                  <div class="additional-images">
                    {% for index, image in journal3_images_additional %}
                      <div class="additional-image" data-index="{{ index }}">
                        <img src="{{ image.additional }}" {% if image.additional2x %}srcset="{{ image.additional }} 1x, {{ image.additional2x }} 2x"{% endif %} width="{{ journal3.get('image_dimensions_additional.width') }}" height="{{ journal3.get('image_dimensions_additional.height') }}" alt="{{ heading_title }}" title="{{ heading_title }}"/>
                      </div>
                    {% endfor %}
                  </div>
                {% endif %}
              {% endif %}
            </div>

            {% if journal3_images_gallery %}
              <div class="lightgallery lightgallery-product-images" data-images='{{ journal3_images_gallery|json_encode|e }}' data-options='{{ journal3.jsonAttrs(journal3_images_gallery_options) }}'></div>
            {% endif %}

            {{ journal3_product_tabs_blocks_image }}

            {% if description and journal3.is_quickview_popup and journal3.get('quickviewDescription') and (journal3.get('quickviewDescriptionPosition') == 'image') %}
              <div class="description {{ quickviewExpand }}">
                <div class="expand-block">
                  <div class="expand-content">{{ description }}{% if journal3.get('quickviewExpandButton') %}<div class="block-expand-overlay"><a class="block-expand btn" role="button" aria-label="{{ journal3.get('globalExpandButtonText') }}"></a></div>{% endif %}</div>
                </div>
              </div>
            {% endif %}

            {% if tags and not journal3.is_popup and (journal3.get(stylePrefix ~ 'TagsPosition') == 'image') %}
              <div class="tags">
                <span class="tags-title">{{ text_tags }}</span>
                {% for tag in tags %}
                  <a href="{{ tag.href }}">{{ tag.tag }}</a>
                  {% if not loop.last %}<b>,</b>{% endif %}
                {% endfor %}
              </div>
            {% endif %}

          </div>
        </div>
        {% endif %}
        <div class="product-right">
          <div class="product-right-wrapper">
              <div id="product" class="product-details">
                {% if not journal3.is_options_popup %}
                  <div class="title page-title">{{ heading_title }}</div>
                {% endif %}

                {{ journal3_product_tabs_blocks_top }}

                {% if description and journal3.is_quickview_popup and journal3.get('quickviewDescription') and (journal3.get('quickviewDescriptionPosition') == 'top') %}
                  <div class="description {{ quickviewExpand }}">
                    <div class="expand-block">
                      <div class="expand-content">{{ description }}{% if journal3.get('quickviewExpandButton') %}<div class="block-expand-overlay"><a class="block-expand btn" role="button" aria-label="{{ journal3.get('globalExpandButtonText') }}"></a></div>{% endif %}</div>
                    </div>
                  </div>
                {% endif %}

                {% if journal3_product_labels.group_outside  %}
                  <div class="product-labels-outside">
                    {% for id, label in journal3_product_labels.group_outside %}
                      <span class="product-label product-label-{{ id }} product-label-{{ label.display }} product-label-{{ label.positionDefault }} {{ journal3.classes(label.classes) }}"><strong><a class="label-link" {% if label.link.href %}href="{{ label.link.href }}"{%  endif %} {{ journal3.linkAttrs(label.link) }} aria-hidden="true" tabindex="-1">{{ label.label }}</a></strong></span>
                    {% endfor %}
                  </div>
                {% endif %}

                {% if journal3_product_stats_position == 'default' %}
                  {{ _self.productStats(_context) }}
                {% endif %}

                {% if review_status and not journal3.is_popup %}
                  <div class="rating rating-page">
                    <div class="rating-stars">
                      {% for i in 1..5 %}
                        {% if rating < i %}
                          <span class="fa fa-stack">
                    <em class="fa fa-star-o fa-stack-1x"></em>
                  </span>{% else %}
                          <span class="fa fa-stack">
                    <em class="fa fa-star fa-stack-1x"></em>
                    <em class="fa fa-star-o fa-stack-1x"></em>
                  </span>
                        {% endif %}
                      {% endfor %}
                    </div>
                    <div class="review-links">
                      <a role="button">{{ reviews }}</a>
                      <b>{{ journal3.get(stylePrefix ~ 'RatingSeparator') }}</b>
                      <a role="button">{{ text_write }}</a>
                    </div>
                  </div>
                {% endif %}

                {% if journal3_product_countdown %}
                  <div class="countdown-wrapper">
                    {% if journal3.get(stylePrefix ~ 'CountdownText') %}
                      <h5 class="countdown-title title">{{ journal3.get(stylePrefix ~ 'CountdownText') }}</h5>
                    {% endif %}
                    <div class="countdown" data-date="{{ journal3_product_countdown }}">
                      <div><em class="fa fa-spinner fa-spin"></em><span>{{ journal3.get('countdownDay') }}</span></div>
                      <div><em class="fa fa-spinner fa-spin"></em><span>{{ journal3.get('countdownHour') }}</span></div>
                      <div><em class="fa fa-spinner fa-spin"></em><span>{{ journal3.get('countdownMin') }}</span></div>
                      <div><em class="fa fa-spinner fa-spin"></em><span>{{ journal3.get('countdownSec') }}</span></div>
                    </div>
                  </div>
                {% endif %}

                {% if price and not journal3.is_options_popup %}
                  <div class="product-price-group">
                    <div class="price-wrapper">
                      {% if journal3_product_labels.price  %}
                        <div class="product-labels-price">
                          {% for id, label in journal3_product_labels.price %}
                            <span class="product-label product-label-{{ id }} product-label-{{ label.display }} product-label-{{ label.positionDefault }} {{ journal3.classes(label.classes) }}"><strong>{{ label.label }}</strong></span>
                          {% endfor %}
                        </div>
                      {% endif %}
                      <div class="price-group">
                        {% if not special %}
                          <div class="product-price">{{ price }}</div>
                        {% else %}
                          <div class="product-price-new">{{ special }}</div>
                          <div class="product-price-old">{{ price }}</div>
                        {% endif %}
                      </div>
                      {% if tax %}
                        <div class="product-tax">{{ text_tax }} {{ tax }}</div>
                      {% endif %}
                      {% if points %}
                        <div class="product-points">{{ text_points }} {{ points }}</div>
                      {% endif %}

                      {% if discounts %}
                        <div class="discounts">
                          {% for discount in discounts %}
                            <div class="product-discount">{{ discount.quantity }}{{ text_discount }}{{ discount.price }}</div>
                          {% endfor %}
                        </div>
                      {% endif %}
                    </div>
                    {% if journal3_product_stats_position == 'price' %}
                      {{ _self.productStats(_context) }}
                    {% endif %}
                  </div>
                {% endif %}

                {% if options %}
                  <div class="product-options">
                    <h3 class="options-title title">{{ text_option }}</h3>
                    {% for option in options %}
                      {% if option.type == 'select' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if journal3.get(stylePrefix ~ 'OptionsPushSelect') %}push-option{% endif %}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <select name="option[{{ option.product_option_id }}]" id="input-option{{ option.product_option_id }}" class="form-control">
                            <option value="">{{ text_select }}</option>
                            {% for option_value in option.product_option_value %}
                              <option value="{{ option_value.product_option_value_id }}">{{ option_value.name }}
                                {% if option_value.price and optionPrice %}
                                  ({{ option_value.price_prefix }}{{ option_value.price }})
                                {% endif %} </option>
                            {% endfor %}
                          </select>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'radio' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if journal3.get(stylePrefix ~ 'OptionsPushRadio') %}push-option{% endif %}">
                          <label class="control-label">{{ option.name }}</label>
                          <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                              <div class="radio">
                                <label>
                                  <input type="radio" name="option[{{ option.product_option_id }}]" value="{{ option_value.product_option_value_id }}" title="{{ option_value.name }}" aria-label="{{ option_value.name }}" />
                                  <span class="option-wrapper {% if option_value.image %}push-option-image{% endif %}">
                    {% if option_value.image %} <img src="{{ option_value.image }}" srcset="{{ option_value.image }} 1x, {{ option_value.image2x }} 2x" width="{{ journal3_image_options_width }}" height="{{ journal3_image_options_height }}" alt="{{ option_value.name }} {% if option_value.price and optionPrice %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" {% if journal3.is_desktop %}data-toggle="tooltip-hover" data-tooltip-class="push-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'PushTooltipPosition') }}"{% endif%} title="{{ option_value.name }} {% if option_value.price and optionPrice %} ({{ option_value.price_prefix }}{{ option_value.price }}) {% endif %}"> {% endif %}
                    <span class="option-value">
                    {{ option_value.name }}
                      {% if option_value.price and optionPrice %}
                        <span class="option-price">
                        ({{ option_value.price_prefix }}{{ option_value.price }})
                      </span>
                      {% endif %}
                  </span>
                  </span>
                                </label>
                              </div>
                            {% endfor %} </div>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'checkbox' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }} {% if journal3.get(stylePrefix ~ 'OptionsPushCheckbox') %}push-option{% endif %}">
                          <label class="control-label">{{ option.name }}</label>
                          <div id="input-option{{ option.product_option_id }}"> {% for option_value in option.product_option_value %}
                              <div class="checkbox">
                                <label>
                                  <input type="checkbox" name="option[{{ option.product_option_id }}][]" value="{{ option_value.product_option_value_id }}" title="{{ option_value.name }}" aria-label="{{ option_value.name }}" />
                                  <span class="option-wrapper {% if option_value.image %}push-option-image{% endif %}">
                    {% if option_value.image %} <img src="{{ option_value.image }}" srcset="{{ option_value.image }} 1x, {{ option_value.image2x }} 2x" width="{{ journal3_image_options_width }}" height="{{ journal3_image_options_height }}" alt="{{ option_value.name }} {% if option_value.price and optionPrice %} {{ option_value.price_prefix }} {{ option_value.price }} {% endif %}" {% if journal3.is_desktop %}data-toggle="tooltip-hover" data-tooltip-class="push-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'PushTooltipPosition') }}"{% endif%} title="{{ option_value.name }} {% if option_value.price and optionPrice %} ({{ option_value.price_prefix }}{{ option_value.price }}) {% endif %}"> {% endif %}
                    <span class="option-value">
                    {{ option_value.name }}
                      {% if option_value.price and optionPrice %}
                        <span class="option-price">({{ option_value.price_prefix }}{{ option_value.price }})</span>
                      {% endif %}
                  </span>
                  </span>
                                </label>
                              </div>
                            {% endfor %} </div>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'text' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control" >
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'textarea' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <textarea name="option[{{ option.product_option_id }}]" rows="5" placeholder="{{ option.name }}" id="input-option{{ option.product_option_id }}" class="form-control">{{ option.value }}</textarea>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'file' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label">{{ option.name }}</label>
                          {% if journal3_is_oc4 %}
                            <button type="button" id="button-upload{{ option.product_option_id }}" data-oc-toggle="upload" data-oc-url="{{ upload }}" data-oc-target="#input-option{{ option.product_option_id }}" data-oc-size-max="{{ config_file_max_size }}" data-oc-size-error="{{ error_upload_size }}" class="btn btn-default btn-block  upload-btn"><i class="fa-solid fa-upload"></i> {{ button_upload }}</button>
                            <input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id }}"/>
                          {% else %}
                            <button type="button" id="button-upload{{ option.product_option_id }}" data-loading-text="{{ text_loading }}" class="btn btn-default btn-block  upload-btn"><i class="fa fa-upload"></i> {{ button_upload }}</button>
                            <input type="hidden" name="option[{{ option.product_option_id }}]" value="" id="input-option{{ option.product_option_id }}" >
                          {% endif %}
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'date' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <div class="input-group {% if not journal3_is_oc4 %}date{% endif %}" data-picker-class="product-options pp-date-time-picker">
                            <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD" id="input-option{{ option.product_option_id }}" class="form-control {% if journal3_is_oc4 %}date{% endif %}" />
                            <span class="input-group-btn">
              <button class="btn btn-default" type="button"><i class="fa fa-calendar"></i></button>
              </span></div>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'datetime' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <div class="input-group {% if not journal3_is_oc4 %}datetime{% endif %}" data-picker-class="product-options pp-date-time-picker">
                            <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="YYYY-MM-DD HH:mm" id="input-option{{ option.product_option_id }}" class="form-control {% if journal3_is_oc4 %}datetime{% endif %}" />
                            <span class="input-group-btn">
              <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
              </span></div>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                      {% if option.type == 'time' %}
                        <div class="form-group{% if option.required %} required {% endif %} product-option-{{ option.type }}">
                          <label class="control-label" for="input-option{{ option.product_option_id }}">{{ option.name }}</label>
                          <div class="input-group {% if not journal3_is_oc4 %}time{% endif %}" data-picker-class="product-options pp-date-time-picker">
                            <input type="text" name="option[{{ option.product_option_id }}]" value="{{ option.value }}" data-date-format="HH:mm" id="input-option{{ option.product_option_id }}" class="form-control {% if journal3_is_oc4 %}time{% endif %}" />
                            <span class="input-group-btn">
              <button type="button" class="btn btn-default"><i class="fa fa-calendar"></i></button>
              </span></div>
                          {% if journal3_is_oc4 %}
                          <div id="error-option-{{ option.product_option_id }}" class="invalid-feedback"></div>
                          {% endif %}
                        </div>
                      {% endif %}
                    {% endfor %}
                  </div>
                {% endif %}

                {% if recurrings %}
                  <h3 class="title recurring-title">{{ text_payment_recurring }}</h3>
                  <div class="form-group required">
                    <select name="recurring_id" class="form-control">
                      <option value="">{{ text_select }}</option>
                      {% for recurring in recurrings %}
                        <option value="{{ recurring.recurring_id }}">{{ recurring.name }}</option>
                      {% endfor %}
                    </select>
                    <div class="help-block" id="recurring-description"></div>
                  </div>
                {% endif %}

                {% if journal3.get('catalogCartStatus') or journal3.get('catalogWishlistStatus') or journal3.get('catalogCompareStatus') or (journal3_product_extra_buttons and not journal3.is_popup) %}
                  <div class="button-group-page">
                    <div class="buttons-wrapper">
                      <div class="stepper-group cart-group">
                        {% if journal3.get('catalogCartStatus') %}
                          <label class="control-label" for="product-quantity">{{ entry_qty }}</label>
                          <div class="stepper">
                            <button aria-label="-" class="fa fa-angle-down"></button>
                            <input id="product-quantity" type="text" name="quantity" value="{{ journal3_product_quantity > 0 ? journal3_product_quantity : minimum }}" data-minimum="{{ minimum }}" class="form-control"/>
                            <input id="product-id" type="hidden" name="product_id" value="{{ product_id }}" />
                            <button aria-label="+" class="fa fa-angle-up"></button>
                          </div>
                          <a id="button-cart" role="button" aria-label="{{ journal3_button_cart }}" data-loading-text="<span class='btn-text'>{{ journal3_button_cart }}</span>" class="btn btn-cart" {% if journal3.is_desktop and (journal3.get(stylePrefix ~ 'CartDisplay') == "icon") and (journal3.get(stylePrefix ~ 'CartTooltipStatus')) %} data-toggle="tooltip-hover" data-tooltip-class="pp-cart-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'CartTooltipPosition') }}" title="{{ journal3_button_cart }}" {% endif %}><span class="btn-text">{{ journal3_button_cart }}</span></a>
                        {% endif %}
                      </div>
                      {% if journal3_product_extra_buttons and not journal3.is_popup %}
                        <div class="extra-group">
                          {% for id, extra_button in journal3_product_extra_buttons %}
                            <a class="btn btn-extra btn-extra-{{ id }} btn-{{ loop.index }}-extra" {% if journal3.is_desktop and (journal3.get(stylePrefix ~ 'Extra' ~ loop.index ~ 'ButtonDisplay') == "icon") and (journal3.get(stylePrefix ~ 'ExtraTooltipStatus')) %} data-toggle="tooltip-hover" data-tooltip-class="extra-tooltip pp-extra-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'ExtraTooltipPosition') }}" title="{{ extra_button.label }}" {% endif %} {% if extra_button.action == 'quickbuy' %}data-quick-buy{% endif %} {% if extra_button.action == 'link' and extra_button.link.href %}href="{{ extra_button.link.href }}" {{ journal3.linkAttrs(extra_button.link) }} data-product_id="{{ product_id }}" {% else %}role="button" {% endif %} data-loading-text="<span class='btn-text'>{{ extra_button.label }}</span>"><span class="btn-text">{{ extra_button.label }}</span></a>
                          {% endfor %}
                        </div>
                      {% endif %}
                      {% if journal3.get('catalogWishlistStatus') or journal3.get('catalogCompareStatus') or journal3.is_quickview_popup %}
                        <div class="wishlist-compare">
                          {% if not journal3.is_options_popup %}
                            {% if journal3.get('catalogWishlistStatus') %}
                              <a class="btn btn-wishlist" role="button" aria-label="{{ button_wishlist }}" {% if journal3.is_desktop and (journal3.get(stylePrefix ~ 'WishlistDisplay') == "icon") and (journal3.get(stylePrefix ~ 'WishlistTooltipStatus')) %} data-toggle="tooltip-hover" data-tooltip-class="pp-wishlist-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'WishlistTooltipPosition') }}" title="{{ button_wishlist }}" {% endif %} onclick="parent.wishlist.add({{ product_id }});"><span class="btn-text">{{ button_wishlist }}</span></a>
                            {% endif %}
                            {% if journal3.get('catalogCompareStatus') %}
                              <a class="btn btn-compare" role="button" aria-label="{{ button_compare }}" {% if journal3.is_desktop and (journal3.get(stylePrefix ~ 'CompareDisplay') == "icon") and (journal3.get(stylePrefix ~ 'CompareTooltipStatus')) %} data-toggle="tooltip-hover" data-tooltip-class="pp-compare-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'CompareTooltipPosition') }}" title="{{ button_compare }}" {% endif %} onclick="parent.compare.add({{ product_id }});"><span class="btn-text">{{ button_compare }}</span></a>
                            {% endif %}
                          {% endif %}
                        </div>
                        {% if journal3.is_quickview_popup %}
                          <a class="btn btn-more-details" href="{{ journal3_view_more_url }}" target="_top" {% if journal3.is_desktop and (journal3.get(stylePrefix ~ 'MoreDetailsDisplay') == "icon") and (journal3.get(stylePrefix ~ 'MoreDetailsTooltipStatus')) %} data-toggle="tooltip-hover" data-tooltip-class="more-details-tooltip" data-placement="{{ journal3.get(stylePrefix ~ 'MoreDetailsTooltipPosition') }}" title="{{ journal3.get('quickviewExtraText') }}" {% endif %}><span class="btn-text">{{ journal3.get('quickviewExtraText') }}</span></a>
                        {% endif %}
                      {% endif %}
                    </div>
                  </div>
                {% endif %}

                {% if minimum > 1 %}
                  <div class="minimum alert alert-info"><i class="fa fa-info-circle"></i> {{ text_minimum }}</div>
                {% endif %}

                {{ journal3_product_tabs_blocks_details }}
              </div>
            {{ journal3_product_tabs_blocks_bottom }}

            {% if tags and not journal3.is_popup and (journal3.get(stylePrefix ~ 'TagsPosition') == 'details') %}
              <div class="tags">
                <span class="tags-title">{{ text_tags }}</span>
                {% for tag in tags %}
                  <a href="{{ tag.href }}">{{ tag.tag }}</a>
                  {% if not loop.last %}<b>,</b>{% endif %}
                {% endfor %}
              </div>
            {% endif %}

{#              {% if not journal3.is_popup and (journal3.get(stylePrefix ~ 'PricePosition') or journal3.get(stylePrefix ~ 'ButtonsPosition')) %}#}
{#                <div class="product-side-position"></div>#}
{#                <script>#}
{#                  (function () {#}
{#                    const $psp = document.querySelector('.product-side-position');#}
{#                    {% if journal3.get(stylePrefix ~ 'PricePosition') %}#}
{#                    $psp.appendChild(document.querySelector('.product-price-group'));#}
{#                    {% endif %}#}
{#                    {% if journal3.get(stylePrefix ~ 'ButtonsPosition') %}#}
{#                    $psp.appendChild(document.querySelector('.button-group-page'));#}
{#                    {% endif %}#}
{#                  })();#}
{#                </script>#}
{#              {% endif %}#}
          </div>
        </div>
      </div>

      {% if description and journal3.is_quickview_popup and journal3.get('quickviewDescription') and (journal3.get('quickviewDescriptionPosition') == 'default') %}
        <div class="description {{ quickviewExpand }}">
          <div class="expand-block">
            <div class="expand-content">{{ description }}{% if journal3.get('quickviewExpandButton') %}<div class="block-expand-overlay"><a class="block-expand btn" role="button" aria-label="{{ journal3.get('globalExpandButtonText') }}"></a></div>{% endif %}</div>
          </div>
        </div>
      {% endif %}

      {{ journal3_product_tabs_blocks_default }}

      {% if tags and not journal3.is_popup and (journal3.get(stylePrefix ~ 'TagsPosition') == 'default') %}
      <div class="tags">
        <span class="tags-title">{{ text_tags }}</span>
        {% for tag in tags %}
          <a href="{{ tag.href }}">{{ tag.tag }}</a>
          {% if not loop.last %}<b>,</b>{% endif %}
        {% endfor %}
      </div>
      {% endif %}
      {{ content_bottom }}</div>
    {{ column_right }}</div>
</div>
<script>
  // calculate vertical images height
  (function () {
    const $img = document.querySelector('.direction-vertical .main-image .swiper-slide img');
    const $ad = document.querySelector('.direction-vertical .additional-images');

    if ($img && $ad) {
      $ad.style.height = $img.offsetHeight + 'px';
    }
  })();
</script>
{% if journal3_is_oc3 %}
<script type="text/javascript"><!--
$('select[name=\'recurring_id\'], input[name="quantity"]').change(function(){
	$.ajax({
		url: 'index.php?route=product/product/getRecurringDescription',
		type: 'post',
		data: $('input[name=\'product_id\'], input[name=\'quantity\'], select[name=\'recurring_id\']'),
		dataType: 'json',
		beforeSend: function() {
			$('#recurring-description').html('');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();

			if (json['success']) {
				$('#recurring-description').html(json['success']);
			}
		}
	});
});
//--></script>
{% endif %}
<script type="text/javascript"><!--
$('#button-cart, [data-quick-buy]').on('click', function () {
  var $btn = $(this);
	$.ajax({
		url: 'index.php?route=checkout/cart{{ constant('JOURNAL3_ROUTE_SEPARATOR') }}add{% if journal3_is_oc4 %}&language={{ language }}{% endif %}',
		type: 'post',
		data: $(
      '#product .button-group-page input[type=\'text\'], #product .button-group-page input[type=\'hidden\'], #product .button-group-page input[type=\'radio\']:checked, #product .button-group-page input[type=\'checkbox\']:checked, #product .button-group-page select, #product .button-group-page textarea, ' +
      '#product .product-options input[type=\'text\'], #product .product-options input[type=\'hidden\'], #product .product-options input[type=\'radio\']:checked, #product .product-options input[type=\'checkbox\']:checked, #product .product-options select, #product .product-options textarea, ' +
      '#product select[name="recurring_id"]'
    ),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').jbutton('loading');
		},
		complete: function() {
			$('#button-cart').jbutton('reset');
		},
		success: function(json) {
			$('.alert-dismissible, .text-danger').remove();
			$('.form-group').removeClass('has-error');
      $('#product').find('.is-invalid').removeClass('is-invalid');
      $('#product').find('.invalid-feedback').removeClass('d-block');

			if (json['error']) {
        {% if journal3_is_oc4 %}
        for (key in json['error']) {
          $('#input-' + key.replaceAll('_', '')).closest('.form-group').addClass('has-error');
          $('#error-' + key.replaceAll('_', '-')).html(json['error'][key]).addClass('d-block');
        }
        {% else %}
        if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));

						if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}

				if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}

				// Highlight any found errors
				$('.text-danger').parent().addClass('has-error');

        {% endif %}

        try {
          $('html, body').animate({ scrollTop: $('.form-group.has-error').offset().top - $('header').height() - 20 }, 'slow');
        } catch (e) {
        }
			}

			if (json['success']) {
        if ($('html').hasClass('popup-options')) {
          parent.$(".popup-options .popup-close").trigger('click');
        }

        if (json['notification']) {
          parent.show_notification(json['notification']);
        } else {
          parent.$('#content').parent().before('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + ' <button type="button" class="close" data-dismiss="alert">&times;</button></div>');
        }

        parent.$('#cart-total').html(json['total']);
        parent.$('#cart-items,.cart-badge').html(json['items_count']);

        if (json['items_count']) {
          parent.$('#cart-items,.cart-badge').removeClass('count-zero');
          parent.$('#cart').addClass('cart-has-items');
        } else {
          parent.$('#cart-items,.cart-badge').addClass('count-zero');
          parent.$('#cart').removeClass('cart-has-items');
        }

        if (Journal['scrollToTop']) {
          parent.$('html, body').animate({ scrollTop: 0 }, 'slow');
        }

        parent.$('.cart-content ul').load('index.php?route=common/cart{{ constant('JOURNAL3_ROUTE_SEPARATOR') }}info{% if journal3_is_oc4 %}&language={{ language }}{% endif %} ul li');

        if (window.location.href.indexOf('quick_buy=true') !== -1) {
          parent.location.href = Journal['checkoutUrl'];
        }

        if ($btn.data('quick-buy') !== undefined) {
          location = Journal['checkoutUrl'];
        }

        if (parent.window['_QuickCheckout']) {
          parent.window['_QuickCheckout'].save();
        }

        if (json['redirect']) {
          parent.location.href = json['redirect'];
        }
      }
		},
        error: function(xhr, ajaxOptions, thrownError) {
            alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
        }
	});
});
//--></script>
{% if journal3_is_oc3 %}
<script type="text/javascript"><!--
$('.date').datetimepicker({
	language: '{{ datepicker }}',
	pickTime: false
});

$('.datetime').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: true,
	pickTime: true
});

$('.time').datetimepicker({
	language: '{{ datepicker }}',
	pickDate: false
});

$('button[id^=\'button-upload\']').on('click', function() {
	var node = this;

	$('#form-upload').remove();

	$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input type="file" name="file" /></form>');

	$('#form-upload input[name=\'file\']').trigger('click');

	if (typeof timer != 'undefined') {
    	clearInterval(timer);
	}

	timer = setInterval(function() {
		if ($('#form-upload input[name=\'file\']').val() != '') {
			clearInterval(timer);

			$.ajax({
				url: 'index.php?route=tool/upload',
				type: 'post',
				dataType: 'json',
				data: new FormData($('#form-upload')[0]),
				cache: false,
				contentType: false,
				processData: false,
				beforeSend: function() {
					$(node).button('loading');
				},
				complete: function() {
					$(node).button('reset');
				},
				success: function(json) {
					$('.text-danger').remove();

					if (json['error']) {
						$(node).parent().find('input').after('<div class="text-danger">' + json['error'] + '</div>');
					}

					if (json['success']) {
						alert(json['success']);

						$(node).parent().find('input').val(json['code']);
					}
				},
				error: function(xhr, ajaxOptions, thrownError) {
					alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
				}
			});
		}
	}, 500);
});
//--></script>
{% endif %}
<script type="text/javascript"><!--
{% if journal3_is_oc3 %}
$(function () {
  $('#review').delegate('.pagination a', 'click', function(e) {
    e.preventDefault();

    $('#review').fadeOut('slow');

    $('#review').load(this.href);

    $('#review').fadeIn('slow');
  });

  $('#review').load('index.php?route=product/product/review&product_id={{ product_id }}');

  $('#button-review').on('click', function() {
    $.ajax({
      url: 'index.php?route=product/product{{ constant('JOURNAL3_ROUTE_SEPARATOR') }}write&product_id={{ product_id }}',
      type: 'post',
      dataType: 'json',
      data: $("#form-review").serialize(),
      beforeSend: function() {
        $('#button-review').button('loading');
      },
      complete: function() {
        $('#button-review').button('reset');
      },
      success: function(json) {
        $('.alert-dismissible').remove();

        if (json['error']) {
          $('#review').after('<div class="alert alert-danger alert-dismissible"><i class="fa fa-exclamation-circle"></i> ' + json['error'] + '</div>');
        }

        if (json['success']) {
          $('#review').after('<div class="alert alert-success alert-dismissible"><i class="fa fa-check-circle"></i> ' + json['success'] + '</div>');

          $('input[name=\'name\']').val('');
          $('textarea[name=\'text\']').val('');
          $('input[name=\'rating\']:checked').prop('checked', false);
        }
      }
    });
  });
});
{% endif %}

$(document).ready(function() {
	$('.thumbnails').magnificPopup({
		type:'image',
		delegate: 'a',
		gallery: {
			enabled: true
		}
	});
});

$(document).ready(function () {
  $('.review-links a').on('click', function () {
    var $review = $('#review');
    if ($review.length) {
      $('a[href="#' + $review.closest('.module-item').attr('id') + '"]').trigger('click');
      $('a[href="#' + $review.closest('.tab-pane').attr('id') + '"]').trigger('click');
      $('a[href="#' + $review.closest('.panel-collapse').attr('id') + '"]').trigger('click');
      $review.closest('.expand-block').find('.block-expand.btn').trigger('click');

      $([document.documentElement, document.body]).animate({
        scrollTop: $review.offset().top - $('header').height() - 20
      }, 200);
    }
  });

  $('#read-more-desc').on('click', function () {
    var $desc = $('.product-extra-description');
    if ($desc.length) {
      $('a[href="#' + $desc.closest('.module-item').attr('id') + '"]').trigger('click');
      $('a[href="#' + $desc.closest('.tab-pane').attr('id') + '"]').trigger('click');
      $('a[href="#' + $desc.closest('.panel-collapse').attr('id') + '"]').trigger('click');
      $desc.find('.expand-block').find('.block-expand.btn').trigger('click');

      $([document.documentElement, document.body]).animate({
        scrollTop: $desc.offset().top - $('header').height() - 20
      }, 200);
    }
  });
});
//--></script>
{{ journal3_rich_snippets }}
{{ footer }} 
