<?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 = $arResult['NAME'];
	$rules_title = "Условия лизинга ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])."";

	if($arResult['GROUP'] !== null)
	{
		$title = "<mark>".$arResult['NAME']."</mark> в лизинг для юридических лиц и ИП";
		$rules_title = "Условия лизинга ".mb_strtolower($arResult['GROUP_GENITIVE']);
	}
	elseif($arResult['BRAND'] !== null)
	{
		if($arResult['TYPE'] !== null)
		{
			$title = "<mark>".$arResult['NAME']."</mark> в лизинг для юридических лиц и ИП";
			$rules_title = "Условия лизинга ".mb_strtolower($arResult['TYPE_GENITIVE'])." ".$arResult['BRAND_NAME'];
		}
		else
		{
			$title = $arParams['SHORT_TITLE']." <mark>".$arResult['NAME']."</mark> в лизинг для юридических лиц и ИП";
			$rules_title = "Условия лизинга ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." ".mb_strtolower($arResult['TYPE_GENITIVE']);
		}
	}
	elseif($arResult['TYPE'] !== null)
	{
		$title = "<mark>".$arResult['NAME']."</mark> в лизинг для юридических лиц и ИП";
		$rules_title = "Условия лизинга ".mb_strtolower($arResult['TYPE_GENITIVE']);
	}
	else
	{
		$title = "<mark>".$arResult['NAME']."</mark> ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." для юридических лиц и ИП";
		$rules_title = "Условия лизинга ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE']);
	}
?>
<section data-page="services">
	<div class="container">
		<div class="content_header">
			<div>
				<h1 class="section_title"><?= $title; ?></h1>
			</div>
			<img src="<?= $arResult['BANNER']; ?>" alt="<?= strip_tags($title); ?>">
		</div>
	</div>
</section>

<? if(is_array($arResult['PROPERTIES']['BENEFITS']['~VALUE']) && count($arResult['PROPERTIES']['BENEFITS']['~VALUE']) > 0): ?>
	<section class="gray">
		<div class="container">
			<div class="leasing_offers_list leasing_offers_list--no_margin">
				<? foreach($arResult['PROPERTIES']['BENEFITS']['~VALUE'] AS $benefits): ?>
					<div class="offer_item no_padding">
						<?= $benefits['TEXT']; ?>
					</div>
				<? endforeach; ?>
			</div>
		</div>
	</section>
<? endif; ?>

<section class="blue">
	<div class="container">
		<div class="leasing_offers_list leasing_offers_list--white">
			<? if(is_array($arResult['PROPERTIES']['POSSIBILITIES']['~VALUE']) && count($arResult['PROPERTIES']['POSSIBILITIES']['~VALUE']) > 0): ?>
				<? foreach($arResult['PROPERTIES']['POSSIBILITIES']['~VALUE'] AS $possibilities): ?>
					<div class="offer_item no_padding">
						<?= $possibilities['TEXT']; ?>
					</div>
				<? endforeach; ?>
			<? endif; ?>
			<div class="offer_item no_padding">
				<a href="#order" class="button">Отправить заявку</a>
			</div>
		</div>
	</div>
</section>

<?
	$special_offers_title = "Акции и скидки на ".mb_strtolower($arParams['SHORT_TITLE_ACCUSATIVE'])." в лизинг";

	if(isset($arResult['BRAND']))
	{
		if(isset($arResult['TYPE']))
		{
			$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['TYPE_PLURAL'])." ".$arResult['BRAND_NAME']." в лизинг";
		}
		else
		{
			$special_offers_title = "Акции и скидки на ".mb_strtolower($arParams['SHORT_TITLE_ACCUSATIVE'])." ".$arResult['BRAND_NAME']." в лизинг";
		}
	}
	elseif(isset($arResult['TYPE']))
	{
		$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['TYPE_PLURAL'])." в лизинг";
	}
	elseif(isset($arResult['GROUP']))
	{
		$special_offers_title = "Акции и скидки на ".mb_strtolower($arResult['GROUP_ACCUSATIVE'])." в лизинг";
	}
?>

<? if(is_array($arResult['PROPERTIES']['OFFERS']['VALUE']) && count($arResult['PROPERTIES']['OFFERS']['VALUE']) > 0): ?>
	<section data-page="leasing_special">
		<div class="container">
			<h2 class="h2"><?= $special_offers_title; ?></h2>
			<?
				$APPLICATION->IncludeComponent(
					"evolution:special.offers.banners",
					"",
					Array(
						"BANNERS" => $arResult['PROPERTIES']['OFFERS']['VALUE'], 
						"PAGINATION" => "N",
					)
				);
			?>
		</div>
	</section>
