<!DOCTYPE html>
<html lang="ru">
  <head>
    <base href="https://site8.local/" />
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="alternate" hreflang="x-default" href="https://site8.local/" />
<link rel="alternate" hreflang="ru" href="https://site8.local/"/>
<meta name="format-detection" content="telephone=no">
<meta name="yandex-verification" content="a1aa8de869b418cc" />
<meta name="google-site-verification" content="ZBEWfnIwIm23K63UuaSz_KAEJ82GjDhU9ORrwAb8ZrE" /> 

<!-- End Google Tag Manager -->

<!-- Top.Mail.Ru counter -->


<link rel="stylesheet" href="https://cdn.envybox.io/widget/cbk.css">
<script type="text/javascript" src="https://cdn.envybox.io/widget/cbk.js?wcb_code=e58b848912a13c31f6ba400fbbd4fee0" charset="UTF-8" async></script>


<script>
const boxes = Array.from(document.querySelectorAll(".box")); // считываем все элементы аккордеона в массив

boxes.forEach((box) => { 
  box.addEventListener("click", boxHandler); // при нажатии на бокс вызываем ф-ию boxHanlder
});

function boxHandler(e) { 
  e.preventDefault(); // сбрасываем стандартное поведение
  let currentBox = e.target.closest(".box"); // определяем текущий бокс
  let currentContent = e.target.nextElementSibling; // находим скрытый контент
  currentBox.classList.toggle("active"); // присваиваем ему активный класс
  if (currentBox.classList.contains("active")) { 
    // если класс активный ..
    currentContent.style.maxHeight = currentContent.scrollHeight + "px"; // открываем контент
  } else { 
    // в противном случае
    currentContent.style.maxHeight = 0; // скрываем контент
  }
}
</script>




<!-- Закрытие фильтра при клике вне области фильтра -->
<script>
    $(document).ready(function(){ 
    	$(document).mouseup(function(e){ 
    		let div = $(".filter__item");
    		if ( !div.is(e.target) && div.has(e.target).length === 0 ) { 
    			div.removeClass('_show');
    		}
    	});
    	$(document).mouseup(function(e){ 
    		let div2 = $(".select__current");
    		if ( !div2.is(e.target) && div2.has(e.target).length === 0 ) { 
    			div2.removeClass('_active');
    		}
    	});
    });
</script>

<!-- Модальное окно для просмотра товара -->
<script>
    $(document).ready(function(){ 
        $(document).on('click', '.js-fastview', (e) => { 
    	    let target = e.target;
            let pid = $(target).data('id');
            
            $.post("/ajaxfastview/", {  pid: pid }).done(function(data) { 
                let div = document.createElement('div');
                div.classList.add("wrap-fast");
                div.innerHTML = data;
                //document.body.appendChild(div);
                document.querySelector('#fast-view-modal').innerHTML = '';
                document.querySelector('#fast-view-modal').appendChild(div);
                Fancybox.show([{  src: "#fast-view-modal", type: "inline", },]);
            });
    	});
    	$(document).on('click', '.js-fastview-keks', (e) => { 
    	    let target = e.target;
            let pid = $(target).data('id');
            
            $.post("/ajaxfastviewkeks/", {  pid: pid }).done(function(data) { 
                let div = document.createElement('div');
                div.classList.add("wrap-fast");
                div.innerHTML = data;
                //document.body.appendChild(div);
                document.querySelector('#fast-view-modal').innerHTML = '';
                document.querySelector('#fast-view-modal').appendChild(div);
                Fancybox.show([{  src: "#fast-view-modal", type: "inline", },]);
            });
    	});
    	$(document).on('click', '.js-fastview-eskimo', (e) => { 
    	    let target = e.target;
            let pid = $(target).data('id');
            
            $.post("/ajaxfastvieweskimo/", {  pid: pid }).done(function(data) { 
                let div = document.createElement('div');
                div.classList.add("wrap-fast");
                div.innerHTML = data;
                //document.body.appendChild(div);
                document.querySelector('#fast-view-modal').innerHTML = '';
                document.querySelector('#fast-view-modal').appendChild(div);
                Fancybox.show([{  src: "#fast-view-modal", type: "inline", },]);
            });
    	});
    	$(document).on('click', '.js-fastview-deserts_other', (e) => { 
    	    let target = e.target;
            let pid = $(target).data('id');
            
            $.post("/ajaxfastviewdesertsother/", {  pid: pid }).done(function(data) { 
                let div = document.createElement('div');
                div.classList.add("wrap-fast");
                div.innerHTML = data;
                document.body.appendChild(div);
                Fancybox.show([{  src: "#fast-view-modal", type: "inline", },]);
            });
    	});
    	$(document).on('click', '.js-fastview-decor_pack', (e) => { 
    	    let target = e.target;
            let pid = $(target).data('id');
            
            $.post("/ajaxfastviewdesorpack/", {  pid: pid }).done(function(data) { 
                let div = document.createElement('div');
                div.classList.add("wrap-fast");
                div.innerHTML = data;
                document.body.appendChild(div);
                Fancybox.show([{  src: "#fast-view-modal", type: "inline", },]);
            });
    	});
    });
