This commit is contained in:
Kavalar 2024-05-26 13:05:24 +03:00
parent 43299163f3
commit 071a5fbd84
3 changed files with 16 additions and 3 deletions

View File

@ -35,7 +35,7 @@ $this->params['breadcrumbs'][] = $this->title;
'article', 'article',
//'company_id', //'company_id',
//'type', //'type',
//'price', 'price',
//'status', //'status',
['class' => 'hail812\adminlte3\yii\grid\ActionColumn'], ['class' => 'hail812\adminlte3\yii\grid\ActionColumn'],

View File

@ -65,6 +65,7 @@ class ProductCategoryController extends Controller
return $this->render('index', [ return $this->render('index', [
'searchModel' => $searchModel, 'searchModel' => $searchModel,
'dataProvider' => $dataProvider, 'dataProvider' => $dataProvider,
'companyService' => $this->companyService,
]); ]);
} }

View File

@ -1,11 +1,13 @@
<?php <?php
use common\services\CompanyService;
use yii\helpers\Html; use yii\helpers\Html;
use yii\grid\GridView; use yii\grid\GridView;
/* @var $this yii\web\View */ /* @var $this yii\web\View */
/* @var $searchModel frontend\modules\product_category\models\ProductCategorySearch */ /* @var $searchModel frontend\modules\product_category\models\ProductCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */ /* @var $dataProvider yii\data\ActiveDataProvider */
/* @var $companyService CompanyService */
$this->title = 'Категории товаров'; $this->title = 'Категории товаров';
$this->params['breadcrumbs'][] = $this->title; $this->params['breadcrumbs'][] = $this->title;
@ -33,8 +35,18 @@ $this->params['breadcrumbs'][] = $this->title;
'id', 'id',
'title', 'title',
//'parent_id', //'parent_id',
'company_id', [
'status', 'attribute' => 'company_id',
'value' => function($model) use ($companyService){
return $companyService->getCompany($model->company_id)->name ?? null;
}
],
[
'attribute' => 'status',
'value' => function($model){
return \common\models\ProductCategory::getStatus()[$model->status];
}
],
['class' => 'hail812\adminlte3\yii\grid\ActionColumn'], ['class' => 'hail812\adminlte3\yii\grid\ActionColumn'],
], ],