<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) die(); ?>
<? $this->setFrameMode(true); ?>
<?
// get section items count and subsections
$arItemFilter = CScorp::GetCurrentSectionElementFilter($arResult["VARIABLES"], $arParams);
$arSectionFilter = CScorp::GetCurrentSectionFilter($arResult["VARIABLES"], $arParams);
$itemsCnt = CCache::CIblockElement_GetList(array("CACHE" => array("TAG" => CCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]))), $arItemFilter, array());
$arSection = CCache::CIblockSection_GetList(array("CACHE" => array("TAG" => CCache::GetIBlockCacheTag($arParams["IBLOCK_ID"]), "MULTI" => "N")), $arSectionFilter, false, array('ID', 'DESCRIPTION', 'PICTURE', 'DETAIL_PICTURE', 'NAME', 'UF_BLOCKS', 'UF_FIRST_SCREEN', 'UF_TABLE_PRICE', 'UF_SCHEME', 'UF_FAQ', 'UF_ADVANTAGES', 'UF_TITLE_ADVANTAGES', 'UF_ACTION'), true);

CScorp::AddMeta(
    array(
        'og:description' => $arSection['DESCRIPTION'],
        'og:image' => (($arSection['PICTURE'] || $arSection['DETAIL_PICTURE']) ? CFile::GetPath(($arSection['PICTURE'] ? $arSection['PICTURE'] : $arSection['DETAIL_PICTURE'])) : false),
    )
);
?>
<? if (!$arSection && $arParams['SET_STATUS_404'] !== 'Y'): ?>
    <div class="alert alert-warning"><?= GetMessage("SECTION_NOTFOUND") ?></div>
<? elseif (!$arSection && $arParams['SET_STATUS_404'] === 'Y'): ?>
    <? CScorp::goto404Page(); ?>
<? else: ?>
    <?

    $component->__template->addExternalJS(SITE_TEMPLATE_PATH . '/js/accordion.min.js');
    // rss
    if ($arParams['USE_RSS'] !== 'N') {
        CScorp::ShowRSSIcon(CComponentEngine::makePathFromTemplate($arResult['FOLDER'] . $arResult['URL_TEMPLATES']['rss_section'], array_map('urlencode', $arResult['VARIABLES'])));
    } ?>
    </div>

    <div class="first-screen-wrapper">
        <div class="maxwidth-theme">
            <? $APPLICATION->IncludeComponent("bitrix:breadcrumb", "corp", array(
                "START_FROM" => "0",
                "PATH" => "",
                "SITE_ID" => SITE_ID
            ),
                false
            );
            if($arSection['UF_FIRST_SCREEN']) {
                //первый экран
                $APPLICATION->IncludeComponent(
                    "bitrix:news.detail",
                    "banner-service",
                    array(
                        "ACTIVE_DATE_FORMAT" => "d.m.Y",
                        "ADD_ELEMENT_CHAIN" => "N",
                        "ADD_SECTIONS_CHAIN" => "N",
                        "AJAX_MODE" => "N",
                        "AJAX_OPTION_ADDITIONAL" => "",
                        "AJAX_OPTION_HISTORY" => "N",
                        "AJAX_OPTION_JUMP" => "N",
                        "AJAX_OPTION_STYLE" => "N",
                        "BROWSER_TITLE" => "-",
                        "CACHE_GROUPS" => "N",
                        "CACHE_TIME" => "36000000",
                        "CACHE_TYPE" => "A",
                        "CHECK_DATES" => "Y",
                        "DETAIL_URL" => "",
                        "DISPLAY_BOTTOM_PAGER" => "Y",
                        "DISPLAY_DATE" => "Y",
                        "DISPLAY_NAME" => "Y",
                        "DISPLAY_PICTURE" => "Y",
                        "DISPLAY_PREVIEW_TEXT" => "Y",
                        "DISPLAY_TOP_PAGER" => "N",
                        "ELEMENT_CODE" => "",
                        "ELEMENT_ID" => $arSection['UF_FIRST_SCREEN'],
                        "FIELD_CODE" => array("ID", "PREVIEW_PICTURE"),
                        "IBLOCK_ID" => "31",
                        "IBLOCK_TYPE" => "info",
                        "IBLOCK_URL" => "",
                        "INCLUDE_IBLOCK_INTO_CHAIN" => "N",
                        "MESSAGE_404" => "",
                        "META_DESCRIPTION" => "-",
                        "META_KEYWORDS" => "-",
                        "PAGER_BASE_LINK_ENABLE" => "N",
                        "PAGER_SHOW_ALL" => "N",
                        "PAGER_TEMPLATE" => ".default",
                        "PAGER_TITLE" => "Страница",
                        "PROPERTY_CODE" => array("PRICE", "TITLE_PHOTO"),
                        "SET_BROWSER_TITLE" => "N",
                        "SET_CANONICAL_URL" => "N",
                        "SET_LAST_MODIFIED" => "N",
                        "SET_META_DESCRIPTION" => "N",
                        "SET_META_KEYWORDS" => "N",
                        "SET_STATUS_404" => "N",
                        "SET_TITLE" => "N",
                        "SHOW_404" => "N",
                        "STRICT_SECTION_CHECK" => "N",
                        "USE_PERMISSIONS" => "N",
                        "USE_SHARE" => "N"
                    )
                );
            }?>
        </div>
    </div>
    <div class="maxwidth-theme">

    <?php //Блоки
    $APPLICATION->IncludeFile(SITE_DIR . "include/blocks.php",
        array_merge($arParams,
            array(
                'arResult' => $arResult,
                'HIDE_BLOCKS' => $arSection["UF_BLOCKS"],
                'CONTENT' => array('TITLE' => $arSection['NAME'], 'TEXT' => $arSection['DESCRIPTION']),
                'SCHEME' => $arSection['UF_SCHEME'],
                'FAQ' => $arSection['UF_FAQ'],
                'TABLE_PRICE' => $arSection['UF_TABLE_PRICE'],
                'IS_DETAIL' => false,
                'ADVANTAGES' => $arSection["UF_ADVANTAGES"],
                'TITLE_ADVANTAGES' => $arSection["UF_TITLE_ADVANTAGES"],
                'ACTIONS' => $arSection["UF_ACTION"]
            )
        )
    ); ?>

<? endif; ?>