<?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 */
?>
<h1 class="section_title">Результаты поиска</h1>
<div class="special_detail">
	<div class="page_search">
		<form action="/search/">
			<div class="form_field">
				<input type="search" placeholder="Введите текст для поиска" name="q" value="<?= $arResult["REQUEST"]["QUERY"]; ?>" />
			</div>
			<button type="submit" class="button button-blue">Поиск</button>
		</form>
	</div>

	<? if(count($arResult["SEARCH"]) > 0 ): ?>
		<div id="list" class="search_list">
			<? foreach($arResult["SEARCH"] as $arItem): ?>
				<? if($arItem['PARAM2'] == IBLOCK_ID_CATALOG_CARS_NEW): ?>
					<div class="search_item" data-type="auto">
						<span class="category">Легковые автомобили</span>
						<img src="<?= $arItem['CAR']['PROPERTIES']['IMAGE_URL']['VALUE']; ?>" alt="<?= $arItem['CAR']['NAME']; ?>">
						<a href="<?= $arItem['CAR']['DETAIL_PAGE_URL']; ?>" class="item_link" area-label="<?= $arItem['CAR']['NAME']; ?>">
							<p class="item_class"><?= $arItem['CAR']['PROPERTIES']['BRAND']['RELATED']['NAME']; ?> <?= $arItem['CAR']['PROPERTIES']['MODEL']['RELATED']['NAME']; ?> <?= $arItem['CAR']['PROPERTIES']['BODY']['VALUE']; ?></p>
							<p class="item_model">
								<b><?= $arItem['CAR']['PROPERTIES']['MODIFICATION']['RELATED']['PROPERTIES']['TITLE']['VALUE']; ?></b>
								<?= $arItem['CAR']['PROPERTIES']['ENGINE_FUEL']['VALUE']; ?>, <?= $arItem['CAR']['PROPERTIES']['GEAR']['VALUE']; ?>, <?= $arItem['CAR']['PROPERTIES']['ENGINE_POWER']['VALUE']; ?> л.с.
							</p>
							<ul>
								<li class="pay">
									<p>Ежемесячный платёж (от)</p>
									<p><?= $arItem['CAR']['CALCULATION']['MONTHLY']; ?> р.</p>
								</li>
								<li>
									<p>Стоимость автомобиля (от)</p>
									<p><?= number_format($arItem['CAR']['PROPERTIES']['PRICE']['VALUE'], 0, ".", " "); ?> р.</p>
								</li>
								<li>
									<p>Экономия по налогу на прибыль (до)</p>
									<p><?= $arItem['CAR']['CALCULATION']['SAVINGS_TAX']; ?> р.</p>
								</li>
								<li>
									<p>НДС к возмещению из бюджета (до)</p>
									<p><?= $arItem['CAR']['CALCULATION']['SAVINGS_VAT']; ?> р.</p>
								</li>
							</ul>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? elseif($arItem['PARAM2'] == IBLOCK_ID_NEWS): ?>
					<div class="search_item" data-type="news">
						<span class="category">Новости</span>
						<img src="<?= $arItem['ENTRY']['PREVIEW_PICTURE']; ?>" alt="<?= $arItem['TITLE']; ?>">
						<a href="<?= $arItem['ENTRY']['DETAIL_PAGE_URL']; ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_date"><?= FormatDate("d F Y", MakeTimeStamp($arItem['ENTRY']['ACTIVE_FROM'])); ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? elseif($arItem['PARAM2'] == IBLOCK_ID_SPECIALS): ?>
					<div class="search_item" data-type="special">
						<span class="category">Спецпредолжение</span>
						<img src="<?= $arItem['OFFER']['PREVIEW_PICTURE']; ?>" alt="<?= $arItem['TITLE']; ?>">
						<a href="<?= $arItem['OFFER']['DETAIL_PAGE_URL']; ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? elseif($arItem['PARAM2'] == IBLOCK_ID_SERVICES): ?>
					<div class="search_item" data-type="program">
						<span class="category">Сервисы</span>
						<img src="<?= $arItem['ENTRY']['PREVIEW_PICTURE']; ?>" alt="<?= $arItem['TITLE']; ?>">
						<a href="<?= $arItem['ENTRY']['DETAIL_PAGE_URL']; ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? elseif($arItem['PARAM2'] == IBLOCK_ID_PROGRAMS): ?>
					<div class="search_item" data-type="program">
						<span class="category">Лизинговые программы</span>
						<img src="<?= $arItem['ENTRY']['PREVIEW_PICTURE']; ?>" alt="<?= $arItem['TITLE']; ?>">
						<a href="<?= $arItem['ENTRY']['DETAIL_PAGE_URL']; ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? elseif($arItem['PARAM2'] == IBLOCK_ID_CONTACTS): ?>
					<div class="search_item" data-type="default">
						<a href="<?= $arItem['URL_WO_PARAMS']; ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? else: ?>
					<div class="search_item" data-type="default">
						<a href="<?= str_replace("index.php", "", $arItem['URL_WO_PARAMS']); ?>" class="item_link" area-label="<?= $arItem['TITLE']; ?>">
							<p class="item_title"><?= $arItem['TITLE']; ?></p>
							<p class="item_desc"><?= $arItem['BODY_FORMATED']; ?></p>
							<div class="item_footer">
								<span class="button button-transparent">Подробнее</span>
							</div>
						</a>
					</div>
				<? endif; ?>
			<? endforeach; ?>
		</div>
	<? else: ?>
		<div class="search_not_found">
			<p>Ничего не найдено. <br />Попробуйте изменить запрос и повторить поиск</p>
		</div>
	<? endif; ?>

	<? if($arParams["DISPLAY_BOTTOM_PAGER"] != "N") echo $arResult["NAV_STRING"]; ?>
</div>