<?if(!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();
/** @var array $arParams */
/** @var array $arResult */
/** @global CMain $APPLICATION */
/** @global CUser $USER */
/** @global CDatabase $DB */
/** @var CBitrixComponentTemplate $this */
/** @var string $templateName */
/** @var string $templateFile */
/** @var string $templateFolder */
/** @var string $componentPath */
/** @var CBitrixComponent $component */
$this->setFrameMode(true);

?>
<div class="header-lead container">
    <div class="header-lead__left">
        <?php if (!empty($arResult['PROPERTIES']['TITLE']['VALUE'])): ?>
            <h1 class="header-lead__title">
                <?= $arResult['PROPERTIES']['TITLE']['VALUE'] ?>
            </h1>
        <?php endif; ?>
        <?php if (!empty($arResult['PROPERTIES']['SUBTITLE']['VALUE'])): ?>
            <p class="header-lead__subtitle">
                <?= $arResult['PROPERTIES']['SUBTITLE']['~VALUE'] ?>
            </p>
        <?php endif; ?>
        <?php if (!empty($arResult['PROPERTIES']['STATS']['VALUE']) && is_array($arResult['PROPERTIES']['STATS']['VALUE'])): ?>
            <div class="header-lead__columns">
                <?php foreach ($arResult['PROPERTIES']['STATS']['VALUE'] as $index => $stat): ?>
                    <div class="header-lead__item">
                        <p class="header-lead__value"><?= $stat ?></p>
                        <?php if (!empty($arResult['PROPERTIES']['STATS']['DESCRIPTION'][$index])): ?>
                            <p class="header-lead__text"><?= $arResult['PROPERTIES']['STATS']['DESCRIPTION'][$index] ?></p>
                        <?php endif; ?>
                    </div>
                <?php endforeach; ?>
            </div>
        <?php endif; ?>
        <button class="button button--orange">Заказать септик со скидкой</button>
    </div>
    <div class="header-lead__right">
        <?php if (!empty($arResult['PROPERTIES']['BIG_CARD_TEXT']['VALUE'])): ?>
        <?php
            $bigCardImgId = $arResult['PROPERTIES']['BIG_CARD_IMAGE']['VALUE'] ?? null;
            $bigCardImg = $bigCardImgId ? CFile::GetFileArray($bigCardImgId) : null;
            $bgImage = $bigCardImg && !empty($bigCardImg['SRC']) ? "background-image: url({$bigCardImg['SRC']});" : '';
        ?>
            <?php if (!empty($arResult['PROPERTIES']['BIG_CARD_LINK']['VALUE'])): ?>
                <a class="card card--main" style="<?= $bgImage ?>" href="<?= $arResult['PROPERTIES']['BIG_CARD_LINK']['VALUE'] ?>">
                    <div class="card__title">
                        <?= $arResult['PROPERTIES']['BIG_CARD_TEXT']['VALUE'] ?>
                    </div>
                    <?php if (!empty($arResult['PROPERTIES']['BIG_CARD_TEXT']['DESCRIPTION'])): ?>
                        <div class="card__description">
                            <span>
                                <?= $arResult['PROPERTIES']['BIG_CARD_TEXT']['~DESCRIPTION'] ?>
                            </span>
                        </div>
                    <?php endif; ?>
                </a>
            <?php else: ?>
                <div class="card card--main" style="<?= $bgImage ?>">
                    <div class="card__title">
                        <?= $arResult['PROPERTIES']['BIG_CARD_TEXT']['VALUE'] ?>
                    </div>
                    <?php if (!empty($arResult['PROPERTIES']['BIG_CARD_TEXT']['DESCRIPTION'])): ?>
                        <div class="card__description">
                            <span>
                                <?= $arResult['PROPERTIES']['BIG_CARD_TEXT']['~DESCRIPTION'] ?>
                            </span>
                        </div>
                    <?php endif; ?>
                </div>
            <?php endif; ?>
        <?php endif; ?>
        <?php if (!empty($arResult['PROPERTIES']['SMALL_CARDS']['VALUE']) && is_array($arResult['PROPERTIES']['SMALL_CARDS']['VALUE'])): ?>
            <?php foreach ($arResult['PROPERTIES']['SMALL_CARDS']['VALUE'] as $index => $smallCardTitle): ?>
                <?php if (!empty($arResult['PROPERTIES']['SMALL_CARDS']['DESCRIPTION'][$index])): ?>
                    <a class="card card--little" href="<?= $arResult['PROPERTIES']['SMALL_CARDS']['DESCRIPTION'][$index] ?>">
                        <?= $smallCardTitle ?>
                    </a>
                <?php else: ?>
                    <div class="card card--little">
                        <?= $smallCardTitle ?>
                    </div>
                <?php endif; ?>
            <?php endforeach; ?>
        <?php endif; ?>
    </div>
</div>