<?php
    /**
     * @var View               $this
     * @var Category           $category
     * @var Brand              $brand
     * @var ProductSearch      $searchModel
     * @var ActiveDataProvider $dataProvider
     */
    use common\components\artboximage\ArtboxImageHelper;
    use common\modules\product\models\Brand;
    use common\modules\product\models\Category;
    use common\modules\product\models\ProductSearch;
    use yii\data\ActiveDataProvider;
    use yii\web\View;
    use yii\widgets\ListView;
    
    $this->title = $category->lang->name . ' ' . $brand->lang->name;
    $this->params[ 'breadcrumbs' ][] = [
        'label' => $category->lang->name,
        'url'   => [
            'filter/category',
            'id' => $category->category_id,
        ],
    ];
    $this->params[ 'breadcrumbs' ][] = [
        'label' => \Yii::t('product', 'Brands') . ' ' . $category->lang->name,
        'url'   => [
            'filter/category-brands',
            'category_id' => $category->category_id,
        ],
    ];
    $this->params[ 'breadcrumbs' ][] = $this->title;
    
    $emptyBrand = false;
    if (!$category->getImageUrl(0, false) || !$brand->getImageUrl(0, false) || empty( $brand->lang->seo_text )) {
        $emptyBrand = true;
    }
?>
<div class="section-box box-title-1 uppercase"><?= $this->title ?></div>
<div class="section-box box-brand margin_bottom_30">
    <div class="row">
        <?php
            if (!$emptyBrand) {
                ?>
                <div class="style" style="position: relative">
                    <div class="col-xs-12 col-sm-6 col-md-6">
                        <div class="style article-img">
                            <?php
                                echo ArtboxImageHelper::getImage($category->getImageUrl(), 'article_list');
                            ?>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6" style="position: relative;z-index: 2">
                        <div class="style brand-main-txt">
                            <?php
                                echo $brand->lang->seo_text;
                            ?>
                        </div>
                    </div>
                    <div class="brand-txt-img">
                        <?php
                              echo ArtboxImageHelper::getImage($brand->getImageUrl(), 'brand_image_filter');
                        ?>
                    </div>
                </div>
                <?php
            }
        ?>
        <?php
            echo ListView::widget(
                [
                    'dataProvider' => $dataProvider,
                    'itemView'     => '_brand_item',
                    'itemOptions'  => [
                        'class' => 'brands-list_',
                    ],
                    'options'      => [
                        'class' => 'style brands-list-wr',
                        'style' => $emptyBrand?'margin-top: 0':'',
                    ],
                    'layout'       => '{items}',
                ]
            );
        ?>
    </div>
</div>