{% if product.images|length > 1 %}
{# <div class="ui divider"></div> #}
{{ sylius_template_event('sylius.shop.product.show.before_thumbnails', {'product': product}) }}
<div>
<div id="gallery-right-images-mobile">
{% set imageCount = 0 %}
{% for image in product.images %}
{% if imageCount < 4 %}
{% set path = image.path is not null ? image.path|imagine_filter('sylius_shop_product_large_thumbnail') : asset('assets/shop/img/200x200.png') %}
<div id="card-product-show-right-mobile">
{% if product.isConfigurable() and product.enabledVariants|length > 0 %}
{% include '@SyliusShop/Product/Show/_imageVariants.html.twig' %}
{% endif %}
<a href="{{ image.path|imagine_filter('sylius_shop_product_original') }}" data-lightbox="sylius-product-image">
<img src="{{ path }}" data-large-thumbnail="{{ image.path|imagine_filter('sylius_shop_product_large_thumbnail') }}" alt="{{ product.name }}" />
</a>
</div>
{% set imageCount = imageCount + 1 %}
{% endif %}
{% endfor %}
</div>
<div class="points-last-article">
{% set imageCount = 0 %}
<span class="point active" onclick="changeImage(1)"></span>
{% for image in product.images %}
{% if loop.index > 1 and imageCount < 4 %}
{# {{ dump(loop.index) }}#}
<span class="point" onclick="changeImage({{ loop.index}})"></span>
{% set imageCount = imageCount + 1 %}
{% endif %}
{% endfor %}
</div>
</div>
<div class="inventory-product-mobile">
{% include '@SyliusShop/Product/Show/_inventory.html.twig' %}
</div>
{% endif %}
<script>
function changeImage(index) {
// Récupérer toutes les images de la galerie
var images = document.querySelectorAll('#gallery-right-images-mobile #card-product-show-right-mobile');
// Réinitialiser la classe "active" pour tous les points
var points = document.querySelectorAll('.point');
points.forEach(function(point) {
point.classList.remove('active');
});
// Cacher toutes les images de la galerie
images.forEach(function(image) {
image.style.display = 'none';
});
// Afficher l'image correspondante à l'index spécifié
images[index - 1].style.display = 'block';
// Ajouter la classe "active" au point correspondant à l'index spécifié
points[index - 1].classList.add('active');
}
</script>