<?php
    
    /**
     * @var \yii\web\View $this
     * @var string        $content
     */
    
    use common\models\Page;
    use common\modules\language\models\Language;
    use common\modules\rubrication\models\TaxGroup;
    use yii\db\ActiveQuery;
    use yii\helpers\Html;
    use frontend\assets\AppAsset;
    use yii\widgets\ActiveForm;
    use yii\widgets\Breadcrumbs;
    use yii\widgets\Menu;
    
    $this->registerMetaTag([
        'name'    => 'robots',
        'content' => 'noindex, nofollow',
    ]);
    AppAsset::register($this);
    /**
     * @var Page[] $pages
     */
    $pages = Page::find()
                 ->joinWith('lang', true, 'INNER JOIN')
                 ->where([ 'in_menu' => true ])
                 ->orderBy([ 'id' => SORT_DESC ])
                 ->all();
    $pages_items = [];
    foreach($pages as $page) {
        $pages_items[] = [
            'label' => $page->lang->title,
            'url'   => [
                'site/page',
                'id' => $page->id,
            ],
        ];
    }
    /**
     * @var TaxGroup $purposes
     */
    $purposes = TaxGroup::find()
                        ->where([
                            'tax_group.tax_group_id' => 5,
                            'level'                  => 0,
                        ])
                        ->with([
                            'options' => function($query) {
                                /**
                                 * @var ActiveQuery $query
                                 */
                                $query->orderBy([ 'sort' => SORT_ASC ])
                                      ->with('lang');
                            },
                        ])
                        ->one();
    $submenu_items = [];
    foreach($purposes->options as $option) {
        $submenu_items[] = [
            'label' => $option->lang->value,
            'url'   => [
                'filter/purpose',
                'id' => $option->tax_option_id,
            ],
        ];
    }
    $menu_items = [
        [
            'label' => Yii::t('app', 'Контрактные продукты'),
            'url'   => '#',
            'items' => $submenu_items,
        ],
        [
            'label' => Yii::t('app', 'Галерея объектов'),
            'url'   => [ '/project' ],
        ],
        [
            'label' => Yii::t('app', 'Статьи'),
            'url'   => [ '/article' ],
        ],
        [
            'label' => Yii::t('app', 'Контакты'),
            'url'   => [ 'site/contact' ],
        ],
    ];
    array_splice($menu_items, 1, 0, $pages_items);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<!--tablet-mobil-menu-->
<div class="xs-sm-menu">
    <div class="style close-menu-mob">
        <?php
            echo \Yii::t('app', 'меню');
        ?>
    </div>
    <?php
        echo Menu::widget([
            'options' => [
                'class' => 'main-menu',
            ],
            'items'   => $menu_items,
        ]);
    ?>
</div>
<?php
    echo Html::a(Yii::t('app', 'Отправить запрос') . Html::tag('span', 0), '#', [
        'class' => 'question-form visible-md visible-lg hidden',
    ]);
