Doors

<link href="https://steklomall.ru/bitrix/cache/css/s1/main/template_9ede261412ae8b870cf8b6041e4d12ec/template_9ede261412ae8b870cf8b6041e4d12ec.css?1548683023239392" type="text/css" data-template-style="true" rel="stylesheet"/> <script type="text/javascript" src="https://steklomall.ru//bitrix/cache/js/s1/main/kernel_main/kernel_main.js?1548682979288581"></script> <script type="text/javascript" src="https://steklomall.ru//bitrix/cache/js/s1/main/page_f1074ed538653fabb342c4c0e4f1f3f5/page_f1074ed538653fabb342c4c0e4f1f3f5.js?15486981491183"></script> <script type="text/javascript" src="https://steklomall.ru//bitrix/cache/js/s1/main/template_053ea486a9a3179bb2de9fb3c7190263/template_053ea486a9a3179bb2de9fb3c7190263.js?1548682979434270"></script> <div class="container"> <div class="calculator"> <div class="calculator__content"> <div class="row"> <div class="col col_size_4 col_md_12"> <div class="block block_type_product-type" id="widget_calc_type"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Выбор изделия </div> <div class="block__content"> <form name="form-step1" action="" method="GET"> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="CALC_TYPE" id="product-type-108" value="shower"> <label for="product-type-108"> Душевая кабина </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="CALC_TYPE" id="product-type-110" value="skinali"> <label for="product-type-110"> Скинали </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="CALC_TYPE" id="product-type-109" value="doors" checked="checked"> <label for="product-type-109"> Двери </label> </div> </div> </form> </div> </div> </div> <script> $(function() { var holder = $('.calculator'), form = $('form[name="form-step1"]', holder); form.on('submit', function (e) { e.preventDefault(); holder.addClass('loading'); $.ajax({ url: form.prop('action'), type: 'GET', cache: false, dataType: 'html', data: form.serializeArray(), success: function (html) { holder.replaceWith(html); } }); }); $('input[name="CALC_TYPE"]', form).on('change', function (e) { form.submit(); }); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_door-type" id="widget_doors_type"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Тип конструкции </div> <form class="block__content" name="doors-type"> <input type="hidden" name="CALC_TYPE" value="doors"> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="DOOR_TYPE" id="door-type-1" value="1" checked=""> <label for="door-type-1"> Раздвижные двери </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="DOOR_TYPE" id="door-type-2" value="2"> <label for="door-type-2"> Распашные двери </label> </div> </div> </form> </div> </div> <script> var DoorsTypeWidget = function (holder) { this.holder = holder; }; DoorsTypeWidget.prototype.getData = function () { return { success: true, type: this.holder.find('input[name="door-type"]:checked').val() }; }; DoorsTypeWidget.prototype.getTextView = function () { return $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); }; $(function () { var holder = $('.calculator'), widget = $('#widget_doors_type'), form = $('form', widget); calc.registerWidget('door_type', new DoorsTypeWidget(widget)); $('input[name="DOOR_TYPE"]', widget).each(function() { $(this).on('change', function () { form.submit(); }); }); form.on('submit', function (e) { e.preventDefault(); holder.addClass('loading'); $.ajax({ url: form.prop('action'), type: 'GET', cache: false, dataType: 'html', data: form.serializeArray(), success: function (html) { holder.replaceWith(html); } }); }); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_mechanism"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Механизм </div> <div class="block__content"> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="mechanism" id="mechanism-125" value="125" data-price="18983" checked=""> <label for="mechanism-125"> Система Слайдер </label> </div> <div class="info"> <div class="info__toggle"></div> <div class="info__content">Данная система является "закрытой". Все крепежи, ролики и каретки спрятаны за горизонтальной декоративной алюминиевой крышкой. </div> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="mechanism" id="mechanism-126" value="126" data-price="18983"> <label for="mechanism-126"> Система ГЛАСС </label> </div> <div class="info"> <div class="info__toggle"></div> <div class="info__content">Данная система является "открытой". Основа системы - это трек (труба). Все точечные крепежи, держатели и каретки визуально просматриваются. </div> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="mechanism" id="mechanism-127" value="127" data-price="18983"> <label for="mechanism-127"> Не имеет значения </label> </div> </div> </div> </div> </div> <script> var MechanismWidget = function (holder) { this.holder = holder; }; MechanismWidget.prototype.getData = function () { return { success: true, value: this.holder.find('input[name="mechanism"]:checked').val(), price: this.holder.find('input[name="mechanism"]:checked').data('price') } }; MechanismWidget.prototype.getTextView = function () { return $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); }; $(function () { calc.registerWidget('mechanism', new MechanismWidget($('.block_type_mechanism'))); }); </script> </div> </div> <div class="row"> <div class="col col_size_4 col_md_12"> <div class="block block_type_glass-width" id="widget_thickness"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Толщина стекла </div> <div class="block__content"> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="THICKNESS" id="glass-width-128" value="128" checked=""> <label for="glass-width-128"> 8 мм </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="THICKNESS" id="glass-width-129" value="129"> <label for="glass-width-129"> 10 мм </label> </div> </div> </div> <div class="block__footer"> От выбранной вами толщины будет зависеть не только цена, но и прочность изделия. </div> </div> </div> <script> var ThicknessWidget = function (holder) { this.holder = holder; }; ThicknessWidget.prototype.getData = function() { return { success: true, value: this.holder.find('input[name="THICKNESS"]:checked').val() }; }; ThicknessWidget.prototype.getPriceList = function () { return {"115_129":4140,"115_128":3408,"116_129":51,"116_128":400,"136_128":4536,"136_129":5600,"135_129":4368,"135_128":4368,"137_129":6500,"137_128":5136,"134_129":4140,"134_128":3408,"161_128":4836,"161_129":5800,"115_181":2000,"116_181":3850}; }; ThicknessWidget.prototype.getTextView = function () { return $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); }; $(function() { calc.registerWidget('thickness', new ThicknessWidget($('#widget_thickness'))); }); </script> <div class="block block_type_glass-type" id="widget_glass_type"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Тип стекла </div> <div class="block__content"> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="GLASS_TYPE" id="glass-type-134" value="134" data-price="100"> <label for="glass-type-134"> Прозрачное </label> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="GLASS_TYPE" id="glass-type-135" value="135" data-price="500"> <label for="glass-type-135"> Матовое </label> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="GLASS_TYPE" id="glass-type-136" value="136" data-price="500"> <label for="glass-type-136"> Бронзовое </label> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="GLASS_TYPE" id="glass-type-137" value="137" data-price="500"> <label for="glass-type-137"> Оптивайт </label> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="GLASS_TYPE" id="glass-type-161" value="161" data-price="0"> <label for="glass-type-161"> Серое </label> </div> </div> </div> </div> </div> <script> var GlassTypeWidget = function(holder) { this.holder = holder; }; GlassTypeWidget.prototype.getValue = function () { return this.holder.find('input[name="GLASS_TYPE"]:checked').val(); }; GlassTypeWidget.prototype.getPrice = function () { return parseInt(this.holder.find('input[name="GLASS_TYPE"]:checked').data('price')); }; GlassTypeWidget.prototype.getData = function () { var result = { success: true, value: this.getValue(), price: this.getPrice() }; return result; }; GlassTypeWidget.prototype.getTextView = function () { return $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); }; $(function() { calc.registerWidget('glass_type', new GlassTypeWidget($('#widget_glass_type'))); }); </script> </div> <div class="col col_size_8 col_md_12"> <div class="block block_type_door" id="widget_door_razd_size"> <div class="block__inner"> <div class="h2 block__heading block__heading_md"> Тип, размер </div> <div class="block__content"> <div class="row"> <div class="col col_size_6 col_sm_12"> <div class="block-thumb-selector"> <div class="row grid block-thumb-selector__items"> <div class="col col_size_12 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner block-thumb-selector__inner_active" data-type="1"> <div class="block-thumb-selector__title"> Одностворчатая </div> <img src="/page-proofs/images/door3.png" alt="" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_12 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-type="2"> <div class="block-thumb-selector__title"> Двустворчатая </div> <img src="/page-proofs/images/door4.png" alt="" class="block-thumb-selector__image"> </div> </div> </div> </div> </div> <div class="col col_size_6 col_sm_12"> <div class="block__fields" data-type="1" style="display: block;"> <div class="group group_size_xl"> <div class="block__caption"> Размер: </div> <div class="group"> <div class="block__caption block__caption_size_sm"> От 250 мм до 2500 мм </div> <div> <label class="label"> Высота <span class="blue">h</span> </label> <input name="h" min="250" max="2500" type="number" class="control control_size_md"> <span class="blue">мм</span> </div> </div> <div class="group"> <div class="block__caption block__caption_size_sm"> От 250 мм до 1000 мм </div> <div> <label class="label"> Размер двери <span class="blue">d</span> </label> <input name="d" min="250" max="1000" type="number" class="control control_size_md"> <span class="blue">мм</span> </div> </div> </div> </div> <div class="block__fields" data-type="2"> <div class="group group_size_xl"> <div class="block__caption"> Размер: </div> <div class="group"> <div class="block__caption block__caption_size_sm"> От 250 мм до 2500 мм </div> <div> <label class="label"> Высота <span class="blue">h</span> </label> <input name="h" type="number" min="250" max="2500" class="control control_size_md"> <span class="blue">мм</span> </div> </div> <div class="group"> <div class="block__caption block__caption_size_sm"> От 250 мм до 1000 мм </div> <div class="group group_size_sm"> <label class="label"> Размер двери <span class="blue">d</span> </label> <input name="d" type="number" min="250" max="1000" class="control control_size_md"> <span class="blue">мм</span> </div> <div class="group group_size_sm"> <label class="label"> Размер двери <span class="blue">d2</span> </label> <input name="d2" type="number" min="250" max="1000" class="control control_size_md"> <span class="blue">мм</span> </div> </div> </div> </div> <a class="button block__btn button_step3" href="javascript:void(0);" style="display: none;">Продолжить</a> </div> </div> </div> </div> </div> <script type="text/javascript"> var DoorRazdSizeWidget = function (holder) { this.holder = holder; }; DoorRazdSizeWidget.prototype.getData = function () { var result = { success: true, sizes: {} }; var sel = this.holder.find('.block-thumb-selector__inner_active'); if (sel.length == 0) { result.success = false; } else { result.type = sel.data('type'); } result.sizes = {}; this.holder.find('input:visible').each(function () { if ($(this).val() != '') { result.sizes[$(this).prop('name')] = $(this).val(); } else { result.success = false; } }); if (this.holder.find('.has-error').length > 0) { result.success = false; } return result; }; DoorRazdSizeWidget.prototype.checkNextButton = function () { var data = this.getData(); if (data.success) { this.holder.find('.button_step3').show(); } else { this.holder.find('.button_step3').hide(); } $('.calculator').find('.step-3').hide(); calc.enabled(false); }; DoorRazdSizeWidget.prototype.getSquare = function () { var data = this.getData(); if (data.success) { if (!data.sizes.hasOwnProperty('d2')) { data.sizes.d2 = 0; } return ((parseInt(data.sizes.d) + parseInt(data.sizes.d2)) * parseInt(data.sizes.h)) * 1e-6; } else { return 0; } }; DoorRazdSizeWidget.prototype.getTextView = function () { var data = this.getData(); var result = "Размеры \n"; for (var key in data.sizes) { result += key + " = " + data.sizes[key] + "\n"; } return result; }; $(function() { var block = $('.block_type_door'), items = block.find('.block-thumb-selector__inner'), fields = block.find('.block__fields'); items.on('click', function() { items.removeClass('block-thumb-selector__inner_active'); $(this).addClass('block-thumb-selector__inner_active'); fields.hide(); fields.filter('[data-type="' + $(this).data('type') + '"]').show(); calc.widgets.door_size.checkNextButton(); }); block.find('input[type="number"]').each(function() { $(this).on('focusout', function () { var vInt = parseInt($(this).val()); if ($(this).val() == '') { $(this).parent().addClass('has-error'); } else if (vInt < parseInt($(this).prop('min'))) { $(this).parent().addClass('has-error'); } else if (vInt > parseInt($(this).prop('max'))) { $(this).parent().addClass('has-error'); } else { $(this).parent().removeClass('has-error'); } calc.widgets.door_size.checkNextButton(); }); }); calc.registerWidget('door_size', new DoorRazdSizeWidget(block)); // Тут мы прячем все виджеты после этого.. $('.calculator').find('.step-3').hide(); // Кнопка будет видна только когда все размеры будут указаны.. block.find('.button_step3').hide(); block.find('.button_step3').on('click', function () { $('.calculator').find('.step-3').show(); calc.enabled(true); calculate(); }); }); </script> </div> </div> <div class="row"> <div class="col col_size_4 col_md_12"> <div class="block block_type_glass-type step-3" id="widget_print_type" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Вид печати </div> <div class="block__content"> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="PRINT_TYPE" id="print-type-117" value="117" data-price="2000"> <label for="print-type-117"> Фотопечать </label> </div> <div class="info"> <div class="info__toggle"></div> <div class="info__content">Цветное изображение на поверхности стекла. Широко используется в оформлении дизайна интерьера и расширяет спектр применяемых стилевых решений. </div> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="PRINT_TYPE" id="print-type-138" value="138" data-price="3000"> <label for="print-type-138"> С рисунком (пескоструй) </label> </div> <div class="info"> <div class="info__toggle"></div> <div class="info__content">Нанесение любых графических рисунков на стекло посредством пескоструйной обработки. Данный вид нанесения графических изображений может быть выполнен только в одной цветовой гамме - белый матовый. Стекло с нанесенным пескоструйным рисунком эффектно смотрится в интерьере и скрывает прозрачность стекла.</div> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="PRINT_TYPE" id="print-type-139" value="139" data-price="1500"> <label for="print-type-139"> Крашеное Ral </label> </div> <div class="info"> <div class="info__toggle"></div> <div class="info__content">Покраска стекла в любой цвет по шкале RAL может быть выполнена несколькими способами: нанесение на стекло через краскопульт предварительно отколерованных эмалевых красок или нанесение на стекло цветного изображение посредством фотопечати. </div> </div> </div> <div class="group group_size_sm block__info"> <div class="radio"> <input type="radio" name="PRINT_TYPE" id="print-type-119" value="119" data-price="0" checked=""> <label for="print-type-119"> Без печати </label> </div> </div> <p>Рисунок на стекло может наносить несколькими способами. Или посредством нанесения на стекло пескоструйной обработки или посредством химического матирования. Цена за квадратный метр может меняться от способа нанесения рисунка и сложности наносимого рисунка</p> </div> </div> </div> <script> var PrintTypeWidget = function(holder) { this.holder = holder; }; PrintTypeWidget.prototype.getValue = function () { return this.holder.find('input[name="PRINT_TYPE"]:checked').val(); }; PrintTypeWidget.prototype.getPrice = function () { return parseInt(this.holder.find('input[name="PRINT_TYPE"]:checked').data('price')); }; PrintTypeWidget.prototype.getTextView = function () { return $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); }; $(function() { calc.registerWidget('print_type', new PrintTypeWidget($('#widget_print_type'))); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_handle-type step-3" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Тип ручки </div> <div class="block__content"> <div class="block-thumb-selector"> <div class="row grid block-thumb-selector__items"> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="184" data-price="0" data-multiplier="0" data-name="Без ручки"> <img src="/upload/iblock/f97/f97166a5d5395cb668d77653a976e642.png" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="140" data-price="1650" data-multiplier="3" data-name="Ручка-скоба"> <img src="/upload/iblock/65a/65a9f1e67b54bd19cb88688d49159ddd.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="141" data-price="2483" data-multiplier="3" data-name="Ручка-скоба 2"> <img src="/upload/iblock/00a/00af05e4222463e8090c1a0583c1e9a5.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="142" data-price="1828" data-multiplier="3" data-name="Ручка скоба 3"> <img src="/upload/iblock/306/306edca41741e5b5d14177ce02e08fd4.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="173" data-price="1992" data-multiplier="3" data-name="Кноб 6"> <img src="/upload/iblock/5a7/5a7d2b8e237027699e0674d4b355ac71.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="180" data-price="1014" data-multiplier="3" data-name="Кнбо 12"> <img src="/upload/iblock/244/2443d9829f65f9cf855e9d3feaf09158.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="179" data-price="1014" data-multiplier="3" data-name="Кноб 11"> <img src="/upload/iblock/fef/feffabb3b5595e8a2adde0c2b4035a92.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="178" data-price="1014" data-multiplier="3" data-name="Кноб 10"> <img src="/upload/iblock/fa8/fa8d656f90b3d3be21b7406b685952eb.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="177" data-price="1014" data-multiplier="3" data-name="Кноб 8"> <img src="/upload/iblock/047/047b145f42877e3c2f3649075fc80ce2.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="176" data-price="1014" data-multiplier="3" data-name="Кноб 9"> <img src="/upload/iblock/296/296d6f419bda5f550af3fb2003035b7c.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="175" data-price="1014" data-multiplier="3" data-name="Кноб 8"> <img src="/upload/iblock/3ae/3aec9b7836726d4429fd4c310e955ba5.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="174" data-price="1014" data-multiplier="3" data-name="Кноб 7"> <img src="/upload/iblock/61c/61c2612d6160241515672e7d2f71233a.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="164" data-price="6841" data-multiplier="3" data-name="Нажимная без замка"> <img src="/upload/iblock/c4f/c4f65035c8602df688a87ea27eefafef.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="172" data-price="1765" data-multiplier="3" data-name="Кноб 5"> <img src="/upload/iblock/dc4/dc4414ad54b978b5f48812af0deb8c82.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="171" data-price="1014" data-multiplier="3" data-name="Кноб 4"> <img src="/upload/iblock/7b2/7b25743763d8d2988f15e73524c8659c.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="170" data-price="2008" data-multiplier="3" data-name="Кноб 3"> <img src="/upload/iblock/080/0803aa28a252c5fd91b45748830e0754.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="169" data-price="3088" data-multiplier="3" data-name="Кноб "> <img src="/upload/iblock/2a2/2a27567e21e91451765ea77455f63d08.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="168" data-price="2534" data-multiplier="3" data-name="Скоба 6"> <img src="/upload/iblock/e12/e127c1a23f398b92b1df009c35b8ab66.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="167" data-price="5648" data-multiplier="3" data-name="Скоба 5"> <img src="/upload/iblock/8c7/8c7ea2145060018343742e694584f2fa.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="166" data-price="1709" data-multiplier="3" data-name="Скоба 4"> <img src="/upload/iblock/11c/11c83492f151c53bc34f88d5b1de4eab.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> <div class="col col_size_3 grid-cell block-thumb-selector__item"> <div class="block-thumb-selector__inner" data-id="165" data-price="7061" data-multiplier="3" data-name="Ручка нажимная с замком"> <img src="/upload/iblock/353/353ab5e6f6297a65bec8a7955242f050.jpg" alt="Ручка" class="block-thumb-selector__image"> </div> </div> </div> </div> </div> </div> </div> <script type="text/javascript"> var HandleTypeWidget = function (holder) { this.holder = holder; }; HandleTypeWidget.prototype.getData = function () { var result = { success: true }; result.id = this.holder.find('.block-thumb-selector__inner_active').data('id'); if (result.id) { result.price = parseInt(this.holder.find('.block-thumb-selector__inner_active').data('price')); result.multiplier = parseFloat(this.holder.find('.block-thumb-selector__inner_active').data('multiplier')); result.name = this.holder.find('.block-thumb-selector__inner_active').data('name'); } else { result.success = false; } return result; }; HandleTypeWidget.prototype.getTextView = function () { var data = this.getData(); return "Ручка: " + data.name; }; HandleTypeWidget.prototype.setHandlesVisibility = function (flag) { if (flag === true) { this.holder.find('.block-thumb-selector__item').show(); } else { this.holder.find('.block-thumb-selector__item:gt(0)').hide(); this.holder.find('.block-thumb-selector__inner:first').click(); } }; $(function() { var block = $('.block_type_handle-type'), items = block.find('.block-thumb-selector__inner'); items.on('click', function() { items.removeClass('block-thumb-selector__inner_active'); $(this).addClass('block-thumb-selector__inner_active'); calculate(); }); calc.registerWidget('handle_type', new HandleTypeWidget(block)); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_handle-color step-3" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading block__heading_lg"> Цвет ручки </div> <div class="block__content"> <div class="row"> <div class="group group_size_sm col col_size_6"> <div class="radio"> <input type="radio" name="handle-color" id="handle-color-143" value="143" data-price="100"> <label for="handle-color-143"> Матовая нержавеющая сталь </label> </div> </div> <div class="group group_size_sm col col_size_6"> <div class="radio"> <input type="radio" name="handle-color" id="handle-color-144" value="144" data-price="200"> <label for="handle-color-144"> Другой цвет </label> </div> </div> </div> </div> <div class="block__footer"> </div> </div> </div> <script type="text/javascript"> var HandleColorWidget = function (holder) { this.holder = holder; }; HandleColorWidget.prototype.getData = function () { var result = { success: true }; var colorSel = this.holder.find('input[name="handle-color"]:checked'), color = colorSel.val(), colorPrice = colorSel.data('price'); if (!color) { result.success = false; } result.color = color; result.price = colorPrice; var sel = this.holder.find('.block-color-selector'); if (sel.length > 0) { result.customColorName = this.holder.find('.block-color-selector__inner_active').data('name'); } return result; }; HandleColorWidget.prototype.getTextView = function () { var data = this.getData(); var result = $.trim(this.holder.find('.block__heading').text()) + ": " + $.trim(this.holder.find('input[type="radio"]:checked + label').text()); if (data.customColorName) { result += ", выбранный цвет: " + data.customColorName; } return result; }; $(function() { var block = $('.block_type_handle-color'), items = block.find('.block-color-selector__inner'); block.find('input[name="handle-color"]').change(function() { var field = block.find('.block__footer'); if ($(this).prop('checked')) { $('.block-color-selector').hide(); $('.block-color-selector.block-color-' + $(this).val()).show(); } }); block.find('input[name="handle-color"]:first').prop('checked', true).change(); items.on('click', function() { items.removeClass('block-color-selector__inner_active'); $(this).addClass('block-color-selector__inner_active'); }); calc.registerWidget('handle_color', new HandleColorWidget(block)); }); </script> </div> </div> <div class="row"> <div class="col col_size_4 col_md_12"> <div class="block block_type_delivery step-3" id="widget_delivery" data-price-fix="1930" data-price-km="60" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading"> Доставка </div> <div class="block__content"> <div class="block__rows"> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="delivery" id="delivery-y" value="Y"> <label for="delivery-y"> Да </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="delivery" id="delivery-n" value="N" checked="checked"> <label for="delivery-n"> Нет </label> </div> </div> <div class="block__field" style="display: none;"> <div class="group group_size_sm"> <label class="label"> Расстояние от МКАД </label> <input type="text" class="control control_size_md" name="distance"> <span class="blue">км</span> </div> <div class="group group_size_sm"> по Москве – 1930 руб.<br> за пределами МКАД – 60 р. за 1 км </div> </div> </div> </div> </div> </div> <script type="text/javascript"> var DeliveryWidget = function (holder) { this.holder = holder; }; DeliveryWidget.prototype.getData = function () { var result = { success: true, enabled: $('#delivery-y').is(':checked') }; if (result.enabled) { result.distance = parseInt(this.holder.find('input[name="distance"]').val()); if (result.distance > 0 && !isNaN(result.distance)) { } else { result.distance = 0; } result.price = parseInt(this.holder.data('price-fix')) + (parseInt(this.holder.data('price-km')) * result.distance); } return result; }; DeliveryWidget.prototype.getTextView = function () { var data = this.getData(), result = ""; if (data.enabled) { result = "Доставка: да, расстояние: " + data.distance; } else { result = "Доставка: нет"; } return result; }; $(function() { var block = $('.block_type_delivery'); block.find('input[type="radio"]').change(function() { var field = $(this).closest('.block__rows').find('.block__field'); if ($(this).prop('checked') && $(this).val() == 'Y') { field.show(); if (calc.widgets.mount != void(0)) { calc.widgets.mount.hideDistanceBlock(); } // if (calc.widgets.metering != void(0)) { // calc.widgets.metering.hideDistanceBlock(); // } } else { field.hide(); if (calc.widgets.mount != void(0)) { calc.widgets.mount.showDistanceBlock(); } if (calc.widgets.metering != void(0)) { calc.widgets.metering.showDistanceBlock(); } } }); block.find('input[type="radio"]:checked').trigger('change'); calc.registerWidget('delivery', new DeliveryWidget($('#widget_delivery'))); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_mounting step-3" id="widget_mount" data-price-msk-meter="2000" data-price-msk-min="3000" data-price-region-meter="1000" data-price-region-min="4000" data-price-fix="1930" data-price-km="60" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading"> Монтаж </div> <div class="block__content"> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="mounting" id="mounting-1" value="1"> <label for="mounting-1"> В Москве </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="mounting" id="mounting-2" value="2"> <label for="mounting-2"> За пределами МКАД </label> </div> </div> <div class="group group_size_sm"> <div class="radio"> <input type="radio" name="mounting" id="mounting-3" value="3" checked="checked"> <label for="mounting-3"> Я сам поставлю </label> </div> </div> <div class="block__field" id="mount_distance" style="display: none;"> <div class="group group_size_sm"> <label class="label"> Расстояние от МКАД </label> <input type="text" class="control control_size_md" name="distance"> <span class="blue">км</span> </div> </div> </div> <div class="block__caption block__caption_size_sm"> Стоимость монтажа 1-ой одностворчатой двери - 2000 р, одной двустворчатой двери - 3000 р. Но не менее 7000 р. за выезд. </div> </div> </div> <script> var MountWidget = function (holder) { this.holder = holder; }; MountWidget.prototype.getData = function () { var result = { type: this.holder.find('input[name="mounting"]:checked').val(), distance: this.getDistance() }; return result; }; MountWidget.prototype.showDistanceBlock = function () { var data = this.getData(); if (data.type == 2) { $('#mount_distance').show(); } }; MountWidget.prototype.getDistance = function () { var type = this.holder.find('input[name="mounting"]:checked').val(), distance = 0; if (type == 2) { if (calc.widgets.delivery != void(0)) { var deliveryData = calc.widgets.delivery.getData(); if (!deliveryData.enabled) { distance = parseInt(this.holder.find('input[name="distance"]').val()); } else { distance = deliveryData.distance; } } else { throw new Error("No delivery widget"); } } if (isNaN(distance)) { distance = 0; } return distance; }; MountWidget.prototype.hideDistanceBlock = function () { $('#mount_distance').hide(); }; MountWidget.prototype.getPrice = function () { var sum = 0; if (calc.widgets.door_size != void(0)) { var data = calc.widgets.door_size.getData(), myData = this.getData(); if (data.type == 1) { sum = 2000; } else if (data.type == 2) { sum = 3000; } // if (myData.type == 2) { // var distance = this.getDistance(), // priceKm = parseInt(this.holder.data('price-km')); // // sum += (distance * priceKm); // } } if (myData.type == 3) { sum = 0; } return sum; }; MountWidget.prototype.getTextView = function () { var data = this.getData(); if (data.type == 1) { return "Монтаж: МСК"; } if (data.type == 2) { return "Монтаж: выезд за МКАД, расстояние: " + this.getDistance(); } else { return "Монтаж: сам"; } }; $(function () { var holder = $('#widget_mount'); calc.registerWidget('mount', new MountWidget(holder)); holder.find('input[name="mounting"]').each(function() { $(this).on('change', function () { if ($(this).val() == 2) { if (calc.widgets.delivery != void(0)) { var deliveryData = calc.widgets.delivery.getData(); if (!deliveryData.enabled) { calc.widgets.mount.showDistanceBlock(); } else { calc.widgets.mount.hideDistanceBlock(); } } else { calc.widgets.mount.hideDistanceBlock(); } } else { calc.widgets.mount.hideDistanceBlock(); } }); }); }); </script> </div> <div class="col col_size_4 col_md_12"> <div class="block block_type_price step-3" style="display: none;"> <div class="block__inner"> <div class="h2 block__heading"> Стоимость заказа </div> <div class="block__content"> <div class="block__price"></div> <a href="javascript:void(0);" class="button" onclick="if (calc.enabled()) $.mw.open('calc_request');"> Заказать </a> <div> *Цена является ориентировочной и после обсуждения с менеджером может быть скорректирована </div> </div> </div> </div> <script> var ResultWidget = function (holder) { this.holder = holder; }; ResultWidget.prototype.number_format = function ( number, decimals, dec_point, thousands_sep ) { // Format a number with grouped thousands // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfix by: Michael White (http://crestidg.com) var i, j, kw, kd, km; // input sanitation & defaults if( isNaN(decimals = Math.abs(decimals)) ){ decimals = 2; } if( dec_point == undefined ){ dec_point = ","; } if( thousands_sep == undefined ){ thousands_sep = "."; } i = parseInt(number = (+number || 0).toFixed(decimals)) + ""; if( (j = i.length) > 3 ){ j = j % 3; } else{ j = 0; } km = (j ? i.substr(0, j) + thousands_sep : ""); kw = i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousands_sep); //kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).slice(2) : ""); kd = (decimals ? dec_point + Math.abs(number - i).toFixed(decimals).replace(/-/, 0).slice(2) : ""); return km + kw + kd; }; ResultWidget.prototype.setPrice = function (p) { this.holder.find('.block__price').text('≈ ' + this.number_format(p, 0, ',', ' ') + ' руб*'); }; ResultWidget.prototype.getTextView = function () { return "Стоимость: " + this.holder.find('.block__price').text(); }; $(function() { calc.registerWidget('result', new ResultWidget($('.block_type_price'))); }); </script> </div> </div> </div> </div> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator(), calculate = function () { }; </script> <script> var calc = new Calculator("Скинали"), calculate = function () { var sum = {}; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); if (key == 'panel_size') { var data = calc.widgets[key].getData(); if (data.success) { var square = 0; for (var k in data.items) { square += data.items[k]['width'] * data.items[k]['height']; } square = square * 1e-6; sum[key] = square * (calc.widgets['glass_type'].getPrice() + calc.widgets['print_type'].getPrice()); } else { calc.highlight(calc.widgets[key], true); } } else if (key == 'rail_sockets') { sum[key] = calc.widgets[key].getPrice(); } else if (key == 'light') { var lightData = calc.widgets[key].getData(), sizeData = calc.widgets['panel_size'].getData(); if (sizeData.success) { var fullWidth = 0, fullLength = 0, square = calc.widgets['panel_size'].getSquare(); for (var k in sizeData.items) { fullWidth += parseInt(sizeData.items[k]['width']); fullLength += parseInt(sizeData.items[k]['width']) + parseInt(sizeData.items[k]['height']); } fullWidth = fullWidth * 1e-3; // пользователь вводит в миллиметрах! fullLength = fullLength * 1e-3; // пользователь вводит в миллиметрах! // console.log('fullWidth', fullWidth); var s = 0; if (lightData.clamping) { // console.log('lightData.clamping'); if (lightData.clamping.value == 124) { // console.log('lightData.clamping = 124'); var clampCounter = 0; for (var k in sizeData.items) { var c = Math.round(sizeData.items[k]['width'] * 1e-3) * 2; // по 2 крепления на погонный метр: сверху + снизу. if (c < 4) { c = 4; } clampCounter += c; } s += parseInt(lightData.clamping.price) * parseInt(clampCounter); } else { // console.log('lightData.clamping.price', lightData.clamping.price); s += parseInt(lightData.clamping.price) * parseFloat(square); } } sum['clamping'] = s; if (lightData.light) { sum['light'] = lightData.light.price * fullWidth; } } else { calc.highlight(calc.widgets[key], true); } } else if (key == 'metering') { // var data = calc.widgets[key].getData(); // sum[key] = data.price; sum[key] = calc.widgets[key].getPrice(); } else if (key == 'delivery') { var data = calc.widgets[key].getData(); if (data.enabled) { sum[key] = data.price; } else { sum[key] = 0; } } else if (key == 'mount') { sum[key] = calc.widgets[key].getPrice(); } } if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); calc.enabled(true); }); </script> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери раздвижные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Стоимость механизма.. if (calc.widgets.mechanism != void(0)) { data = calc.widgets.mechanism.getData(); sum['mechanism'] = data.price * doorCount; } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = sum['glass'] * square; sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator("Двери распашные"), calculate = function () { var sum = {}, doorCount = 1, data = null; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.type > 2) { data.type = 2; // тут не только тип, но и кол-во дверей.. } doorCount = data.type; if (!data.success) { calc.highlight(calc.widgets.door_size, true); } } // Считаем петли.. if (calc.widgets.hinge != void(0)) { data = calc.widgets.hinge.getData(); sum['hinge'] = data.price * data.count * doorCount; } // Для одностворчатых дверей плюсуем раму.. if (doorCount == 1) { if (calc.widgets.door_size != void(0)) { data = calc.widgets.door_size.getData(); if (data.frame) { sum['frame'] = parseInt(data.frame.price); } } } // тип + толщина.. if (calc.widgets.glass_type != void(0) && calc.widgets.thickness != void(0)) { var typeData = calc.widgets.glass_type.getData(), thicknessData = calc.widgets.thickness.getData(), priceList = calc.widgets.thickness.getPriceList(), key = "", ok = true; if (typeData.value != void(0)) { key += typeData.value + "_"; if (thicknessData.value != void(0)) { key += thicknessData.value; } else { ok = false; calc.highlight(calc.widgets.thickness, true); } } else { ok = false; calc.highlight(calc.widgets.glass_type, true); } if (!ok) { return; } sum['glass'] = priceList[key]; } // Если нашли стоимость стекла.. if (sum.hasOwnProperty('glass')) { if (calc.widgets.door_size != void(0)) { var square = calc.widgets.door_size.getSquare(); sum['glass_full'] = Math.round(sum['glass'] * square); sum['glass'] = 0; // Вид печати sum['print_type'] = calc.widgets['print_type'].getPrice() * square; } } // Тип ручки if (calc.widgets.handle_type != void(0)) { data = calc.widgets.handle_type.getData(); if (data.id != void(0)) { sum['handle_type'] = data.price * doorCount; } else { calc.highlight(calc.widgets.handle_type, true); return; } } // Цвет ручки.. if (calc.widgets.handle_color != void(0)) { data = calc.widgets.handle_color.getData(); if (data.color != void(0)) { // Для "другого" цвета умножаем стоимость ручки на мультипликатор.. if (data.color == "144") { data = calc.widgets.handle_type.getData(); sum['handle_type'] = sum['handle_type'] * data.multiplier; } } } // Доставка if (calc.widgets.delivery != void(0)) { var data = calc.widgets.delivery.getData(); if (data.enabled) { sum['delivery'] = data.price; } else { sum['delivery'] = 0; } } // Монтаж if (calc.widgets.mount != void(0)) { sum['mount'] = calc.widgets.mount.getPrice(); } console.log(sum); if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); }); </script> <script> var calc = new Calculator(), calculate = function () { }; </script> <script> var calc = new Calculator("Скинали"), calculate = function () { var sum = {}; for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); } for (var key in calc.widgets) { calc.highlight(calc.widgets[key], false); if (key == 'panel_size') { var data = calc.widgets[key].getData(); if (data.success) { var square = 0; for (var k in data.items) { square += data.items[k]['width'] * data.items[k]['height']; } square = square * 1e-6; sum[key] = square * (calc.widgets['glass_type'].getPrice() + calc.widgets['print_type'].getPrice()); } else { calc.highlight(calc.widgets[key], true); } } else if (key == 'rail_sockets') { sum[key] = calc.widgets[key].getPrice(); } else if (key == 'light') { var lightData = calc.widgets[key].getData(), sizeData = calc.widgets['panel_size'].getData(); if (sizeData.success) { var fullWidth = 0, fullLength = 0, square = calc.widgets['panel_size'].getSquare(); for (var k in sizeData.items) { fullWidth += parseInt(sizeData.items[k]['width']); fullLength += parseInt(sizeData.items[k]['width']) + parseInt(sizeData.items[k]['height']); } fullWidth = fullWidth * 1e-3; // пользователь вводит в миллиметрах! fullLength = fullLength * 1e-3; // пользователь вводит в миллиметрах! // console.log('fullWidth', fullWidth); var s = 0; if (lightData.clamping) { // console.log('lightData.clamping'); if (lightData.clamping.value == 124) { // console.log('lightData.clamping = 124'); var clampCounter = 0; for (var k in sizeData.items) { var c = Math.round(sizeData.items[k]['width'] * 1e-3) * 2; // по 2 крепления на погонный метр: сверху + снизу. if (c < 4) { c = 4; } clampCounter += c; } s += parseInt(lightData.clamping.price) * parseInt(clampCounter); } else { // console.log('lightData.clamping.price', lightData.clamping.price); s += parseInt(lightData.clamping.price) * parseFloat(square); } } sum['clamping'] = s; if (lightData.light) { sum['light'] = lightData.light.price * fullWidth; } } else { calc.highlight(calc.widgets[key], true); } } else if (key == 'metering') { // var data = calc.widgets[key].getData(); // sum[key] = data.price; sum[key] = calc.widgets[key].getPrice(); } else if (key == 'delivery') { var data = calc.widgets[key].getData(); if (data.enabled) { sum[key] = data.price; } else { sum[key] = 0; } } else if (key == 'mount') { sum[key] = calc.widgets[key].getPrice(); } } if (calc.enabled()) { var s = 0; for (var key in sum) { if (!isNaN(sum[key])) { s += sum[key]; } else { console.warn("One of items (" + key + ") is NaN!"); } } calc.widgets.result.setPrice(s); } return sum; }; $(function() { $('.calculator') .on('mouseenter', '.info__toggle', function() { var holder = $(this).closest('.info'), element = holder.find('.info__content'); element.show().position({ of: holder, my: 'left top', at: 'left bottom', collision: 'flip flip' }); }) .on('mouseleave', '.info__toggle', function() { $(this).closest('.info').find('.info__content').hide(); }); $('.calculator').on('change', ':input', function (e) { calculate(); }); calc.enabled(true); }); </script> </div>