<?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);

$title = "";
$subtitle = "";

if(!empty($arParams['REGION']) && $arParams['REGION'] !== "root")
{
	//$title = "Лизинг";

	if(!empty($arResult['TITLES']['BRAND']))
	{
		$title .= " ".$arResult['TITLES']['BRAND'];

		if(!empty($arResult['TITLES']['MODEL']))
		{
			$title = $arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL'];
		}
		$title = $title." в ".$arResult['CITY']['PROPERTIES']['CASE']['VALUE']." в лизинг";
		$subtitle = " для юридических лиц и ИП";
	}
	else
	{
		$title = "Лизинг в ".$arResult['CITY']['PROPERTIES']['CASE']['VALUE'];
		$subtitle = " для юридических лиц и ИП";	
	}
}
else
{
	if(!empty($arResult['TITLES']['BRAND']))
	{
		$title .= "Новые автомобили ".$arResult['TITLES']['BRAND'];

		if(!empty($arResult['TITLES']['MODEL']))
		{
			$title = $arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL'];
		}

		$subtitle = " в лизинг для юридических лиц и ИП";
	}
}

if(!empty($arResult['TITLE']))
{
	$title = $arResult['TITLE'];
}

if(!empty($arResult['SUBTITLE']))
{
	$subtitle = $arResult['SUBTITLE'];
}

?>
<script>
	$(function()
	{
		section_code = "<?= $arResult['SECTION_CODE']; ?>";
		query = "<?= $arResult['QUERY']; ?>";
	});
</script>
<style>
	main {overflow-x: unset;}
