<? 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);
?>
<? if ($arResult["ITEMS"]): ?>
    <div class="guarantee-block__items">
        <? foreach ($arResult["ITEMS"] as $arItem): ?>
            <?
            $this->AddEditAction($arItem['ID'], $arItem['EDIT_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_EDIT"));
            $this->AddDeleteAction($arItem['ID'], $arItem['DELETE_LINK'], CIBlock::GetArrayByID($arItem["IBLOCK_ID"], "ELEMENT_DELETE"), array("CONFIRM" => GetMessage('CT_BNL_ELEMENT_DELETE_CONFIRM')));
            $class = '';
            if ($arItem['PREVIEW_PICTURE'])
                $class = "pic-wrapper";
            if ($arItem['PROPERTIES']['BLUE_BACKGROUND']['VALUE'] == 'Y')
                $class = "blue";
            ?>
            <div class="guarantee-block__item <?= $class; ?>" id="<?= $this->GetEditAreaId($arItem['ID']); ?>">
                <? if ($arItem['PREVIEW_PICTURE']): ?>
       
                    <?
                    if ($arItem['PREVIEW_PICTURE']['SRC']) {
                        $file = CFile::ResizeImageGet($arItem['PREVIEW_PICTURE'], array('width' => 370, 'height' => 420), BX_RESIZE_IMAGE_PROPORTIONAL, true);
                        $arResult['PREVIEW_PICTURE']['SRC'] = $file['src'];
                        $arResult['PREVIEW_PICTURE']['SRC_WEBP'] = makeWebp($file['src']);
                    }
                    ?>
                    <picture>
                        <img src="<?= $arResult['PREVIEW_PICTURE']['SRC_WEBP']; ?>" alt="" loading="lazy">
                    </picture>
                <? else: ?>
                    <h3 class="guarantee-block__item-title"><?= $arItem['NAME']; ?></h3>
                    <div class="guarantee-block__item-text"><?= $arItem['PREVIEW_TEXT']; ?></div>
                <? endif; ?>
            </div>
        <? endforeach; ?>
    </div>
<? endif; ?>