<div class="sandwich-calc-container" itemscope itemtype="https://schema.org/SoftwareApplication">

  <meta itemprop="name" content="Калькулятор сэндвич-панелей онлайн">

  <meta itemprop="applicationCategory" content="BusinessApplication">

  <meta itemprop="operatingSystem" content="All">


  <div class="calc-header">

    <h2 class="calc-title">Калькулятор сэндвич-панелей</h2>

    <p class="calc-subtitle">Рассчитайте стоимость стеновых и кровельных сэндвич-панелей и отправьте смету нашему менеджеру.</p>

  </div>


  <div class="calc-grid">

    <div class="calc-form-card">

      <div class="calc-field">

        <label for="calc-type">Что считаем</label>

        <select id="calc-type" class="calc-control">

          <option value="walls_roof">Стены и кровля</option>

          <option value="walls">Только стены</option>

          <option value="roof">Только кровля</option>

        </select>

      </div>


      <div class="calc-row-2">

        <div class="calc-field">

          <label for="calc-length">Длина здания (м)</label>

          <input type="number" id="calc-length" class="calc-control" value="24" min="1" max="500">

        </div>

        <div class="calc-field">

          <label for="calc-width">Ширина здания (м)</label>

          <input type="number" id="calc-width" class="calc-control" value="12" min="1" max="500">

        </div>

      </div>


      <div class="calc-row-2" id="walls-height-wrap">

        <div class="calc-field">

          <label for="calc-height">Высота стен (м)</label>

          <input type="number" id="calc-height" class="calc-control" value="6" min="1" max="50">

        </div>

        <div class="calc-field">

          <label for="calc-openings">Площадь ворот, окон, дверей (м²)</label>

          <input type="number" id="calc-openings" class="calc-control" value="20" min="0" max="1000">

        </div>

      </div>


      <div class="calc-row-2" id="roof-slope-wrap">

        <div class="calc-field">

          <label for="calc-slope">Уклон кровли (°)</label>

          <input type="number" id="calc-slope" class="calc-control" value="10" min="1" max="60">

        </div>

        <div class="calc-field">

          <label for="calc-wall-mount">Монтаж стеновых панелей</label>

          <select id="calc-wall-mount" class="calc-control">

            <option value="horizontal">Горизонтальный</option>

            <option value="vertical">Вертикальный</option>

          </select>

        </div>

      </div>


      <div class="calc-field">

        <label for="calc-wall-material">Стеновые панели</label>

        <select id="calc-wall-material" class="calc-control">

          <option value="2900">Стеновые сэндвич-панели из минеральной ваты — от 2 900 ₽/м²</option>

          <option value="2400">Стеновые сэндвич-панели ППУ / ПИР — от 2 400 ₽/м²</option>

          <option value="2100">Стеновые сэндвич-панели пенополистирол — от 2 100 ₽/м²</option>

        </select>

      </div>


      <div class="calc-field" id="roof-material-wrap">

        <label for="calc-roof-material">Кровельные панели</label>

        <select id="calc-roof-material" class="calc-control">

          <option value="3050">Кровельные сэндвич-панели из минеральной ваты — от 3 050 ₽/м²</option>

          <option value="2600">Кровельные сэндвич-панели ППУ / ПИР — от 2 600 ₽/м²</option>

          <option value="2300">Кровельные сэндвич-панели пенополистирол — от 2 300 ₽/м²</option>

        </select>

      </div>

    </div>


    <div class="calc-results-card">

      <div id="res-walls-section">

        <div class="calc-result-category" id="res-walls-title">Стены: Стеновые сэндвич-панели из минеральной ваты</div>

        <div class="calc-result-item">

          <span>Площадь стен (за вычетом проёмов)</span>

          <strong id="res-wall-area">424,7 м²</strong>

        </div>

        <div class="calc-result-item">

          <span>С запасом 5 %</span>

          <strong id="res-wall-area-reserve">445,9 м²</strong>

        </div>

        <div class="calc-result-item">

          <span>Саморезы для панелей, ≈</span>

          <strong id="res-wall-screws">765 шт</strong>

        </div>

        <div class="calc-result-item">

          <span>Уголки и отливы</span>

          <strong id="res-wall-corners">96 п.м.</strong>

        </div>

        <div class="calc-result-item highlight-price">

          <span>Стоимость панелей</span>

          <strong id="res-wall-price">1 293 198 ₽</strong>

        </div>

      </div>


      <div id="res-roof-section" style="margin-top: 15px; border-top: 1px solid #eee; padding-top: 12px;">

        <div class="calc-result-category" id="res-roof-title">Кровля: Кровельные сэндвич-панели из минеральной ваты</div>

        <div class="calc-result-item">

          <span>Площадь кровли (с запасом 5%)</span>

          <strong id="res-roof-area-reserve">330,2 м²</strong>

        </div>

        <div class="calc-result-item">

          <span>Саморезы, конёк, планки</span>

          <strong id="res-roof-trims">837 ед.</strong>

        </div>

        <div class="calc-result-item highlight-price">

          <span>Стоимость панелей</span>

          <strong id="res-roof-price">1 007 231 ₽</strong>

        </div>

      </div>


      <div class="calc-total-box">

        <span>Итого ориентировочно:</span>

        <strong id="res-total-price">2 300 429 ₽</strong>

      </div>


      <div class="calc-send-box" style="margin-top: 20px; border-top: 1px solid #ddd; padding-top: 15px;">

        <div class="calc-field" style="margin-bottom: 10px;">

          <input type="text" id="calc-client-name" class="calc-control" placeholder="Ваше имя">

        </div>

        <div class="calc-field" style="margin-bottom: 10px;">

          <input type="text" id="calc-client-phone" class="calc-control" placeholder="Телефон или Email *">

        </div>

        <button type="button" class="btn-calc-primary" style="width: 100%;" onclick="sendCalculation()">

          <i class="fa fa-envelope"></i> Отправить расчёт менеджеру

        </button>

      </div>


    </div>

  </div>


  <div class="calc-actions" style="margin-top: 20px;">

    <button type="button" class="btn-calc-secondary" onclick="window.print()">

      <i class="fa fa-print"></i> Распечатать расчёт

    </button>

  </div>

  <p class="calc-disclaimer">Расчёт ориентировочный. Данные отправляются на info@sandwichpanelsvspb.ru.</p>

