<?
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die();
}
?>
<!doctype html>
<html xml:lang="<?= LANGUAGE_ID ?>" lang="<?= LANGUAGE_ID ?>">
<head>
    <title><? $APPLICATION->ShowTitle() ?></title>
    <?
    $CurDir = $APPLICATION->GetCurDir();
    $CurUri = $APPLICATION->GetCurUri();

    use Bitrix\Main\Page\Asset;

    $isShowAsidePanel = $APPLICATION->GetProperty('aside_panel');
    // JS
    CJSCore::Init([
            'jquery3',
            'sidepanel'
        ]
    );
    Asset::getInstance()->addJs(SITE_TEMPLATE_PATH . '/js/fancy/jquery.fancybox.min.js');
    Asset::getInstance()->addJs(SITE_TEMPLATE_PATH . '/js/select/select2.full.min.js');
    Asset::getInstance()->addJs(SITE_TEMPLATE_PATH . '/js/myscripts.min.js');
    // CSS
    \Bitrix\Main\UI\Extension::load([
        'ui.fonts.opensans'
    ]);
    // $APPLICATION->ShowAjaxHead();
    // public function ShowAjaxHead($bXhtmlStyle = true, $showCSS = true, $showStrings = true, $showScripts = true)
    Asset::getInstance()->addCss(SITE_TEMPLATE_PATH . '/js/fancy/jquery.fancybox.min.css');
    Asset::getInstance()->addCss(SITE_TEMPLATE_PATH . '/js/select/select2.min.css');
    // HEADERS
    $APPLICATION->ShowHead();
    ?>
    <meta name="format-detection" content="telephone=no">
    <meta name="yandex-verification" content="a7802eeca7f219ec"/>
    <link rel="icon" type="image/svg+xml" href="<?=SITE_TEMPLATE_PATH?>/img/f_ico.svg">
    <meta name="theme-color" content="#ffffff">
</head>
<body>

<?
$APPLICATION->ShowPanel();
$APPLICATION->IncludeComponent("mibazarow:favorites.add", "",
    array(),
);
?>

<div class="container">
    <div class="top_header">
        <? $APPLICATION->IncludeComponent("twofingers:location", "top_header_geo", array(),
            false
        ); ?>

        <div class="top_header_user">
            <div class="top_header_user_wish">
                <?
                if (
                    ($CurDir !== '/personal/my_messenger/') and
                    ($USER->IsAuthorized())
                ) {
                    $APPLICATION->IncludeComponent("bitrix:im.messenger", "", array(), null, array("HIDE_ICONS" => "Y"));
                }
                ?>
            </div>
            <div class="top_header_user_wish">
                <? $APPLICATION->IncludeComponent("mibazarow:favorites.line", "top_header_wish", array(
                    "COMPONENT_TEMPLATE" => ".default",
                    "URL_LIST" => "/personal/my_wishlist/",    // Путь до списка избранных товаров
                    "CACHE_TYPE" => "A",    // Тип кеширования
                    "CACHE_TIME" => "36000",    // Время кеширования (сек.)
                ),
                    false
                ); ?>
            </div>
            <? if ($USER->IsAuthorized()) {
                $APPLICATION->IncludeComponent("bitrix:main.user.link", "top_header_user", array(
                    "CACHE_TIME" => "7200",    // Время кеширования (сек.)
                    "CACHE_TYPE" => "A",    // Тип кеширования
                    "ID" => $USER->GetID(),    // Идентификатор пользователя
                    "NAME_TEMPLATE" => "",    // Отображение имени
                    "SHOW_LOGIN" => "Y",    // Показывать логин, если не задано имя
                    "USE_THUMBNAIL_LIST" => "Y",    // Отображать личное фото в списке
                ),
                    false
                );
            } else {
                // TODO тут будет main.auth.form выпадающийи или попап
                ?>
                <a href="/personal/auth/" class="btn btn_not_colored btn_small">
                    <span>Вход и регистрация</span>
                </a>
            <? } ?>

        </div>
    </div>