</script>

<!-- Маска  -->
<script>
    $(document).ready(function(){ 
        $('[name="phone"]').inputmask("+7 (747) 999-99-99");
    });
</script>

<!-- Блокируем кнопку если сняли галочку с чекбокса политики  -->
<script>
    $(document).ready(function(){ 
        $('#order-policy').click(function(){ 
            if ($(this).is(':checked')){ 
                $(this).closest('form').find('[type="submit"]').prop('disabled', false);
            } else { 
                $(this).closest('form').find('[type="submit"]').prop('disabled', true);
            }
        });
    });
</script>

<!-- Капча -->
<script>
    $(document).ready(function(){ 
        $('.ajax_form').append('<input type="text" name="org" value="" class="_org" style="visability:hidden; height: 0; width: 0; padding: 0; border:none;"/>');
    });
</script>

<!-- Стрелка вверх -->
<script>
    $(document).ready(function(){ 
        $(window).scroll(function() { 
        	if($(window).scrollTop() > 100) { 
        		$('#toTop').css('display','block');
        	} else { 
        		$('#toTop').css('display','');
        	}
        });
        $(document).on('click', '#toTop', function(e) { 
        	e.preventDefault();
        	$('body,html').animate({  scrollTop:0 },300);
        });
    });
</script>

<!-- Перекидываем ajax форму поиска в другое место для мобильных устройств -->
<script>
    $(document).ready(function(){ 
        if ($(window).width() < 701) { 
            let form = $('.append-form');
            $('.form-mobile-append').append(form);
        }
    });
</script>

<script>
    // Отключаем появление уведомлений jGrowl AjaxForm
    $(document).ready(function() { 
        // Removing AjaxForm success message
        if (typeof(AjaxForm) != 'undefined') { 
            AjaxForm.Message.success = function() { };
        }
    });
    // Включаем появление своих уведомлений AjaxForm
    $(document).on('af_complete', function(event, response) { 
        var form = response.form;
        if (response.success) { 
            Fancybox.show([{  src: "#modal-callback-success",type: "inline", },]);
        }
    });
</script>

