<?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">
    <?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">
        <div class="row h-100">
            <a id="logo" class="col-3 col-md-4 h-100 py-2" title="SkillParts" href="/" role="button" onclick="return page_main();">
                <img class="h-100" src="/img/logos/skillparts.svg" alt="SkillParts">
            </a>
            <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 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" href="#">Action</a>
                    <a class="dropdown-item" href="#">Another action</a>
                    <a class="dropdown-item" href="#">Something else here</a>
                </div>
            </div>

            <div id="searchPanel" class="col">
                <!-- <input id="catalog_search_panel_button_1" class="btn btn-sm button_clean" type="radio" name="catalog_search_panel_buttons" value="catalog_search_panel_button_1" checked>
            <label class="mb-0 px-3 px-md-4 py-1" for="catalog_search_panel_button_1">Номер детали</label>
            <input id="catalog_search_panel_button_2" class="btn btn-sm text-white button_clean" type="radio" name="catalog_search_panel_buttons" value="catalog_search_panel_button_2">
            <label class="mb-0 px-3 px-md-4 py-1" for="catalog_search_panel_button_2">Вторая кнопка</label>
            <input id="catalog_search_panel_button_3" class="btn btn-sm5 text-white button_clean" type="radio" name="catalog_search_panel_buttons" value="catalog_search_panel_button_3">
            <label class="mb-0 px-3 px-md-4 py-1" for="catalog_search_panel_button_3">Третья кнопка</label> -->
                <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 col-12 catalog_search_line button_clean" placeholder="Введите номер запчасти, например: 45223503481" oninput="$('#search_line').dropdown('hide'); product_search(this);" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" autocomplete="off">
                        <?
                            if (!yii::$app->user->isGuest && $search_panel = $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;
                            } else {
                                echo <<<HTML
                                    <div id="search_line_window" class="dropdown-menu w-100 d-none" aria-labelledby="search_line"></div>
                                HTML;
                            }
                        ?>
                    </div>
                    <button type="submit" class="col btn button_clean catalog_search_button" onclick="product_search(this.parentElement.getElementsByTagName('input')[0], 1)">ПОИСК</button>
                </form>
            </div>
        </div>
    </aside>

    <main class="col p-0">
        <?= $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"><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">
                <h5 class="row mb-2"><b>Партнёрство</b></h5>
                <small class="row mb-1"><a>Оптовым покупателям</a></small>
                <small class="row mb-1"><a>Поставщикам</a></small>
                <small class="row mb-1"><a>Партнерская сеть</a></small>
            </div>
        </div>
    </footer>

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

</html>

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