<? endif; ?>

<? 
/*
<section data-page="aggregation">
<? 
	$APPLICATION->IncludeComponent(
		"evolution:programs.aggregations.offers.list", 
		"", 
		[
			"IDS" => $arResult['PROPERTIES']['OFFERS']['VALUE'], 
			"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
			"GROUP" => $arResult['GROUP'], 
			"GROUP_NAME" => $arResult['GROUP_NAME'], 
			"GROUP_SLUG" => $arResult['GROUP_SLUG'], 
			"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
			"GROUP_ACCUSATIVE" => $arResult['GROUP_ACCUSATIVE'], 
			"GROUP_PREPOSITIONAL" => $arResult['GROUP_PREPOSITIONAL'], 
			"BRAND" => $arResult['BRAND'], 
			"BRAND_NAME" => $arResult['BRAND_NAME'], 
			"BRAND_SLUG" => $arResult['BRAND_SLUG'], 
			"TYPE" => $arResult['TYPE'], 
			"TYPE_PLURAL" => $arResult['TYPE_PLURAL'], 
			"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
		]
	);
?>
</section>
*/
?>

<? if(!empty($arResult['DETAIL_TEXT'])): ?>
	<? if(isset($arResult['TYPE']) && isset(($arResult['BRAND']))): ?>
		<section>
			<div class="container">
				<h2 class="h2">Преимущества <?= mb_strtolower($arResult['TYPE_GENITIVE']); ?> <?= $arResult['BRAND_NAME']; ?></h2>
				<div class="content_columns">
					<div class="column">
						<?= $arResult['DETAIL_TEXT']; ?>
					</div>
					<div class="column">
						<img src="<?= $arResult['DETAIL_PICTURE']; ?>" alt="<?= $arResult['NAME']; ?>"/>
					</div>
				</div>
			</div>
		</section>
	<? endif; ?>
<? endif; ?>

<? if(isset($arResult['GROUP']) && !isset($arResult['TYPE'])): ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.types",
			"",
			[
				"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION'], 
				"IBLOCK_ID_RULES" => $arParams['IBLOCK_ID_RULES'], 
				"PATH" => "/programs/".$arParams['PATH'], 
				"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
				"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
				"GROUP" => $arResult['GROUP'], 
				"GROUP_NAME" => $arResult['GROUP_NAME'], 
				"GROUP_SLUG" => $arResult['GROUP_SLUG'], 
				"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
				"GROUP_ACCUSATIVE" => $arResult['GROUP_ACCUSATIVE'], 
				"GROUP_PREPOSITIONAL" => $arResult['GROUP_PREPOSITIONAL'], 
				"BRAND" => $arResult['BRAND'], 
				"BRAND_NAME" => $arResult['BRAND_NAME'], 
				"BRAND_SLUG" => $arResult['BRAND_SLUG'], 
				"TYPE" => $arResult['TYPE'], 
				"TYPE_PLURAL" => $arResult['TYPE_PLURAL'], 
				"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
			]
		);
	?>
<? endif; ?>

<? if(!isset($arResult['GROUP'])): ?>
	<? if(isset($arResult['BRAND']) && !isset($arResult['TYPE'])): ?>
		<?
			$APPLICATION->IncludeComponent(
				"evolution:programs.aggregations.types",
				"",
				[
					"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION'], 
					"IBLOCK_ID_RULES" => $arParams['IBLOCK_ID_RULES'], 
					"PATH" => "/programs/".$arParams['PATH'], 
					"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
					"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
					"GROUP" => $arResult['GROUP'], 
					"GROUP_NAME" => $arResult['GROUP_NAME'], 
					"GROUP_SLUG" => $arResult['GROUP_SLUG'], 
					"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
					"GROUP_ACCUSATIVE" => $arResult['GROUP_ACCUSATIVE'], 
					"GROUP_PREPOSITIONAL" => $arResult['GROUP_PREPOSITIONAL'], 
					"BRAND" => $arResult['BRAND'], 
					"BRAND_NAME" => $arResult['BRAND_NAME'], 
					"BRAND_SLUG" => $arResult['BRAND_SLUG'], 
					"TYPE" => $arResult['TYPE'], 
					"TYPE_PLURAL" => $arResult['TYPE_PLURAL'], 
					"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
				]
			);
		?>
	<? endif; ?>