</div>


<style>

.sandwich-calc-container {

  max-width: 1200px;

  margin: 20px auto;

  background: #fff;

  padding: 30px;

  border-radius: 8px;

  box-shadow: 0 2px 12px rgba(0,0,0,0.06);

  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color: #333;

}

.calc-header { margin-bottom: 25px; }

.calc-title { font-size: 26px; font-weight: 700; color: #222; margin: 0 0 8px 0; }

.calc-subtitle { font-size: 14px; color: #666; margin: 0; }

.calc-grid { display: grid; grid-template-columns: 1fr 420px; gap: 25px; }

@media(max-width: 992px) { .calc-grid { grid-template-columns: 1fr; } }

.calc-form-card, .calc-results-card { background: #fcfcfc; border: 1px solid #eaeaea; padding: 20px; border-radius: 6px; }

.calc-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.calc-field { margin-bottom: 15px; }

.calc-field label { display: block; font-size: 13px; font-weight: 600; color: #444; margin-bottom: 6px; }

.calc-control { width: 100%; height: 40px; padding: 0 12px; border: 1px solid #dcdcdc; border-radius: 4px; font-size: 14px; background: #fff; color: #333; box-sizing: border-box; }

.calc-control:focus { border-color: #f26522; outline: none; }

.calc-result-category { font-weight: 700; font-size: 13px; color: #f26522; margin-bottom: 10px; }

.calc-result-item { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eee; color: #555; }

.calc-result-item strong { color: #222; font-weight: 600; }

.highlight-price strong { color: #f26522; font-size: 15px; }

.calc-total-box { margin-top: 15px; background: #fff5f0; border: 1px solid #f26522; padding: 15px; border-radius: 6px; display: flex; justify-content: space-between; align-items: center; font-size: 16px; font-weight: 700; color: #222; }

.calc-total-box strong { color: #f26522; font-size: 20px; }

.btn-calc-primary { background-color: #f26522; color: #fff; border: none; padding: 12px 20px; font-size: 14px; font-weight: 600; border-radius: 4px; cursor: pointer; transition: background 0.2s; }

.btn-calc-primary:hover { background-color: #d8551b; }

.btn-calc-secondary { background-color: #fff; color: #333; border: 1px solid #ccc; padding: 10px 18px; font-size: 14px; font-weight: 600; border-radius: 4px; cursor: pointer; }

.btn-calc-secondary:hover { border-color: #888; background: #f9f9f9; }

.calc-disclaimer { font-size: 12px; color: #888; margin-top: 15px; }


/* Настройка печати: сохраняется только калькулятор на 1 странице */

@media print {

  body * { visibility: hidden; }

  .sandwich-calc-container, .sandwich-calc-container * { visibility: visible; }

  .sandwich-calc-container {

    position: absolute;

    left: 0;

    top: 0;

    width: 100%;

    margin: 0;

    padding: 15px;

    box-shadow: none;

    border: none;

  }

  .calc-actions, .calc-send-box, .btn-calc-secondary { display: none !important; }

}

</style>


<script>

document.addEventListener("DOMContentLoaded", function() {

  const typeSelect = document.getElementById('calc-type');

  const lengthInput = document.getElementById('calc-length');

  const widthInput = document.getElementById('calc-width');

  const heightInput = document.getElementById('calc-height');

  const openingsInput = document.getElementById('calc-openings');

  const slopeInput = document.getElementById('calc-slope');

  const wallMaterialSelect = document.getElementById('calc-wall-material');

  const roofMaterialSelect = document.getElementById('calc-roof-material');


  const wallsSection = document.getElementById('res-walls-section');

  const roofSection = document.getElementById('res-roof-section');

  const wallsHeightWrap = document.getElementById('walls-height-wrap');

  const roofSlopeWrap = document.getElementById('roof-slope-wrap');


  function formatMoney(num) {

    return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ") + " ₽";

  }


  function calculate() {

    const type = typeSelect.value;

    const L = parseFloat(lengthInput.value) || 0;

    const W = parseFloat(widthInput.value) || 0;

    const H = parseFloat(heightInput.value) || 0;

    const open = parseFloat(openingsInput.value) || 0;

    const slopeDeg = parseFloat(slopeInput.value) || 0;


    const wallPricePerM2 = parseFloat(wallMaterialSelect.value) || 2900;

    const roofPricePerM2 = parseFloat(roofMaterialSelect.value) || 3050;


    if (type === 'walls') {

      wallsSection.style.display = 'block';

      roofSection.style.display = 'none';

      wallsHeightWrap.style.display = 'grid';

      roofSlopeWrap.style.display = 'none';

    } else if (type === 'roof') {

      wallsSection.style.display = 'none';

      roofSection.style.display = 'block';

      wallsHeightWrap.style.display = 'none';

      roofSlopeWrap.style.display = 'grid';

    } else {

      wallsSection.style.display = 'block';

      roofSection.style.display = 'block';

      wallsHeightWrap.style.display = 'grid';

      roofSlopeWrap.style.display = 'grid';

    }


    let totalWallCost = 0;

    let totalRoofCost = 0;


    if (type === 'walls' || type === 'walls_roof') {

      const perimeter = (L + W) * 2;

      let wallArea = (perimeter * H) - open;

      if (wallArea < 0) wallArea = 0;

      const wallAreaRes = wallArea * 1.05;

      totalWallCost = wallAreaRes * wallPricePerM2;


      document.getElementById('res-wall-area').innerText = wallArea.toFixed(1).replace('.', ',') + ' м²';

      document.getElementById('res-wall-area-reserve').innerText = wallAreaRes.toFixed(1).replace('.', ',') + ' м²';

      document.getElementById('res-wall-screws').innerText = Math.round(wallAreaRes * 1.8) + ' шт';

      document.getElementById('res-wall-price').innerText = formatMoney(Math.round(totalWallCost));

    }


    if (type === 'roof' || type === 'walls_roof') {

      const slopeRad = (slopeDeg * Math.PI) / 180;

      const halfWidth = W / 2;

      const slopeLen = halfWidth / Math.cos(slopeRad);

      const roofArea = (L * slopeLen) * 2;

      const roofAreaRes = roofArea * 1.05;

      totalRoofCost = roofAreaRes * roofPricePerM2;


      document.getElementById('res-roof-area-reserve').innerText = roofAreaRes.toFixed(1).replace('.', ',') + ' м²';

      document.getElementById('res-roof-trims').innerText = Math.round(roofAreaRes * 2.5) + ' ед.';

      document.getElementById('res-roof-price').innerText = formatMoney(Math.round(totalRoofCost));

    }


    const grandTotal = totalWallCost + totalRoofCost;

    document.getElementById('res-total-price').innerText = formatMoney(Math.round(grandTotal));

  }


  [typeSelect, lengthInput, widthInput, heightInput, openingsInput, slopeInput, wallMaterialSelect, roofMaterialSelect].forEach(el => {

    el.addEventListener('input', calculate);

    el.addEventListener('change', calculate);

  });


  calculate();

});


function sendCalculation() {

  const clientName = document.getElementById('calc-client-name').value;

  const clientPhone = document.getElementById('calc-client-phone').value;

  

  if (!clientPhone) {

    alert('Пожалуйста, укажите телефон или email для связи.');

    return;

  }


  const summaryText = `

Новый расчет из калькулятора сэндвич-панелей:

Имя: ${clientName || 'Не указано'}

Контакты: ${clientPhone}

Тип расчета: ${document.getElementById('calc-type').value}

Длина: ${document.getElementById('calc-length').value} м

Ширина: ${document.getElementById('calc-width').value} м

Высота: ${document.getElementById('calc-height').value} м

Итого сумма: ${document.getElementById('res-total-price').innerText}

  `;


  $.ajax({

    url: 'index.php?route=information/contact',

    type: 'post',

    data: {

      name: clientName || 'Калькулятор сметы',

      email: clientPhone.includes('@') ? clientPhone : 'calc@sandwichpanelsvspb.ru',

      enquiry: summaryText

    },

    dataType: 'html',

    success: function() {

      alert('Спасибо! Ваш расчет успешно отправлен на info@sandwichpanelsvspb.ru. Менеджер свяжется с вами.');

      document.getElementById('calc-client-name').value = '';

      document.getElementById('calc-client-phone').value = '';

    },

    error: function() {

      alert('Ошибка отправки. Пожалуйста, позвоните нам напрямую.');

    }

  });

}

</script>