?>
<div class="section-box-header">
    <div class="head-container container">
        <div class="row">
            <div class="col-xs-12 col-sm-4 col-md-2">
                <?php
                    echo Html::a(Html::img('/images/logo.png'), [ 'site/index' ], [
                        'class' => 'logo_',
                    ])
                ?>
            </div>
            <div class="visible-md visible-lg hidden col-md-3 phones-head">
                <table>
                    <tr>
                        <td>
                            <p>+38 (044) <span>503-73-76</span></p>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="visible-md visible-lg hidden col-md-3 phones-head">
                <table>
                    <tr>
                        <td>
                            <p>+38 (044) <span>503-00-33</span></p>
                            <span>
                                <?php
                                    echo \Yii::t('app', 'контрактный отдел');
                                ?>
                            </span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="visible-md visible-lg hidden col-md-3 phones-head">
                <table>
                    <tr>
                        <td>
                            <p>+38 (044) <span>503-00-30</span></p>
                            <span>
                                <?php
                                    echo \Yii::t('app', 'отдел по работе с дизайнерами и архитекторами');
                                ?>
                            </span>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="visible-md visible-lg hidden col-md-1 search-ico">
                <?php
                    echo Html::img('/images/ico/ico-2.png', [
                        'class'  => 'search-btn',
                        'width'  => '18',
                        'height' => '18',
                        'alt'    => 'search',
                    ]);
                ?>
                <div class="lang-wr">
                    <?php
                        echo Html::a('укр', '/ua' . Yii::$app->getRequest()
                                                             ->getLanguageUrl(), [
                            'class' => ( ( Language::getCurrent()->url == 'ua' ) ? 'active' : '' ),
                        ]);
                        echo Html::a('рус', '/ru' . Yii::$app->getRequest()
                                                             ->getLanguageUrl(), [
                            'class' => ( ( Language::getCurrent()->url == 'ru' ) ? 'active' : '' ),
                        ]);
                    ?>
                </div>
            </div>
            <!---планшет, моб--->
            <div class="hidden-md hidden-lg col-xs-2 col-sm-4 phones-head-table-mob lang-mob">
                <div class="lang-wr lang-wr-mob">
                    <?php
                        echo Html::a('укр', '/ua' . Yii::$app->getRequest()
                                                             ->getLanguageUrl(), [
                            'class' => ( ( Language::getCurrent()->url == 'ua' ) ? 'active' : '' ),
                        ]);
                        echo Html::a('рус', '/ru' . Yii::$app->getRequest()
                                                             ->getLanguageUrl(), [
                            'class' => ( ( Language::getCurrent()->url == 'ru' ) ? 'active' : '' ),
                        ]);
                    ?>
                </div>
            </div>
            <div class="hidden-md hidden-lg col-xs-12 col-sm-4 phones-head-table-mob">
                <div class="phones-table-wr">
                    <p>+38 (044) <span class="vis-phone">503-73-76</span></p>
                    <ul>
                        <li>
                            <p>+38 (044) <span class="vis-phone">503-00-33</span></p>
                            <span>
                                <?php
                                    echo \Yii::t('app', 'контрактный отдел');
                                ?>
                            </span>
                        </li>
                        <li>
                            <p>+38 (044) <span class="vis-phone">503-00-30</span></p>
                            <span>
                                <?php
                                    echo \Yii::t('app', 'диз_арх_2');
                                ?>
                            </span>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="hidden-search">
                <div class="col-xs-3 col-sm-2 col-md-2">
                    <div class="search-title">
                        <p>
                            <?php
                                echo \Yii::t('app', 'search');
                            ?>
                        </p>
                    </div>
                </div>
                <div class="col-xs-7 col-sm-8 col-md-8 search-form-wr-padding">
                    <div class="search-form-wr">
                        <?php
                            $form = ActiveForm::begin([
                                'action' => [ 'search/index' ],
                                'method' => 'get',
                            ]);
                            echo Html::input('search', 'search');
                            echo Html::submitButton('');
                            $form::end();
                        ?>
                    </div>
                </div>
                <div class="col-xs-2 col-sm-2 col-md-2 close-search">
                    <?php
                        echo Html::img('/images/ico/ico-5.png', [
                            'class'  => 'close-search-btn',
                            'width'  => '16',
                            'height' => '16',
                            'alt'    => 'search',
                        ]);
                    ?>
                </div>
            </div>
        </div>
    </div>
    <div class="style menu-wrapper visible-md visible-lg hidden">
        <div class="container">
            <div class="row">
                <div class="style menu-wr">
                    <?php
                        echo Html::a('', [ 'site/index' ], [
                            'class' => 'home_ico',
                        ]);
                        echo Menu::widget([
                            'options' => [
                                'class' => 'main-menu',
                            ],
                            'items'   => $menu_items,
                        ]);
                    ?>
                </div>
            </div>
        </div>
    </div>
    <!---планшет, моб--->
    <div class="container">
        <div class="row">
            <div class="col-xs-12 col-sm-12 hidden-md hidden-lg">
                <div class="style mobile-menu">
                    <div class="row">
                        <div class="col-xs-3 col-sm-6">
                            <div class="menu_mob">
                                <div></div>
                                <div></div>
                            </div>
                        </div>
                        <div class="col-xs-6 col-sm-5 calc-menu">
                            <?php
                                echo Html::a(Yii::t('app', 'Отправить запрос') . Html::tag('span', 99), '#', [
                                    'class' => 'question-form',
                                ]);
                            ?>
                        </div>
                        <div class="col-xs-3 col-sm-1 search-btn-mob">
                            <?php
                                echo Html::img('/images/ico/ico-2.png', [
                                    'class'  => 'search-btn',
                                    'width'  => '18',
                                    'height' => '18',
                                    'alt'    => 'search',
                                ]);
                            ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--------------------->
<div class="section-box-content">
    <div class="container shadow">
        <div class="section-box breadcrumb">
            <?php
                echo Breadcrumbs::widget([
                    'links' => isset( $this->params[ 'breadcrumbs' ] ) ? $this->params[ 'breadcrumbs' ] : [],
                ]);
            ?>
        </div>
        <?php
            echo $content;
        ?>
    </div>
