<?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);
?>
<?
	$types_title = "Виды ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." в лизинг";

	if(isset($arParams['BRAND']))
	{
		$types_title = "Каталог ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." ".$arParams['BRAND_NAME']." в лизинг";
	}
?>
<? if(is_array($arResult['SECTIONS']) && count($arResult['SECTIONS']) > 0): ?>
	<div class="container">
		<? if(!isset($arParams['GROUP'])): ?>
			<h2 class="h2"><?= $types_title; ?></h2>
		<? endif; ?>
		<div class="types_grid">
			<? foreach($arResult['SECTIONS'] AS $section): ?>
				<div class="grid_item" style="<?= count($arResult['SECTIONS']) === 1 ? "width: 100%;" : ""; ?>">
					<p class="h2">
						<? if(!isset($arParams['GROUP'])): ?>
							<a href="<?= $arParams['PATH']; ?>/<?= $section['CODE']; ?>/">
								<?= $section['NAME']; ?>
							</a>
						<? else: ?>
							<?= $arParams['GROUP_NAME']; ?>
						<? endif; ?>
					</p>
					<ul>
						<? if(is_array($section['ITEMS'])): ?>
							<? foreach($section['ITEMS'] AS $item): ?>
								<li>
									<a href="<?= $arParams['PATH']; ?><?= isset($arParams['BRAND']) ? "/brand-".$arParams['BRAND_SLUG']."/" : "/".$section['CODE']."/"; ?><?= $item['CODE']; ?>/"><?= $item['NAME']; ?></a>
								</li>
							<? endforeach; ?>
						<? endif; ?>
					</ul>
					<img src="<?= $section['PICTURE']; ?>" alt="<?= $section['NAME']; ?>"/>
				</div>
			<? endforeach; ?>
		</div>
	</div>
<? endif; ?>