<?php

declare(strict_types=1);

use yii\helpers\Html;

use app\assets\AppAsset;

AppAsset::register($this);

?>

<?php $this->beginPage() ?>

<!DOCTYPE html>
<html lang="<?= yii::$app->language ?>">

<head>
    <meta charset="<?= yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">

    <?php $this->registerCsrfMetaTags() ?>
    <title><?= Html::encode($this->title ?? 'SkillParts') ?></title>
    <?php $this->head() ?>
</head>

<body>
    <?php $this->beginBody() ?>

    <div id="notifications_popup_wrap" class="m-4 col-6 col-sm-5 col-md-4 col-lg-4 col-xl-3"></div>

    <header class="container pt-2 mt-1 mb-2 mb-sm-4 unselectable">
        <div class="row h-100">
            <div id="logo" class="col-3 col-md-4 h-100">
                <a class="py-2 h-100 d-inline-flex" title="SkillParts" href="/" role="button" onclick="return page_main();">
                    <img class="h-100" src="/img/logos/skillparts.svg" alt="SkillParts">
                </a>
            </div>
            <div class="col px-0 mt-auto d-flex h-title">
                <div class="ml-auto p-0 h-divider-title-left"></div>
                <div class="px-4 d-flex flex-column justify-content-center h-divider-title">
                    <h6 class="text-center text-white my-0"><b>Запчасти для спецтехники</b></h6>
                </div>
                <div class="mr-auto p-0 h-divider-title-right"></div>
            </div>
            <menu class="col-auto col-lg-4 mb-0 d-flex justify-content-end"></menu>
        </div>
        <div class="h-divider"></div>
        <script src="/js/js.cookie.min.js" defer></script>
    </header>

    <aside class="container mb-4">
        <div class="row">
            <div class="col-lg-3 d-flex flex-column align-center justify-content-end dropdownMenuButton_column">
                <button id="catalog" class="btn button_clean form-control d-flex align-items-center button_clean catalog_button" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                    <i class="fas fa-bars col-auto text-left p-0 mr-auto h-100 d-flex flex-column justify-content-center"></i>
                    <p class="col-10 m-0 p-0">Каталог товаров</p>
                </button>
                <div class="dropdown-menu" aria-labelledby="catalog">
                    <a class="dropdown-item" type="button">В разработке</a>
                </div>
            </div>

            <div id="searchPanel" class="col">
                <form class="d-flex catalog_search" onsubmit="return false;">
                    <div class="position-relative col-sm-8 col-lg-10 px-0">
                        <input id="search_line" type="text" class="form-control button_clean col-12 catalog_search_line" placeholder="Введите номер запчасти, например: 45223503481" oninput="$('#search_line').dropdown('hide'); return product_search(this.value);" data-toggle="dropdown" aria-expanded="false" autocomplete="off">
                        <?php
                        // Сделать системные настройки и по ним работать
                        $search_panel = yii::$app->controller->renderPartial('/search/panel', ['history' => true]);

                        echo <<<HTML
                            <div id="search_line_window" class="dropdown-menu w-100" aria-labelledby="search_line">
                                $search_panel
                            </div>
                        HTML;
                        ?>
                    </div>
                    <button type="submit" class="col btn button_clean catalog_search_button" onclick="product_search(this.parentElement.getElementsByTagName('input')[0].value, 1)">ПОИСК</button>
                </form>
            </div>
        </div>
    </aside>

    <main class="col p-0 d-flex flex-column justify-content-center">
        <?= $content ?>
    </main>

    <footer class="container py-4">
        <div class="row px-3">
            <div class="col-12 col-md-auto mr-md-5">
                <h5 class="row mb-2 unselectable"><b>Контакты</b></h5>
                <small class="row mb-1"><b>Адрес:&nbsp;</b>Хабаровск, Промышленная 3, 105</small>
                <small class="row mb-1"><b>Время работы:&nbsp;</b>пн-пт 09:00-18:00</small>
                <small class="row mb-1"><b>Телефон:&nbsp;</b><a href="tel:+74212358534">+7 (4212) 35-85-34</a></small>
                <small class="row"><b>Почта:&nbsp;</b><a href="mailto:info@skillparts.ru">info@skillparts.ru</a></small>
            </div>
            <div class="col-md-auto mr-md-5 partnership unselectable">
                <h5 class="row mb-2"><b>Партнёрство</b></h5>
                <small class="row mb-1"><a href="/buyers">Покупателям</a></small>
                <small class="row mb-1"><a href="/suppliers">Поставщикам</a></small>
                <small class="row"><a href="/partners">Сеть филиалов</a></small>
            </div>
            <div class="mt-auto ml-auto col-auto unselectable">
                <small class="row"><a href="mailto:info@skillparts.ru?subject=Ошибка на сайте">Сообщить об ошибке</a></small>
            </div>
        </div>
    </footer>

    <script src="/js/loading.js" defer></script>
    <?php $this->endBody() ?>
</body>

</html>

<?php $this->endPage() ?>