</div>
<!-- Footer -->
<div class="section-box-footer">
    <div class="section-box prefooter">
        <div class="container shadow">
            <div class="border-footer">
                <div></div>
            </div>
            <?php
                echo Menu::widget([
                    'options'      => [
                        'tag'   => 'div',
                        'class' => 'row',
                    ],
                    'itemOptions'  => [
                        'tag' => 'div',
                    ],
                    'encodeLabels' => false,
                    'items'        => [
                        [
                            'label'   => Html::img('/images/footer/img-1.png', [
                                    'class' => 'hidden-xs',
                                ]) . Html::img('/images/footer/img-1-1.png', [
                                    'class' => 'hidden visible-xs',
                                ]),
                            'url'     => 'http://www.hata-laminatu.ua',
                            'options' => [
                                'class' => 'mb-im-f-1 col-xs-3 col-sm-1 col-md-1',
                            ],
                        ],
                        [
                            'label'   => Html::img('/images/footer/img-2.png'),
                            'url'     => 'http://www.kimnata.ua/',
                            'options' => [
                                'class' => 'mb-im-f-2 col-xs-9 col-sm-2 col-md-2',
                            ],
                        ],
                        [
                            'label'   => Html::img('/images/footer/img-3.png'),
                            'url'     => 'http://sanatahome.com.ua/',
                            'options' => [
                                'class' => 'mb-im-f-3 col-xs-9 col-sm-3 col-md-3',
                            ],
                        ],
                        [
                            'label'   => Html::img('/images/footer/img-4.png'),
                            'url'     => 'http://floor.ua/',
                            'options' => [
                                'class' => 'mb-im-f-4 col-xs-7 col-sm-3 col-md-3',
                            ],
                        ],
                        [
                            'label'    => Html::tag('span', Yii::t('app', 'Сертификаты')),
                            'url'      => [ 'site/certificates' ],
                            'options'  => [
                                'class' => 'mb-im-f-5_1 col-xs-2 col-sm-2 col-md-2',
                            ],
                            'template' => '<a class="f-img certificate_f" href="{url}">{label}</a>',
                        ],
                        [
                            'label'   => Html::img('/images/footer/img-5.png'),
                            'url'     => 'https://www.facebook.com/witex.ua/',
                            'options' => [
                                'class' => 'mb-im-f-5 col-xs-3 col-sm-1 col-md-1',
                            ],
                        ],
                    ],
                    'linkTemplate' => '<a class="f-img" href="{url}" target="_blank">{label}</a>',
                ]);
            ?>
        </div>
    </div>
    <div class="section-box studio_footer">
        <div class="container">
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <div class="col-xs-12 col-sm-12 col-md-9">
                            <div class="copyright">
                                <p>
                                    <?php
                                        echo \Yii::t('app', 'copy1');
                                    ?>
                                </p>
                                <p>
                                    <?php
                                        echo \Yii::t('app', 'copy2');
                                    ?>
                                </p>
                            </div>
                        </div>
                        <div class="col-xs-12 col-sm-12 col-md-3 tablet-artweb">
                            <div class="artweb-wr">
                                <?php
                                    echo Html::a(Yii::t('app', 'Создание сайтов'), 'http://artweb.ua/', [
                                        'target' => '_blank',
                                    ])
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<div id="overlay" style="display: none"></div>
<div class="modal-form" id="modal_form" style="display: none">
    <div class="form-wr">
        <div id="close-form"></div>
        <div class="form-title uppercase"><?php echo \Yii::t('app', 'form1'); ?></div>
        <form action="">
            <div class="input-wr">
                <label class="control-label" for="form-1"><?php echo \Yii::t('app', 'username'); ?></label>
                <input type="text" id="form-1">
                <div class="help-block"></div>
            </div>
            <div class="input-wr required">
                <label class="control-label" for="form-2">Телефон</label>
                <input type="text" id="form-2">
                <div class="help-block"></div>
            </div>
            <div class="input-wr has-error">
                <label class="control-label" for="form-3">E-mail</label>
                <input type="text" id="form-3">
                <div class="help-block"></div>
            </div>
            <div class="input-wr">
                <label class="control-label" for="form-4"><?php echo \Yii::t('app', 'comment'); ?></label>
                <textarea id="form-4"></textarea>
                <div class="help-block"></div>
            </div>
            <div class="input-wr">
                <div class="button-wr">
                    <button type="submit"><?php echo \Yii::t('app', 'submit'); ?></button>
                </div>
            </div>
        </form>
    </div>
</div>
<div class="modal-form" id="modal_form-2" style="display: none">

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