<? endif; ?>

<? if(!isset($arResult['GROUP'])): ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.rules", 
			"", 
			array_merge(
				$arResult, 
				[
					"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
					"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
				]
			)
		);
	?>
<? endif; ?>

<? if(!isset($arResult['GROUP']) && !isset($arResult['TYPE'])): ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.types",
			"",
			[
				"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION'], 
				"PATH" => "/programs/".$arParams['PATH'], 
				"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
				"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
				"GROUP" => $arResult['GROUP'], 
				"GROUP_NAME" => $arResult['GROUP_NAME'], 
				"GROUP_SLUG" => $arResult['GROUP_SLUG'], 
				"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
				"GROUP_ACCUSATIVE" => $arResult['GROUP_ACCUSATIVE'], 
				"GROUP_PREPOSITIONAL" => $arResult['GROUP_PREPOSITIONAL'], 
				"TYPE" => $arResult['TYPE'], 
				"TYPE_PLURAL" => $arResult['TYPE_PLURAL'], 
				"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
			]
		);
	?>
<? endif; ?>

<? if(isset($arResult['GROUP'])): ?>
	<? 
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.rules", 
			"", 
			array_merge(
				$arResult, 
				[
					"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
					"SHORT_TITLE_ACCUSATIVE" => $arParams['SHORT_TITLE_ACCUSATIVE'], 
					"GROUP" => $arResult['GROUP'], 
					"GROUP_NAME" => $arResult['GROUP_NAME'], 
					"GROUP_SLUG" => $arResult['GROUP_SLUG'], 
					"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
					"GROUP_ACCUSATIVE" => $arResult['GROUP_ACCUSATIVE'], 
					"GROUP_PREPOSITIONAL" => $arResult['GROUP_PREPOSITIONAL'], 
					"BRAND" => $arResult['BRAND'], 
					"BRAND_NAME" => $arResult['BRAND_NAME'], 
					"BRAND_SLUG" => $arResult['BRAND_SLUG'], 
					"TYPE" => $arResult['TYPE'], 
					"TYPE_PLURAL" => $arResult['TYPE_PLURAL'], 
					"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
				]
			)
		);
	?>
<? endif; ?>

<?

$calculator_title = "Калькулятор расчета лизинга ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE']);

if(isset($arResult['BRAND']))
{
	if(isset($arResult['TYPE']))
	{
		$calculator_title = "Калькулятор расчета лизинга ".mb_strtolower($arResult['TYPE_GENITIVE'])." ".$arResult['BRAND_NAME'];
	}
	else
	{
		$calculator_title = "Калькулятор расчета лизинга ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." ".$arResult['BRAND_NAME'];
	}
}
elseif(isset($arResult['TYPE']))
{
	$calculator_title = "Калькулятор расчета лизинга ".mb_strtolower($arResult['TYPE_GENITIVE_SINGULAR']);
}
elseif(isset($arResult['GROUP']))
{
	$calculator_title = "Калькулятор расчета лизинга ".mb_strtolower($arResult['GROUP_GENITIVE']);
}

?>

<? if(isset($arResult['TYPE']) || isset($arResult['BRAND'])): ?>
	<?
		$APPLICATION->IncludeComponent(
		"evolution:calculator",
		"",
		Array(
			"car_price" => 2500000, 
			"initial_payment" => 20, 
			"lease_period" => 36, 
			"redemption_payment" => 5, 
			"CAR_PRICE_MIN" => 500000,
			"CAR_PRICE_MAX" => 30000000,
			"INITIAL_PAYMENT_MIN" => 5, 
			"INITIAL_PAYMENT_MAX" => 50, 
			"LEASE_PERIOD_MIN" => 13, 
			"LEASE_PERIOD_MAX" => 60, 
			"REDEMPTION_PAYMENT_MIN" => 1, 
			"REDEMPTION_PAYMENT_MAX" => 5, 
			"TITLE" => $calculator_title, 
			"PRODUCT_TITLE" => "техники", 
		)
	); ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.brands.list",
			"",
			[
				"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION_BRANDS'], 
				"RULES_IBLOCK_ID" => $arParams['IBLOCK_ID_RULES'], 
				"TYPE" => $arResult['TYPE'], 
				"TYPE_SLUG" => $arResult['TYPE_SLUG'], 
				"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
				"PATH" => "/programs/".$arParams['PATH']."/", 
				"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
				"GROUP" => $arResult['GROUP'], 
				"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
				"BRAND" => $arResult['BRAND'], 
			]
		);
	?>
