<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.js" charset="UTF-8"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/components/dimmer.min.js" charset="UTF-8"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js" integrity="sha512-Eak/29OTpb36LLo2r47IpVzPBLXnAMPAVypbSZiZ4Qkf8p/7S/XRG5xp7OKWPPYfJT6metI+IORkR5G8F900+g==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.js" integrity="sha512-Yk47FuYNtuINE1w+t/KT4BQ7JaycTCcrvlSvdK/jry6Kcxqg5vN7/svVWCxZykVzzJHaxXk5T9jnFemZHSYgnw==" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/malihu-custom-scrollbar-plugin/3.1.5/jquery.mCustomScrollbar.min.css" integrity="sha512-6qkvBbDyl5TDJtNJiC8foyEVuB6gxMBkrKy67XpqnIDxyvLLPJzmTjAj1dRJfNdmXWqD10VbJoeN4pOQqDwvRA==" crossorigin="anonymous" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-expander/1.7.0/jquery.expander.min.js" integrity="sha512-owmUWt/accgjJVsM8cWGa/n2qT77yC2+dJ8BDmGOQSKQ42DApWgpjINbUhWQ9CTTpdlTJa6OJEycyuaSzBN6lw==" crossorigin="anonymous"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/ekko-lightbox/5.3.0/ekko-lightbox.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.js" integrity="sha512-m5kAjE5cCBN5pwlVFi4ABsZgnLuKPEx0fOnzaH5v64Zi3wKnhesNUYq4yKmHQyTa3gmkR6YeSKW1S+siMvgWtQ==" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-multifile@2.2.2/jquery.MultiFile.min.js" type="text/javascript" language="javascript"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
<script>
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).ekkoLightbox({ wrapping: false });
});
$('.scrollPerso').mCustomScrollbar({
theme:"dark"
})
$('.expand-me').expander({
slicePoint: 150,
expandEffect: 'slideDown',
expandText: '<a href="#" class="text-underline color-bleu" title=""> + {{"app.taxon.lire_lasuite" |trans}}</a>',
userCollapseText: '<a href="#" class="text-underline color-bleu" title=""> - {{"app.taxon.reduire" |trans}}</a>'
});
function initZoomable(selector) {
if (selector) {
var $elt = $(selector), option = {url: $elt.attr('href')};
$(selector).on('click', function (e) {
e.preventDefault();
}).trigger('zoom.destroy').zoom(option);
}
}
function changeImg(srcImg,srcImg2){
document.getElementById('big').src = srcImg ;
document.getElementById('bigLink').href = srcImg2;
document.getElementsByClassName('zoomImg')[0].href=srcImg2;
initZoomable('.zoomable');
}
$("#bigLink").on('click', function (e) {
e.preventDefault();
});
$('#bigLink').zoom();
</script>
{# gestion de la partie configurateur #}
<script>
//import SyliusVariantImages from '/../../assets/js/sylius-variant-images';
$( document ).ready(function() {
var checkboxOptionPerforatedBottom = $('#add_specific_product_to_cart_perforated_bottom_option');
var optionPerforatedBottom = $('#option_perforated_bottom');
var howManyPerforatedBottom = $('#add_specific_product_to_cart_how_many_perforated_bottom');
var priceTotal = 0;
var priceTotalWithoutPromo = 0;
var productConfigurable = 0;
var typeCategories = ['depart', 'suivant'];
$('.pb-2').find('.app_product_vaiant').each(function() {
let price = $(this)
.find("#price")
.attr("data-price");
let priceWithoutPromo = $(this)
.find("#price")
.attr("data-original-value");
let quantity = $(this.parentNode)
.find("input[type=number]")
.val();
if (quantity != null && price != null) {
priceTotal = priceTotal + (parseInt(quantity) * parseInt(price));
if(priceWithoutPromo !== ""){
priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(priceWithoutPromo));
}else{
priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(price));
}
}
productConfigurable = 1
});
if(productConfigurable === 1){
$('.btn-add-panier').attr("disabled", "disabled");
let priceEuros = ((priceTotal/100));
let priceEurosWithoutPromo = ((priceTotalWithoutPromo/100));
let displayPrice = new Intl.NumberFormat('fr-FR', {
style: 'currency',
currency: 'EUR'
});
$("#product-price").text(displayPrice.format(priceEuros));
$("#product-price-without-promo").text(displayPrice.format(priceEurosWithoutPromo));
buildImageVariant();
}
// $('input[type=number]:not(.free-option)').change(function(){
// let cart = document.querySelector('.prix-art-panier');
// var priceTotal = 0;
// var priceTotalWithoutPromo = 0;
// let hasQuantity = 0;
// $('.pb-2.tr-visible').find('.app_product_vaiant').each(function() {
// let price = $(this)
// .find("#price")
// .attr("data-price");
//
// let priceWithoutPromo = $(this)
// .find("#price")
// .attr("data-original-value");
//
// let quantity = $(this.parentNode)
// .find("input[type=number]:not(.free-option)")
// .val();
// hasQuantity+=parseInt(quantity);
// if (quantity != null && price != null) {
// priceTotal = priceTotal + (parseInt(quantity) * parseInt(price));
// if(priceWithoutPromo !== ""){
// priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(priceWithoutPromo));
// }else{
// priceTotalWithoutPromo = priceTotalWithoutPromo + (parseInt(quantity) * parseInt(price));
// }
// }
//
// });
// if(hasQuantity === 0){
// $('.btn-add-panier').attr("disabled", "disabled");
// }else{
// $('.btn-add-panier').removeAttr("disabled");
// }
// let priceEuros = ((priceTotal/100));
// let priceEurosWithoutPromo = ((priceTotalWithoutPromo/100));
// let displayPrice = new Intl.NumberFormat('fr-FR', {
// style: 'currency',
// currency: 'EUR'
// });
// $("#product-price").text(displayPrice.format(priceEuros));
// $("#product-price-without-promo").text(displayPrice.format(priceEurosWithoutPromo));
// });
var $selects = $('.filtreOptions');
typeCategories.forEach(function(category, index){
let filterableRows = $('.sylius-product-variants').find('tr.' + category);
filterableRows.parent().parent().parent().hide().filter(function() {
return $(this).find('td').not('.quantity').not("#price").not(".stock").filter(function() {
let tdText = $(this).attr('data-value-code');
let selectValue = $('#filtreOptions_' + $(this).data('input')+'_'+category).val();
return tdText === selectValue;
}).length === $(this).find('td').not('.quantity').not("#price").not(".stock").length;
}).show().addClass("tr-visible");
});
$selects.on('change', function() {
$('input[type=number]:not(.free-option)').each(function() {
$(this).val("0");
$(this).trigger("change");
}
);
typeCategories.forEach(function(category, index) {
let filterableRows = $('.sylius-product-variants').find('tr.' + category);
filterableRows.parent().parent().parent().hide().removeClass("tr-visible").filter(function () {
return $(this).find('td').not('.quantity').not("#price").not(".stock").filter(function () {
let tdText = $(this).attr('data-value-code'),
selectValue = $('#filtreOptions_' + $(this).data('input')+'_'+category).val();
return tdText === selectValue;
}).length === $(this).find('td').not('.quantity').not("#price").not(".stock").length;
}).show().addClass("tr-visible");
});
buildImageVariant();
});
if(!checkboxOptionPerforatedBottom.checked){
optionPerforatedBottom.hide();
howManyPerforatedBottom.val(0);
}else{
optionPerforatedBottom.show();
}
checkboxOptionPerforatedBottom.change(function(){
if(this.checked){
optionPerforatedBottom.show();
} else {
optionPerforatedBottom.hide();
howManyPerforatedBottom.val(0);
}
});
//new SyliusVariantImagesTest();
buildImageVariant();
function buildImageVariant(){
let mainImageLink = document.querySelector('[data-product-image]');
let variantPath ="";
let triggers;
if(productConfigurable === 1){
triggers = document.querySelectorAll('.trigger-variant-image.depart');
}else{
triggers = document.querySelectorAll('.table-devis .form-control');
}
//let variantsDiv = document.querySelectorAll('.sylius-image-variants');
let triggersArray = Array.prototype.slice.call(triggers, 0);
for (var i = 0; i < triggersArray.length; i++) {
var element = triggersArray[i];
//let elementWithoutSpace = element.value.replace(/\s/g, "");
variantPath+=element.value;
}
//var imageObjects = document.querySelectorAll('.img-bit-article a img');
//var imageVariants = document.querySelectorAll('.sylius-image-variants');
var imageVariants = $('.sylius-image-variants').find('div[data-variant-options = "'+ variantPath +'"]');
//var imageVariantsToNotDisplay = $('div[data-variant-options]').not('div[data-variant-options="' + variantPath + '"]');
imageVariants.each(function(index, element){
let imagePath = $(element).attr("data-variant-image-path");
mainImageLink.setAttribute('src',imagePath);
mainImageLink.setAttribute('data-product-image',imagePath);
mainImageLink.setAttribute('data-product-link',imagePath);
$(mainImageLink).find('a').each(function(index, element){
$(element).css('display', 'block');
$(element).attr("href", imagePath);
$(element).find('img').each(function(index, img){
$(img).attr('src', imagePath);
})
});
});
let swipper_images = $('.supp-img').find('.sylius-image-variants');
swipper_images.each(function (index, element){
let data_variants = $(element).find('div[data-variant-image-path]');
// if(data_variants.length === 0){
// $(element.parentNode).css('display', 'none'); // POUR CACHER LES IMAGES QUI N ONT PAS DE VARIANTS
// }
data_variants.each(function(indexVariant, imageVariant){
let imagePath = $(imageVariant).attr("data-variant-image-path");
if(imagePath !== mainImageLink.getAttribute('src') ){
// $(element.parentNode).css('display', 'none');
// $(element.parentNode).css('background-color', 'red');
}else{
$(element.parentNode).css('display', 'block');
}
})
});
}
});
</script>
{{ encore_entry_script_tags('app', null, 'bootstrapTheme') }}