$this->params['breadcrumbs'][] = $this->title; ?> <div class="goods-params-index"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php //echo $this->render('_search', ['model' => $searchModel]); ?> <p> <?php echo Html::a('Добавить параметр', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php $link_category = ['attribute' => 'link_category', 'label' => 'Привязано к', 'format' => 'html', 'value' => function ($model) { $pp = app\models\GoodsParams::findOne($model->link_category); return $pp->value; }]; if (is_array($parentsValues)) { $link_category['filter'] = $parentsValues; } print GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'value', 'public_value', 'sort', $link_category, ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]); ?> </div>
<?php echo Html::a('Добавить наценку', ['create'], ['class' => 'btn btn-success']); ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'goods_type_type', 'label' => 'Тип товара', 'format' => 'html', 'value' => function ($model) { $oGT = \app\models\GoodsType::findOne($model->goods_type_type); return '[' . $oGT->type . '] <b>' . $oGT->name . '</b>'; }], ['attribute' => 'test1', 'label' => 'Параметр', 'format' => 'html', 'value' => function ($model) { $arP = explode(';', $model->params); $arV = explode(';', $model->values); $arPP = []; foreach ($arP as $key => $paramId) { $oPar = \app\models\GoodsParamsName::findOne($paramId); $oVal = app\models\GoodsParams::findOne($arV[$key]); if ($oPar instanceof \app\models\GoodsParamsName && $oVal instanceof app\models\GoodsParams) { $arPP[] = $oPar->name . ': <b>' . $oVal->value . '</b>'; } } return implode('; ', $arPP); }], ['attribute' => 'coef1', 'label' => 'Коэффициент', 'format' => 'html', 'value' => function ($model) { return $model->coef; }], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update} {delete}']]]); ?> <?php } ?> </div>