<!-- Товарные скрипты -->
<script>
    $(document).ready(function(){ 
        // Пересчитываем цену товара при изменении количества на карточке товара
        $(document).on('click', '.product-page__count.count__option .product-page__count-btn', function() { 
            let count = $(this).siblings('.product-page__count-input').val();
            let cur_price = $(this).closest('.prod-info').find('.product-page__price span').data('currentprice');
            let result_price = count * cur_price;
            
            let gift_value = $(this).closest('.prod-info').find('.product-page__price span').data('gift');
            let old_price = 0;
            // считаем еще и скидку если она есть
            if(gift_value && gift_value != ''){
                if(gift_value.indexOf('%') > 0){
                    old_price = result_price;
                    result_price = Math.round(result_price - (result_price / 100 * parseInt(gift_value)));
                }
                else{
                    old_price = result_price;
                    result_price = Math.round(result_price - parseInt(gift_value));
                }
                $('.product-page__price .oldprice').text((old_price).toLocaleString('ru') + ' ₽');
            }
            
            result_price = Number(result_price);
            result_price = (result_price).toLocaleString('ru');
            $('.product-page__price span').text(result_price);
            
        });
        
        // Пересчитываем цену товара при изменении веса + пересчитываем количество человек
        $(document).on('click', '.product-page__count.weight__option .product-page__count-btn', function() { 
            let weight = $(this).siblings('.product-page__count-input').val();
            //let base_price = $('.product-page__price span').data('baseprice');
            let base_price = $(this).closest('.prod-info').find('.product-page__price span').data('baseprice');
            //let price_kg = $('.product-page__price span').data('pricekg');
            let price_kg = $(this).closest('.prod-info').find('.product-page__price span').data('pricekg');
            let price_deliv = $(this).closest('.prod-info').find('.product-page__price span').data('delivprice');
            
            let result_price_noformat = base_price + weight * price_kg + price_deliv;
            $('.product-page__price span').attr('data-resultprice', result_price_noformat);
            
            result_price_noformat = result_price_noformat + Number($('.product-page__price span').attr('data-filling')) * weight;
            
            let gift_value = $(this).closest('.prod-info').find('.product-page__price span').attr('data-gift');
            let old_price = 0;
            // считаем еще и скидку если она есть
            if(gift_value && gift_value != ''){
                if(gift_value.indexOf('%') > 0){
                    old_price = result_price_noformat;
                    result_price_noformat = Math.round(result_price_noformat - (result_price_noformat / 100 * parseInt(gift_value)));
                }
                else{
                    old_price = result_price_noformat;
                    result_price_noformat = Math.round(result_price_noformat - parseInt(gift_value));
                }
                $('.product-page__price .oldprice').text((old_price).toLocaleString('ru') + ' ₽');
            }
            
            result_price_noformat = (result_price_noformat).toLocaleString('ru');
            $('.product-page__price span').text(result_price_noformat);
            
            
            let count_person = weight * 6;
            $('.product-page__chooses-count-note span').text(count_person);
        });
        
        // Пересчитываем цену товара при изменении начинки
        $(document).on('click', '.select__variant input', function() { 
            let weight = $(this).closest('.prod-info').find('.product-page__count.weight__option .product-page__count-input').val();
            let nachinka_price = Number($(this).val());
            
            let result_nachinka_noformat = nachinka_price;
            $('.product-page__price span').attr('data-filling', result_nachinka_noformat);
            
            if (!weight) { 
                result_nachinka_noformat = result_nachinka_noformat + Number($('.product-page__price span').attr('data-resultprice'));
            } else { 
                result_nachinka_noformat = result_nachinka_noformat * weight + Number($('.product-page__price span').attr('data-resultprice'));
            }
            
            
            let gift_value = $(this).closest('.prod-info').find('.product-page__price span').attr('data-gift');
            let old_price = 0;
            // считаем еще и скидку если она есть
            if(gift_value && gift_value != ''){
                if(gift_value.indexOf('%') > 0){
                    old_price = result_nachinka_noformat;
                    result_nachinka_noformat = Math.round(result_nachinka_noformat - (result_nachinka_noformat / 100 * parseInt(gift_value)));
                }
                else{
                    old_price = result_nachinka_noformat;
                    result_nachinka_noformat = Math.round(result_nachinka_noformat - parseInt(gift_value));
                }
                $('.product-page__price .oldprice').text((old_price).toLocaleString('ru') + ' ₽');
            }
            
            
            result_nachinka_noformat = (result_nachinka_noformat).toLocaleString('ru');
            
            $('.product-page__price span').text(result_nachinka_noformat);
        });
        
        // Открываем соответствующее описание при выборе начинки
        $(document).on('click', '.select__variant input', function() { 
            $('.product-page__filling-note__title').text($(this).data('descr'));
            $('.product-page__filling-note__price').text($(this).val());
            let this_idx = $(this).data('id');
            $('.product-page__chooses-info').each(function(){ 
                $(this).addClass('d-none');
                if ($(this).data('id') == this_idx) { 
                    $(this).removeClass('d-none'); 
                }
            })
        });

    });