<? else: ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.brands.list",
			"",
			[
				"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION_BRANDS'], 
				"RULES_IBLOCK_ID" => $arParams['IBLOCK_ID_RULES'], 
				"TYPE" => $arResult['TYPE'], 
				"TYPE_SLUG" => $arResult['TYPE_SLUG'], 
				"TYPE_GENITIVE" => $arResult['TYPE_GENITIVE'], 
				"PATH" => "/programs/".$arParams['PATH']."/", 
				"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
				"GROUP" => $arResult['GROUP'], 
				"GROUP_GENITIVE" => $arResult['GROUP_GENITIVE'], 
				"BRAND" => $arResult['BRAND'], 
			]
		);
	?>
	<?
		$APPLICATION->IncludeComponent(
		"evolution:calculator",
		"",
		Array(
			"car_price" => 2500000, 
			"initial_payment" => 20, 
			"lease_period" => 36, 
			"redemption_payment" => 5, 
			"CAR_PRICE_MIN" => 500000,
			"CAR_PRICE_MAX" => 30000000,
			"INITIAL_PAYMENT_MIN" => 5, 
			"INITIAL_PAYMENT_MAX" => 50, 
			"LEASE_PERIOD_MIN" => 13, 
			"LEASE_PERIOD_MAX" => 60, 
			"REDEMPTION_PAYMENT_MIN" => 1, 
			"REDEMPTION_PAYMENT_MAX" => 5, 
			"TITLE" => $calculator_title, 
			"PRODUCT_TITLE" => "техники", 
		)
	); ?>
<? endif; ?>

<? if(!empty(mb_ereg_replace("\s", "", strip_tags($arResult['DETAIL_TEXT'])))): ?>
	<? if(!isset($arResult['TYPE']) || !isset(($arResult['BRAND']))): ?>
		
		<section>
			<div class="container">
				<?/*
				<h2 class="h2">Преимущества <?= mb_strtolower($arResult['TYPE_GENITIVE']); ?> <?= $arResult['BRAND_NAME']; ?></h2>
				*/?>
				<h2 class="h2"><?= $arResult['PROPERTIES']['MARKETING_TEXT_TITLE']['VALUE']; ?></h2>
				<div class="content_columns">
					<div class="column">
						<?= $arResult['DETAIL_TEXT']; ?>
					</div>
					<? if(!empty($arResult['DETAIL_PICTURE'])): ?>
						<div class="column">
							<img src="<?= $arResult['DETAIL_PICTURE']; ?>" alt="<?= $arResult['NAME']; ?>"/>
						</div>
					<? endif; ?>
				</div>
			</div>
		</section>

		<? endif; ?>
<? endif; ?>

<? if(isset($arResult['GROUP']) || (isset($arResult['BRAND'])) && isset($arResult['TYPE'])): ?>
	<?
		$APPLICATION->IncludeComponent(
			"evolution:programs.aggregations.types",
			"",
			[
				"IBLOCK_ID" => $arParams['IBLOCK_ID_PROGRAMS_AGGREGATION'], 
				"SHORT_TITLE_GENITIVE" => $arParams['SHORT_TITLE_GENITIVE'], 
				"PATH" => "/programs/".$arParams['PATH'], 
			]
		);
	?>
<? endif; ?>

<?
	$form_subtitle = "Всё о покупке ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." в лизинг";

	if(isset($arResult['BRAND']))
	{
		if(isset($arResult['TYPE']))
		{
			$form_subtitle = "Всё о покупке ".mb_strtolower($arResult['TYPE_GENITIVE'])." ".$arResult['BRAND_NAME']." в лизинг";
		}
		else
		{
			$form_subtitle = "Всё о покупке ".mb_strtolower($arParams['SHORT_TITLE_GENITIVE'])." ".$arResult['BRAND_NAME']." в лизинг";
		}
	}
	elseif(isset($arResult['TYPE']))
	{
		$form_subtitle = "Всё о покупке ".mb_strtolower($arResult['TYPE_GENITIVE_SINGULAR'])." в лизинг";
	}
	elseif(isset($arResult['GROUP']))
	{
		$form_subtitle = "Всё о покупке ".mb_strtolower($arResult['GROUP_GENITIVE'])." в лизинг";
	}

	$APPLICATION->IncludeComponent( 
		"evolution:form.leasing", 
		"", 
		[
			"TITLE" => "У Вас появились вопросы?", 
			"SUBTITLE" => $form_subtitle, 
		]
	);
?>