</style>
<section data-page="catalog" id="catalog">
	<div class="container">
		<div id="view"></div>
		<div class="pageWithSide">
			<div class="leftColumn">
				<? if($arParams['PROGRAM'] !== "" && !is_null($arParams['PROGRAM'])): ?>
					<h2 class="section_title_with_em"><em><?= !empty($title) ? $title : "Новые автомобили в лизинг"; ?></em><?= $subtitle !== "" ? "<br>".$subtitle : ""; ?></h2>
				<? else: ?>
					<h1 class="section_title_with_em"><em><?= !empty($title) ? $title : "Новые автомобили в лизинг"; ?></em><?= $subtitle !== "" ? "<br>".$subtitle : ""; ?></h1>
				<? endif; ?>
				<div class="special_detail">
					<? if(!$arParams['top_banners']): ?>
					<? else: ?>
						<div class="special_offer">
							<h2>СКИДКИ ДО <span>1,5%</span> <mark>+</mark> СПЕЦТАРИФ НА КАСКО</h2>
							<ul class="list-column">
								<li>Скидки до 1,5% при покупке</li>
								<li>Land Rover в лизинг</li>
								<li>Специальный тариф на каско</li>
							</ul>
							<button class="button button-blue">Отправить заявку</button>
							<img src="/images/special_offer.jpg" alt="" />
						</div>
					<? endif; ?>
					<div id="catalog_small_filter" style="<?= $arResult['EXTENDED'] ? "display:none;" : ($arResult['FILTER_SMALL'] ? "display:none;" : ""); ?>">
						<form id="catalog_small_form" method="get" action="/catalog/">
							<div class="filter_body">
								<div class="form_field">
									<select name="brand" id="small_filter_brands">
										<option disabled selected value="">Марка</option>
									</select>
								</div>
								<div class="form_field">
									<select name="model" id="small_filter_models">
										<option disabled selected value="">Модель</option>
									</select>
								</div>
								<button class="button button-blue" id="catalog_small_find"></button>
								<button class="button button-blue" id="rich_filter_toggle">
									<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
										<path d="M2.63025 3H13.3697C13.4666 3 13.5613 3.02814 13.6425 3.08099C13.7237 3.13384 13.7878 3.20914 13.827 3.29772C13.8661 3.38631 13.8788 3.48437 13.8633 3.57999C13.8478 3.6756 13.8048 3.76466 13.7397 3.83634L9.63 8.35697C9.54633 8.449 9.49997 8.56892 9.49997 8.6933V12.2324C9.49997 12.3147 9.47965 12.3958 9.44081 12.4683C9.40197 12.5409 9.34581 12.6028 9.27732 12.6484L7.27732 13.9818C7.20202 14.032 7.11451 14.0608 7.02412 14.0652C6.93372 14.0695 6.84384 14.0493 6.76404 14.0066C6.68425 13.9639 6.61755 13.9003 6.57104 13.8227C6.52454 13.745 6.49997 13.6562 6.49997 13.5657V8.6933C6.49997 8.56892 6.45361 8.449 6.36994 8.35697L2.26028 3.83634C2.19512 3.76466 2.15218 3.6756 2.13669 3.57999C2.12119 3.48437 2.13381 3.38631 2.17299 3.29772C2.21218 3.20914 2.27625 3.13384 2.35743 3.08099C2.4386 3.02814 2.53338 3 2.63025 3V3Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
									</svg>
									Фильтр
								</button>
							</div>
						</form>
					</div>
					<div id="filter" class="filter_in_catalog" style="<?= $arResult['EXTENDED'] ? "display:block;" : ""; ?>">
						<div class="container">
							<? $APPLICATION->IncludeComponent(
								"evolution:form.catalog.filter",
								"",
								Array(
									"SWITCH" => false, 
									"SELECTED" => $arResult['SELECTED'], 
									"PATH" => $arParams['PATH'], 
									"SORTING" => true, 
									"PROGRAM" => $arParams['PROGRAM'], 
									"SCROLL" => $arResult['SCROLL'], 
								)
							); ?>
						</div>
					</div>
					<? if($arParams['REGION'] === "root"): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.cities.list", 
							"", 
							Array(
								"TITLE" => "Выберите город", 
							)
						); ?>
					<? endif; ?>
					<? if(count($arResult['ITEMS']) > 0): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.sort",
							"",
							Array(
								"SORT" => $arParams['SORT'], 
								"FILTER" => $arResult['FILTER_SMALL'], 
							)
						); ?>
					<? else: ?>
						<div class="catalog_sort">
							<div class="sort_container sort_selector">
							</div>
						</div>
					<? endif; ?>
					<? if($arResult['BRAND_DISABLED'] && $arResult['MODEL_DISABLED']): ?>
						<p style="font-size: 18px; line-height: 24px; padding: 10px 40px 40px 0px; border-left: solid 1px white;">Автомобили <b><?= $arResult['TITLES']['BRAND']; ?></b> на данный момент отсутствуют в каталоге, но это не означает, что мы не сможем их для Вас найти. Оставьте <a href="#order">заявку</a> или позвоните по номеру горячей линии <a href="tel:88003337575">8 800 333 75 75</a> и мы найдём Вам автомобиль!</p>
						<p style="font-size: 18px; line-height: 24px; padding: 0px 40px 40px 0px; border-left: solid 1px white;">Посмотрите автомобили других марок:</p>
					<? else: ?>
						<? if($arResult['MODEL_DISABLED']): ?>
							<p style="font-size: 18px; line-height: 24px; padding: 10px 40px 40px 0px; border-left: solid 1px white;">Модель <b><?= $arResult['TITLES']['BRAND']; ?> <?= $arResult['TITLES']['MODEL']; ?></b> на данный момент отсутствует в каталоге, но это не означает, что мы не сможем её для Вас найти. Оставьте <a href="#order">заявку</a> или позвоните по номеру горячей линии <a href="tel:88003337575">8 800 333 75 75</a> и мы найдём Вам автомобиль!</p>
							<? /*
								<p style="font-size: 18px; line-height: 24px; padding: 0px 40px 40px 0px; border-left: solid 1px white;">Посмотрите другие модели <?= $arResult['TITLES']['BRAND']; ?>:</p>
							*/?>
								<?
									$APPLICATION->IncludeComponent(
										"evolution:catalog.light",
										isset($_REQUEST['ajax']) ? "ajax" : "",
										array(
											"TITLE" => "Посмотрите похожие автомобили на ".$arResult['TITLES']['BRAND']." ".$arResult['TITLES']['MODEL'], 
											"PAGINATION" => "Y", 
											"COUNT_PER_PAGE" => 3, 
											//"BODY" => $_REQUEST['BODY'], 
											//"BODY_SLUG" => $_REQUEST['BODY_SLUG'], 
											//"SORT" => $_REQUEST['SORT'], 
											"PATH" => "/catalog/", 
										)
									);
								?>
						<? endif; ?>
					<? endif; ?>

					<? if($arParams['REGION'] !== "root"): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.city.team",
							"",
							Array(
								"CITY" => $arResult['CITY'], 
								"BRAND" => $arResult['TITLES']['BRAND'], 
								"MODEL" => $arResult['TITLES']['MODEL'], 
								"EXTENDED" => $arResult['EXTENDED'], 
							)
						); ?>
					<? endif; ?>

					<? if($arResult['SHOW_SPECIAL_OFFERS']): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.special.offers",
							"",
							Array(
								"COUNT" => 3, 
								"EXTENDED" => $arResult['EXTENDED'], 
								"BRAND_ID" => $arResult['SELECTED']['BRAND_ID'], 
							)
						); ?>
					<? endif; ?>

					<? if($arResult['SHOW_PROMO_BRANDS']): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.promo.brand",
							"",
							Array(
								"COUNT" => 3, 
								"PATH" => $arParams['PATH'], 
							)
						); ?>
					<? endif; ?>

					<? if($arResult['SHOW_PROMO_MODELS']): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.promo.model",
							"",
							Array(
								"COUNT" => 3, 
								"BRAND_NAME" => $arResult['TITLES']['BRAND'], 
								"BRAND_CODE" => $arResult['SELECTED']['BRAND'], 
								"BRAND_UID" => $arResult['SELECTED']['BRAND_UID'], 
								"PATH" => $arParams['PATH'], 
							)
						); ?>
					<? endif; ?>

					<? if(count($arResult['ITEMS']) > 0): ?>
						<div class="catalog_list" id="catalog_positions_list">
							<? foreach($arResult['ITEMS'] AS $arItem): ?>
								<? $APPLICATION->IncludeComponent(
									"evolution:catalog.list.item",
									"",
									$arItem
								); ?>
							<? endforeach; ?>
						</div>
						<? if($arResult['PAGE_COUNT'] > 1 && $arResult['PAGE_CURRENT'] != $arResult['PAGE_COUNT']): ?>
							<input type="hidden" id="current_page" value="<?= $arResult['PAGE_CURRENT']; ?>"/>
							<a class="catalog_show_more_button" id="catalog_get_more" style="cursor:pointer;">
								<span>Показать еще</span>
							</a>
						<? endif; ?>
						<?= $arResult['NAV_STRING']; ?>
					<? endif; ?>

					<? if($arResult['SHOW_BRANDS_LIST']): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.brands", 
							"", 
							Array(
								"PATH" => $arParams['PATH'], 
								"TITLE" => "Каталог автомобилей", 
								"SORT" => $arParams['SORT'], 
								"FILTER" => $arResult['FILTER_SMALL'], 
							)
						); ?>
					<? endif; ?>
					<? if($arResult['SHOW_MODELS_LIST']): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.models", 
							"", 
							Array(
								"PATH" => $arParams['PATH'], 
								"BRAND" => $_REQUEST['BRAND'], 
								"RECOMMENDED" => true, 
								"REGIONS" => !is_null($arParams['REGION']) ? true : false, 
							)
						); ?>
					<? endif; ?>

					<? if(isset($arParams['REGION']) && $arParams['REGION'] !== "root"): ?>
						<? $APPLICATION->IncludeComponent(
							"evolution:catalog.city.offices", 
							"", 
							Array(
								"CITY" => $arResult['CITY'], 
							)
						); ?>
					<? endif; ?>

				</div>
			</div>
			<aside class="rightColumn">
				<? $APPLICATION->IncludeComponent(
					"evolution:banner.inner", 
					"", 
					Array(
					)
				); ?>
				<? $APPLICATION->IncludeComponent(
					"evolution:banner.ask", 
					"", 
					Array(
					)
				); ?>
			</aside>
		</div>
	</div>
</section>