</script>

<!-- Получаем количество кексов/эскимо и пересчитываем цену -->
<script>
    $(document).ready(function(){ 
        $(document).on('click', '.count-variants .select__variant input', function() { 
            let count = Number($(this).val());
            $(this).closest('.count-variants').find('input.count-input').val(count);
            
            let price = $(this).closest('.prod-info').find('.product-page__price span').data('currentprice');
            let new_price = price * count;
            $('.product-page__price span').attr('data-resultprice', new_price);
            new_price = (new_price).toLocaleString('ru');
            $('.product-page__price span').text(new_price);
            
            //let weight = $(this).closest('.prod-info').find('.product-page__count.weight__option').attr('data-count-min');
            //let new_weight = count * weight;
            //$('.product-page__count-input').val(new_weight);
        });
    });
</script>

<!-- Добавляем опцию, чтобы десерты не сплюсовывались в корзине -->
<script>
    $(document).ready(function(){ 
        function getRandomIntInclusive(min, max) { 
            min = Math.ceil(min);
            max = Math.floor(max);
            return Math.floor(Math.random() * (max - min + 1)) + min;
        }
        $(document).on('click', '.product-page__order, .product-page__to-cart', function() { 
            $('.input-rand').val(getRandomIntInclusive(0000000001, 9999999999));
        });
    });
</script>

<!-- Получаем ID выбранной начинки и передаем ее в корзину -->
<script>
    $(document).ready(function(){ 
        $(document).on('click', '.filling-variants .select__variant input', function() { 
            $(this).closest('.filling-variants').find('input.filling-input').val($(this).data('id'));
        });
    });
</script>


<!-- При нажатии на кнопку "Оформить заказ" проваливаемся в корзину -->
<script>
    $(document).ready(function(){ 
        $(document).on('click', '.product-page__order', function() { 
            miniShop2.Callbacks.Cart.add.response.success = function() { 
                $('#add-to-cart .modal__btns').css('display', 'none');
                setTimeout(function() { 
                    document.location = '/cart/';
                }, 750);
            }
        });
    });
</script>

<!-- Меню -->
<script>
    $(document).ready(function(){ 
        $('[data-nav]').click(function(){ 
            $(this).toggleClass('_active');
        });
        if ($(window).width() > 700) { 
            $('.nav__submenu-list-link').hover(function(){ 
                $('.nav__submenu-list-link').removeClass('_active');
                $(this).addClass('_active');
            }); 
        } else { 
            $('.nav__submenu-list-item').each(function(){ 
                console.log($(this).find('.nav__lastmenu').find('.nav__lastmenu-list'));
                if ($(this).find('.nav__lastmenu').find('.nav__lastmenu-list').length) { 
                    $(this).find('.nav__submenu-list-link').append('<span></span>');
                }
            });
            $(document).on('click', '.nav__submenu-list-link span', function(){ 
                $(this).parent().toggleClass('_active');
                return false;
            });
        }
    });
</script>

<script>
    $(document).ready(function(){
        $('.order__submit').click(function(){
            setTimeout(function(){
                if ($('.form-control.error').length) {
                    let anchor = $('.input.error')[0];
        			$('html, body').animate({
        				scrollTop: $(anchor).offset().top - 120
        			}, 500);
                }
            }, 500)
        })
    });
</script>








<!-- Envybox автоматически пихает номер телефона в каждую форму -->
<script>
$(document).ready(function(){ 
    $('#phone').css('font-size','0');
    setTimeout(function(){ 
        $('#phone').css('font-size','');
        $('#phone').val('');
    },750);
});
</script>

  <script src="/assets/components/msfavorites/js/defaultCustom.min.js?v=f301bf14"></script>
<script src="/assets/components/minishop2/js/web/defaultCustom.js?v=667ec14321"></script>
<script src="/assets/components/minishop2/js/web/lib/jquery.jgrowl.min.js"></script>
<script src="/assets/components/minishop2/js/web/message_settings.js"></script>
</body>
</html>