<?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="apple-touch-icon" sizes="57x57" href="/favicons/apple-icon-57x57.png">
    <link rel="apple-touch-icon" sizes="60x60" href="/favicons/apple-icon-60x60.png">
    <link rel="apple-touch-icon" sizes="72x72" href="/favicons/apple-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="76x76" href="/favicons/apple-icon-76x76.png">
    <link rel="apple-touch-icon" sizes="114x114" href="/favicons/apple-icon-114x114.png">
    <link rel="apple-touch-icon" sizes="120x120" href="/favicons/apple-icon-120x120.png">
    <link rel="apple-touch-icon" sizes="144x144" href="/favicons/apple-icon-144x144.png">
    <link rel="apple-touch-icon" sizes="152x152" href="/favicons/apple-icon-152x152.png">
    <link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-icon-180x180.png">
    <link rel="icon" type="image/png" sizes="192x192" href="/favicons/android-icon-192x192.png">
    <link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png">
    <link rel="icon" type="image/png" sizes="96x96" href="/favicons/favicon-96x96.png">
    <link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png">
    <link rel="manifest" href="/favicons/manifest.json">
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="msapplication-TileImage" content="/favicons/ms-icon-144x144.png">
    <meta name="theme-color" content="#ffffff">

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

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

    <div id="notifications_popup_wrap" class="col-3 m-4"></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>
    </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>+7 (4212) 35-85-34</small>
                <small class="row mb-1"><b>Почта:&nbsp;</b>info@skillparts.ru</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 mb-1"><a href="/partners">Сеть филиалов</a></small>
            </div>
        </div>
    </footer>

    <?php $this->endBody() ?>
</body>

</html>

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