<?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);
?>
<script>
	$(".car_top_card").on("click", function()
	{
		$(".car_top_description").css("display", "none");
		$(".car_top_description_"+$(this).attr("data-id")).css("display", "flex");
	});
</script>
<section data-page>
	<div class="container">
		<ul class="breadcrumbs">
			<li></li>
		</ul>
		<div class="special_detail" id="special_offer_detail">
			<div id="special_offer_header">
				<h1 class="section_title"><?= $arResult['NAME']; ?></h1>
				<div class="special_offer">
					<?= isset($arResult['PROPERTIES']['CONTENT_HEADER']['~VALUE']['TEXT']) ? $arResult['PROPERTIES']['CONTENT_HEADER']['~VALUE']['TEXT'] : ""; ?>
					<? if(!isset($_GET['advertise'])): ?>
						<a href="#order" class="button button-blue special_offer_button">Отправить заявку</a>
					<? endif; ?>
					<img src="<?= $arResult['DETAIL_PICTURE']; ?>" alt="<?= $arResult['NAME']; ?>" />
					<? if(!isset($_GET['advertise']) && $arResult['PROPERTIES']['ADVERTISING_ERIR']['VALUE']): ?>
						<div class="advblock adv_button_news">Реклама
							<div class="adv_content">ООО "ЛК Эволюция"</div>
							<div class="adv_content">ИНН 9724016636</div>
							<div class="adv_content">erid: <?= $arResult['PROPERTIES']['ADVERTISING_ERIR']['VALUE']; ?></div>
						</div>
					<? endif; ?>
				</div>
			</div>
			<div class="special_offer-text">
				<?= isset($arResult['PROPERTIES']['CONTENT_TOP']['~VALUE']['TEXT']) ? $arResult['PROPERTIES']['CONTENT_TOP']['~VALUE']['TEXT'] : ""; ?>
			</div>
			<div class="leasing_offer">
				<? if(!is_null($arResult['PROPERTIES']['CARS']['RELATED']) && count($arResult['PROPERTIES']['CARS']['RELATED']) > 0): ?>
					<div class="title_wrapper">
						<div class="left">
							<h3>Лизинговые предложения</h3>
						</div>
						<? if(!isset($_GET['advertise'])): ?>
							<div class="right leasing_arrows">
								<button class="prev">
									<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="https://www.w3.org/2000/svg">
									<path d="M7 11L1 6L6.25 1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
									</svg>
								</button>
								<button class="next">
									<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="https://www.w3.org/2000/svg">
									<path d="M1 1L7 6L1.75 11" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
									</svg>
								</button>
							</div>
						<? endif; ?>
					</div>
					<div id="leasing_slider">
						<div class="leasing_list swiped" style="<?= isset($_GET['advertise']) ? "flex-wrap: wrap;" : "" ?>">
							<? if(is_array($arResult['PROPERTIES']['CARS']['RELATED'])): ?>
								<? for($i = 0; $i < count($arResult['PROPERTIES']['CARS']['RELATED']); $i++): ?>
									<? $car = $arResult['PROPERTIES']['CARS']['RELATED'][$i]; ?>
									<div class="leasing_item">
										<a class="item_wrapper car_top_card" data-id="<?= $i; ?>" style="cursor: pointer; position: relative;">
											<img src="<?= $car['PREVIEW_PICTURE']; ?>" alt="<?= $car['NAME']; ?>" />
											<span class="leasing_model"><?= $car['NAME']; ?></span>
											<span class="leasing_desc"><?= $car['PROPERTIES']['TAGLINE']['VALUE']; ?></span>
											<? if(!isset($_GET['advertise']) && $car['PROPERTIES']['ADVERTISING_ERIR']['VALUE']): ?>
												<div class="advblock adv_button_news">Реклама
													<div class="adv_content">ООО "ЛК Эволюция"</div>
													<div class="adv_content">ИНН 9724016636</div>
													<div class="adv_content">erid: <?= $car['PROPERTIES']['ADVERTISING_ERIR']['VALUE']; ?></div>
												</div>
											<? endif; ?>
										</a>
									</div>
								<? endfor; ?>
							<? endif; ?>
						</div>
					</div>
				<? endif; ?>
				<a id="leasing_offer_car"></a>
				<? if(is_array($arResult['PROPERTIES']['CARS']['RELATED'])): ?>
					<? for($i = 0; $i < count($arResult['PROPERTIES']['CARS']['RELATED']); $i++): ?>
						<div class="leasing_offer-detail car_top_description car_top_description_<?= $i; ?>" style="display: <?= $i == 0 ? "flex" : (isset($_GET['advertise']) ? "flex" : "none"); ?>;">
							<div id="single_slider" class="image_slider">
								<div class="slider_list">
									<? foreach($arResult['PROPERTIES']['CARS']['RELATED'][$i]['PROPERTIES']['PHOTOS']['VALUE'] AS $photo_url): ?>
									<div class="slide">
										<img src="<?= $photo_url; ?>" alt="<?= $arResult['PROPERTIES']['CARS']['RELATED'][$i]['NAME']; ?>" />
									</div>
									<? endforeach; ?>
								</div>
								<div class="slider_dots">
									<script type="text/template" id="embla-dot-template">
										<button class="embla__dot" type="button"></button>
									</script>
								</div>
							</div>
							<div class="offer_desc">
								<p class="offer_name"><?= $arResult['PROPERTIES']['CARS']['RELATED'][$i]['NAME']; ?></p>
								<?= $arResult['PROPERTIES']['CARS']['RELATED'][$i]['PREVIEW_TEXT']; ?>
								<? if(!isset($_GET['advertise'])): ?>
									<a href="#order" class="button button-blue">Отправить заявку</a>
								<? endif; ?>
							</div>
						</div>
					<? endfor; ?>
				<? endif; ?>
			</div>
			<div class="aside_container">
				<article>
					<div class="special_offer-text">
						<?= $arResult['DETAIL_TEXT']; ?>
					</div>
				<? /*<div class="info_column">
						<?= $arResult['DETAIL_TEXT']; ?>
					</div>
				*/ ?>
					<div class="dropdown_blocks_list">
						<div class="dropdown_block <?= isset($_GET['advertise']) ? "open" : "" ?>">
							<div class="block_header">
								<p>Условия спецпредложения</p>
								<? if(!isset($_GET['advertise'])): ?>
									<button class="block_toggle"></button>
								<? endif; ?>
							</div>
							<div class="block_body">
								<?= $arResult['PROPERTIES']['RULES']['~VALUE']['TEXT']; ?>
							</div>
						</div>
					</div>
				</article>
			</div>
		</div>
	</div>
</section>