</div>
<div class="site_header_clb"></div>
<header class="site_header">
    <div class="container site_header_row">
        <a href="/" class="site_header_row_logo">
            <img src="<?= SITE_TEMPLATE_PATH ?>/img/NEW.svg" alt="TECH">
        </a>
        <div class="site_header_row_catalog">
            <?
            $APPLICATION->IncludeComponent(
                "bitrix:catalog.section.list",
                "header_catalog_menu",
                array(
                    "IBLOCK_TYPE" => "catalog2",
                    "IBLOCK_ID" => "14",
                    "SECTION_ID" => "",
                    "SECTION_CODE" => "",
                    "COUNT_ELEMENTS" => "Y",
                    "TOP_DEPTH" => "2",
                    "SECTION_FIELDS" => array(
                        0 => "",
                        1 => "",
                    ),
                    "SECTION_USER_FIELDS" => array(
                        0 => "",
                        1 => "",
                    ),
                    "SECTION_URL" => "",
                    "CACHE_TYPE" => "A",
                    "CACHE_TIME" => "36000000",
                    "CACHE_NOTES" => "",
                    "CACHE_GROUPS" => "Y",
                    "ADD_SECTIONS_CHAIN" => "N",
                    "COMPONENT_TEMPLATE" => "header_catalog_menu",
                    "COUNT_ELEMENTS_FILTER" => "CNT_ACTIVE",
                    "ADDITIONAL_COUNT_ELEMENTS_FILTER" => "additionalCountFilter",
                    "HIDE_SECTIONS_WITH_ZERO_COUNT_ELEMENTS" => "N",
                    "FILTER_NAME" => "sectionsFilter",
                    "VIEW_MODE" => "LINE",
                    "SHOW_PARENT_NAME" => "Y",
                    "CACHE_FILTER" => "N"
                ),
                false
            ); ?>
        </div>
        <div class="site_header_row_search">
            <? $APPLICATION->IncludeComponent(
	"bitrix:search.title", 
	"topsearch", 
	[
		"NUM_CATEGORIES" => "1",
		"TOP_COUNT" => "5",
		"ORDER" => "date",
		"USE_LANGUAGE_GUESS" => "Y",
		"CHECK_DATES" => "N",
		"SHOW_OTHERS" => "N",
		"PAGE" => "#SITE_DIR#search/index.php",
		"CATEGORY_0_TITLE" => "",
		"CATEGORY_0" => [
			0 => "iblock_catalog2",
		],
		"COMPONENT_TEMPLATE" => "topsearch",
		"SHOW_INPUT" => "Y",
		"INPUT_ID" => "title-search-input",
		"CONTAINER_ID" => "title-search",
		"CATEGORY_0_iblock_catalog2" => [
			0 => "14",
		],
		"CATEGORY_0_iblock_bulletin_board" => [
			0 => "17",
		]
	],
	false
); ?>
        </div>
        <div class="site_header_row_add">
            <a href="/personal/add_bulletin/" class="btn btn_colored">
                <span>Добавить объявление</span>
            </a>
        </div>
    </div>
</header>


<main class="container">
    <? if ($CurDir !== '/') { ?>
        <?
        $APPLICATION->IncludeComponent("bitrix:breadcrumb", "bread", array(
            "START_FROM" => "0",    // Номер пункта, начиная с которого будет построена навигационная цепочка
            "PATH" => "",    // Путь, для которого будет построена навигационная цепочка (по умолчанию, текущий путь)
            "SITE_ID" => "-",    // Cайт (устанавливается в случае многосайтовой версии, когда DOCUMENT_ROOT у сайтов разный)
        ),
            false
        ); ?>
        <? if (!CSite::InDir('/bulletins/')) { ?>
            <h1>
                <? $APPLICATION->ShowTitle(false); ?>
            </h1>
        <? } ?>
    <? } ?>
    <? if (!empty($isShowAsidePanel)) { ?>
    <section class="container_row">
        <article class="container_row_content">
            <? } ?>
