<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 id="calculator_skinali" class="calculator">
<div class="calculator__content">
<div class="row">
<div class="col col_size_4 col_md_12">
<div id="widget_calc_type" class="block block_type_product-type">
<div class="block__inner">
<div class="h2 block__heading block__heading_lg">Выбор изделия</div>
<div class="block__content"><form action="" method="GET" name="form-step1">
<div class="group group_size_sm">
<div class="radio"><input id="product-type-108" name="CALC_TYPE" type="radio" value="shower" />
<label for="product-type-108">
Душевая кабина </label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="product-type-110" checked="checked" name="CALC_TYPE" type="radio" value="skinali" />
<label for="product-type-110">
Скинали </label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="product-type-109" name="CALC_TYPE" type="radio" value="doors" />
<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 id="widget_glass_type" class="block block_type_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 id="glass-type-115" name="GLASS_TYPE" type="radio" value="115" data-price="2600" />
<label for="glass-type-115">
Обычное </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 id="glass-type-116" name="GLASS_TYPE" type="radio" value="116" data-price="3850" />
<label for="glass-type-116">
Осветленное </label></div>
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">Характеризуется стопроцентной прозрачностью, а потому способно точно передавать изображение. Однако стоимость данного стекла значительно дороже обычного.</div>
</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_4 col_md_12">
<div id="widget_print_type" class="block block_type_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 id="print-type-117" checked="checked" name="PRINT_TYPE" type="radio" 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 id="print-type-118" name="PRINT_TYPE" type="radio" value="118" data-price="1500" />
<label for="print-type-118">
Однотонная краска </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 id="print-type-119" name="PRINT_TYPE" type="radio" value="119" data-price="0" />
<label for="print-type-119">
Без печати </label></div>
</div>
Рисунок на стекло может наносить несколькими способами. Или посредством нанесения на стекло пескоструйной обработки или посредством химического матирования. Цена за квадратный метр может меняться от способа нанесения рисунка и сложности наносимого рисунка
</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>
<div class="row">
<div class="col col_size_8 col_md_12">
<div id="widget_panel_size" class="block block_type_panel-size">
<div class="block__inner">
<div class="h2 block__heading">Количество панелей / размер</div>
<div class="block__content">
<div class="block__rows">
<div class="row">
<div class="col col_size_3 col_xs_5">
<div class="block__caption">Количество:</div>
</div>
<div class="col col_size_9 col_xs_7">
<div class="block__caption">Размер:</div>
</div>
</div>
<div class="group group_size_xs row">
<div class="col col_size_3 col_xs_5 block__row block__row_quantity">
<div class="radio"><input id="panel-quantity-1" checked="checked" name="panel-quantity" type="radio" value="1" />
<label for="panel-quantity-1">
1
</label></div>
</div>
<div class="col col_size_9 col_xs_7 block__row block__row_size" style="display: block;">
<div class="row">
<div class="col col_size_6 col_sm_12"><label class="label">
Высота <span class="blue">1</span>
</label>
<input class="control control_size_md" name="height" type="text" />
<span class="blue">мм</span></div>
<div class="col col_size_6 col_sm_12"><label class="label">
Длина <span class="blue">1</span>
</label>
<input class="control control_size_md" name="width" type="text" />
<span class="blue">мм</span></div>
</div>
</div>
</div>
<div class="group group_size_xs row">
<div class="col col_size_3 col_xs_5 block__row block__row_quantity">
<div class="radio"><input id="panel-quantity-2" name="panel-quantity" type="radio" value="2" />
<label for="panel-quantity-2">
2
</label></div>
</div>
<div class="col col_size_9 col_xs_7 block__row block__row_size">
<div class="row">
<div class="col col_size_6 col_sm_12"><label class="label">
Высота <span class="blue">2</span>
</label>
<input class="control control_size_md" name="height" type="text" />
<span class="blue">мм</span></div>
<div class="col col_size_6 col_sm_12"><label class="label">
Длина <span class="blue">2</span>
</label>
<input class="control control_size_md" name="width" type="text" />
<span class="blue">мм</span></div>
</div>
</div>
</div>
<div class="group group_size_xs row">
<div class="col col_size_3 col_xs_5 block__row block__row_quantity">
<div class="radio"><input id="panel-quantity-3" name="panel-quantity" type="radio" value="3" />
<label for="panel-quantity-3">
3
</label></div>
</div>
<div class="col col_size_9 col_xs_7 block__row block__row_size">
<div class="row">
<div class="col col_size_6 col_sm_12"><label class="label">
Высота <span class="blue">3</span>
</label>
<input class="control control_size_md" name="height" type="text" />
<span class="blue">мм</span></div>
<div class="col col_size_6 col_sm_12"><label class="label">
Длина <span class="blue">3</span>
</label>
<input class="control control_size_md" name="width" type="text" />
<span class="blue">мм</span></div>
</div>
</div>
</div>
<div class="group group_size_xs row">
<div class="col col_size_3 col_xs_5 block__row block__row_quantity">
<div class="radio"><input id="panel-quantity-4" name="panel-quantity" type="radio" value="4" />
<label for="panel-quantity-4">
4
</label></div>
</div>
<div class="col col_size_9 col_xs_7 block__row block__row_size">
<div class="row">
<div class="col col_size_6 col_sm_12"><label class="label">
Высота <span class="blue">4</span>
</label>
<input class="control control_size_md" name="height" type="text" />
<span class="blue">мм</span></div>
<div class="col col_size_6 col_sm_12"><label class="label">
Длина <span class="blue">4</span>
</label>
<input class="control control_size_md" name="width" type="text" />
<span class="blue">мм</span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function()
{
var block = $('.block_type_panel-size'),
rows = block.find('.block__row_size');
block.find('input[type="radio"]').change(function()
{
rows.hide().filter(':lt(' + $(this).val() + ')').show();
});
calc.registerWidget('panel_size', new PanelSizeWidget($('#widget_panel_size')));
});
var PanelSizeWidget = function (holder) {
this.holder = holder;
holder.find('input[type="text"]').each(function() {
$(this).on('focusout', function () {
if ($(this).val() == '') {
$(this).parent().addClass('has-error');
}
else {
$(this).parent().removeClass('has-error');
}
});
});
};
PanelSizeWidget.prototype.getData = function () {
var result = {
success: true,
items: []
},
rows = this.holder.find('.block__row_size:visible');
result.success = rows.find('.has-error').length == 0;
rows.each(function () {
var w = $(this).find('input[name="width"]').val(),
h = $(this).find('input[name="height"]').val();
result.items.push({
width: w,
height: h
});
if (w == 0 || h == 0) {
result.success = false;
}
});
return result;
};
PanelSizeWidget.prototype.getSquare = function () {
var square = 0;
this.holder.find('.block__row_size:visible').each(function () {
var w = $(this).find('input[name="width"]').val(),
h = $(this).find('input[name="height"]').val();
square += w * h;
});
return square * 1e-6;
};
PanelSizeWidget.prototype.getTextView = function () {
var result = $.trim(this.holder.find('.block__heading').text()) + ": " + $('input[name="panel-quantity"]:checked').val() + "\nРазмеры:\n",
data = this.getData();
if (data.success) {
for (var key in data.items) {
result += (parseInt(key)+1) + ". Длина: " + data.items[key]['width'] + ", Высота: " + data.items[key]['height'] + "\n";
}
}
return result;
};
</script>
</div>
<div class="col col_size_4 col_md_12">
<div id="widget_rail_sockets" class="block block_type_sockets">
<div class="block__inner">
<div class="h2 block__heading">Рейлинги / розетки</div>
<div class="block__content">
<div class="group group_size_sm group__rail" data-price="600">
<div class="block__info">
<div class="block__caption">Монтаж рейлингов:</div>
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">Данная опция подразумевает высверливание в стекле отверстий необходимого диаметра под рейлинги Клиента.</div>
</div>
</div>
<div class="block__rows">
<div class="group group_size_sm block__row">
<div class="radio"><input id="rails-y" name="rail" type="radio" value="Y" />
<label for="rails-y">
Да
</label></div>
<div class="block__field" style="display: none;"><input class="control control_size_md" max="99" min="0" name="rail_counter" type="number" />
<span class="blue">шт</span></div>
</div>
<div class="group group_size_sm block__row">
<div class="radio"><input id="rails-n" checked="checked" name="rail" type="radio" value="N" />
<label for="rails-n">
Нет
</label></div>
</div>
</div>
</div>
<div class="group group_size_sm group__socket" data-price="600">
<div class="block__caption">Выпил под розетки:</div>
<div class="block__rows">
<div class="group group_size_sm block__row">
<div class="radio"><input id="sockets-y" name="socket" type="radio" value="Y" />
<label for="sockets-y">
Да
</label></div>
<div class="block__field" style="display: none;"><input class="control control_size_md" max="99" min="0" name="socket_counter" type="number" />
<span class="blue">шт</span></div>
</div>
<div class="group group_size_sm block__row">
<div class="radio"><input id="sockets-n" checked="checked" name="socket" type="radio" value="N" />
<label for="sockets-n">
Нет
</label></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var RailSocketWidget = function (holder) {
this.holder = holder;
this.holder.find('input[type="text"], input[type="number"]').each(function() {
$(this).on('focusout', function () {
if ($(this).val() == '') {
$(this).parent().addClass('has-error');
}
else {
$(this).parent().removeClass('has-error');
}
});
});
};
RailSocketWidget.prototype.getData = function () {
var result = {
rail: 0,
socket: 0
};
if (this.holder.find('input[name="rail"]:checked').val() == 'Y') {
result.rail = parseInt(this.holder.find('input[name="rail_counter"]').val());
if (isNaN(result.rail)) {
result.rail = 0;
}
}
else {
result.rail = 0;
}
if (this.holder.find('input[name="socket"]:checked').val() == 'Y') {
result.socket = parseInt(this.holder.find('input[name="socket_counter"]').val());
if (isNaN(result.socket)) {
result.socket = 0;
}
}
else {
result.socket = 0;
}
return result;
};
RailSocketWidget.prototype.getPrice = function () {
var railPrice = parseInt(this.holder.find('.group__rail').data('price')),
socketPrice = parseInt(this.holder.find('.group__socket').data('price')),
price = 0,
data = this.getData();
if (data.rail > 0) {
price += data.rail * railPrice;
}
if (data.socket > 0) {
price += data.socket * socketPrice;
}
return price;
};
RailSocketWidget.prototype.getTextView = function () {
var data = this.getData();
return "Монтаж рейлингов: " + data.rail + " шт., розеток: " + data.socket + " шт.";
};
$(function()
{
var block = $('.block_type_sockets');
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();
}
else
{
field.hide();
}
});
block.find('input[type="radio"]').each(function() {
$(this).trigger('change');
});
calc.registerWidget('rail_sockets', new RailSocketWidget($('#widget_rail_sockets')));
});
</script>
</div>
</div>
<div class="row">
<div class="col col_size_4 col_md_12">
<div id="widget_light" class="block block_type_light">
<div class="block__inner">
<div class="h2 block__heading">Подсветка / тип крепления</div>
<div class="block__content">
<div class="group group_size_lg param-block" data-block="clamping">
<div class="block__caption block__info">Тип крепления:</div>
<div class="block__rows">
<div class="row">
<div class="col col_size_6">
<div class="group group_size_sm block__info">
<div class="radio"><input id="clamping-123" checked="checked" name="clamping" type="radio" value="123" data-price="0" />
<label for="clamping-123">
Клей </label></div>
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">Использование данного типа крепления требует выровненные и предварительно подготовленные поверхности стен. Необходимо учитывать, что в случае необходимости демонтировать изделие, данные работы будет выполнить достаточно сложно.</div>
</div>
</div>
</div>
<div class="col col_size_6">
<div class="group group_size_sm block__info">
<div class="radio"><input id="clamping-124" name="clamping" type="radio" value="124" data-price="310" />
<label for="clamping-124">
Сквозное </label></div>
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">Для такого крепежа в стекле высверливаются отверстия и изделие закрепляется на стену посредством специальных крепежей.</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="group group_size_lg param-block" data-block="light">
<div class="block__caption block__info">
Подсветка:
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">123</div>
</div>
</div>
<div class="block__rows">
<div class="row">
<div class="col col_size_6">
<div class="group group_size_sm block__info">
<div class="radio"><input id="light-120" name="light" type="radio" value="120" data-price="1000" />
<label for="light-120">
Многоцветная </label></div>
</div>
<div class="group group_size_sm block__info">
<div class="radio"><input id="light-121" name="light" type="radio" value="121" data-price="800" />
<label for="light-121">
Одноцветная </label></div>
</div>
</div>
<div class="col col_size_6">
<div class="group group_size_sm block__info">
<div class="radio"><input id="light-122" checked="checked" name="light" type="radio" value="122" data-price="0" />
<label for="light-122">
Без подсветки </label></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
var LightWidget = function (holder) {
this.holder = holder;
};
LightWidget.prototype.getData = function () {
var result = {
success: true
};
this.holder.find('.param-block').each(function() {
var blockName = $(this).data('block');
if (blockName.length > 0) {
var checkedSel = $(this).find('input[name="' + blockName + '"]:checked');
if (checkedSel.val() != void(0)) {
result[blockName] = {
value: checkedSel.val(),
price: checkedSel.data('price')
};
}
else {
result.success = false;
}
}
});
return result;
};
LightWidget.prototype.getTextView = function () {
var result = "";
this.holder.find('.param-block').each(function() {
var blockName = $(this).data('block');
if (blockName.length > 0) {
var checkedSel = $(this).find('input[name="' + blockName + '"]:checked');
if (checkedSel.val() != void(0)) {
result += $.trim($(this).find('.block__caption').text()) + ": " + $.trim(checkedSel.find('+ label').text()) + "\n";
}
}
});
return result;
};
$(function() {
calc.registerWidget('light', new LightWidget($('#widget_light')));
});
</script>
</div>
<div class="col col_size_4 col_md_12">
<div id="widget_metering" class="block block_type_metering" data-moscow-price="1500" data-price-region="60">
<div class="block__inner">
<div class="h2 block__heading block__info">
Замер
<div class="info">
<div class="info__toggle"></div>
<div class="info__content">В случае дальнейшего заключении Договора сумма замера вычитается из общей стоимости Договора</div>
</div>
</div>
<div class="block__content">
<div class="block__rows">
<div class="group group_size_sm">
<div class="radio"><input id="metering-1" name="metering" type="radio" value="1" />
<label for="metering-1">В Москве</label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="metering-2" name="metering" type="radio" value="2" />
<label for="metering-2">За пределами МКАД</label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="metering-3" checked="checked" name="metering" type="radio" value="3" />
<label for="metering-3">Не надо</label></div>
</div>
<div id="metering_distance" class="block__field" style="display: none;">
<div class="group group_size_sm"><label class="label">
Расстояние от МКАД
</label>
<input class="control control_size_md" name="distance" type="text" />
<span class="blue">км</span></div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var MeteringWidget = function (holder) {
this.holder = holder;
};
MeteringWidget.prototype.getData = function () {
// var result = {
// metering: $('#metering-y').is(':checked'),
// price: 0
// };
// if (result.metering) {
// if (calc.widgets.delivery != void(0)) {
// var deliveryData = calc.widgets.delivery.getData();
// if (deliveryData.enabled) {
// if (deliveryData.distance) {
// var distance = parseInt(deliveryData.distance);
//
// if (distance > 0 && !isNaN(distance)) {
// result.price = parseInt(this.holder.data('moscow-price')) + (parseInt(this.holder.data('price-region')) * distance);
// }
// else {
//
// }
// }
// else {
// result.price = parseInt(this.holder.data('moscow-price'));
// }
// }
// }
// }
// return result;
var result = {
type: this.holder.find('input[name="metering"]:checked').val(),
distance: this.getDistance()
};
return result;
};
MeteringWidget.prototype.showDistanceBlock = function () {
var data = this.getData();
if (data.type == 2) {
$('#metering_distance').show();
}
};
MeteringWidget.prototype.hideDistanceBlock = function () {
$('#metering_distance').hide();
};
MeteringWidget.prototype.getDistance = function () {
var type = this.holder.find('input[name="metering"]:checked').val(),
distance = 0;
if (type == 2) {
distance = parseInt(this.holder.find('input[name="distance"]').val());
// 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;
};
MeteringWidget.prototype.getPrice = function () {
var price = 0,
data = this.getData(),
fixPrice = parseInt(this.holder.data('moscow-price')),
perKm = parseInt(this.holder.data('price-region'));
if (data.type == 1 || data.type == 2) {
price += fixPrice;
var distance = this.getDistance();
if (distance > 0) {
price += perKm * distance;
}
}
return price;
};
MeteringWidget.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_metering');
calc.registerWidget('metering', new MeteringWidget(holder));
holder.find('input[name="metering"]').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.metering.showDistanceBlock();
// }
// else {
// calc.widgets.metering.hideDistanceBlock();
// }
// }
// else {
// calc.widgets.metering.hideDistanceBlock();
// }
calc.widgets.metering.showDistanceBlock();
}
else {
calc.widgets.metering.hideDistanceBlock();
}
});
});
});
</script>
</div>
<div class="col col_size_4 col_md_12">
<div id="widget_delivery" class="block block_type_delivery" data-price-fix="1930" data-price-km="60">
<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 id="delivery-y" name="delivery" type="radio" value="Y" />
<label for="delivery-y">
Да
</label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="delivery-n" checked="checked" name="delivery" type="radio" value="N" />
<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 class="control control_size_md" name="distance" type="text" />
<span class="blue">км</span></div>
<div class="group group_size_sm">по Москве – 1930 руб.
за пределами МКАД – 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>
<div class="row">
<div class="col col_size_4 col_md_12">
<div id="widget_mount" class="block block_type_mounting" 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">
<div class="block__inner">
<div class="h2 block__heading">Монтаж</div>
<div class="block__content">
<div class="group group_size_sm">
<div class="radio"><input id="mounting-1" name="mounting" type="radio" value="1" />
<label for="mounting-1">
В Москве
</label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="mounting-2" name="mounting" type="radio" value="2" />
<label for="mounting-2">
За пределами МКАД
</label></div>
</div>
<div class="group group_size_sm">
<div class="radio"><input id="mounting-3" checked="checked" name="mounting" type="radio" value="3" />
<label for="mounting-3">
Я сам поставлю
</label></div>
</div>
<div id="mount_distance" class="block__field" style="display: none;">
<div class="group group_size_sm"><label class="label">
Расстояние от МКАД
</label>
<input class="control control_size_md" name="distance" type="text" />
<span class="blue">км</span></div>
</div>
</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 price = 0,
data = this.getData(),
perMeter,
minPrice;
var s = calc.widgets.panel_size.getSquare();
if (data.type == 1) {
if (calc.widgets.panel_size != void(0)) {
perMeter = parseInt(this.holder.data('price-msk-meter'));
minPrice = parseInt(this.holder.data('price-msk-min'));
price = s * perMeter;
if (price < minPrice) {
price = minPrice;
}
}
}
else if (data.type == 2) {
var distance = this.getDistance(),
priceKm = parseInt(this.holder.data('price-km'));
perMeter = parseInt(this.holder.data('price-region-meter'));
minPrice = parseInt(this.holder.data('price-region-min'));
if (calc.widgets.delivery.getData().enabled) {
price = (Math.round(s * 10) / 10) * perMeter;
}
// else {
// console.log(distance, priceKm, s, perMeter);
// price = (distance * priceKm) + (s * perMeter);
// }
if (price < minPrice) {
price = minPrice;
}
}
return price;
};
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_8 col_md_12">
<div class="block block_type_price">
<div class="block__inner">
<div class="h2 block__heading">Стоимость заказа</div>
<div class="block__content">
<div class="block__price"></div>
<a class="button">
Заказать
</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 = {};
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 () {
};
</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 () {
};
</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.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 () {
};
</script>
<script>
var calc = new Calculator("Душ"),
calculate = function () {
var sum = {},
doorCount = Math.abs(calc.widgets.shower_size.getDoorsCount());
for (var key in calc.widgets) {
calc.highlight(calc.widgets[key], false);
}
// тип + толщина..
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.shower_size != void(0)) {
var square = calc.widgets.shower_size.getSquare();
sum['glass_full'] = Math.floor(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();
}
sum['shower'] = calc.widgets.shower_size.getData().price;
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();
});
});
$('#glass-type-134').prop('checked', true);
</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 = Math.abs(calc.widgets.shower_size.getDoorsCount());
for (var key in calc.widgets) {
calc.highlight(calc.widgets[key], false);
}
// тип + толщина..
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.shower_size != void(0)) {
var square = calc.widgets.shower_size.getSquare();
sum['glass_full'] = Math.floor(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();
}
sum['shower'] = calc.widgets.shower_size.getData().price;
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();
});
});
$('#glass-type-134').prop('checked', true);
</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>