add_use_field_for status
This commit is contained in:
parent
39c7f052ee
commit
3142b2f548
@ -2,6 +2,7 @@
|
||||
|
||||
namespace backend\modules\settings\models;
|
||||
|
||||
use common\classes\Debug;
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
@ -63,7 +64,7 @@ class StatusSearch extends Status
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'name', $this->name]);
|
||||
|
||||
// Debug::dd($query->all());
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
|
3
backend/modules/settings/views/status/_additional.php
Normal file
3
backend/modules/settings/views/status/_additional.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
|
||||
echo \common\models\UseStatus::getStatusesText($model->use);
|
@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
use yii\data\ActiveDataProvider;
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\ListView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel backend\modules\status\models\StatusSearch */
|
||||
@ -24,9 +26,23 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'columns' => [
|
||||
['class' => 'yii\grid\SerialColumn'],
|
||||
|
||||
'id',
|
||||
'name',
|
||||
[
|
||||
'label' => 'Доп. информация',
|
||||
'format' => 'raw',
|
||||
'value' => function ($model) {
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $model->getUseStatuses(),
|
||||
]);
|
||||
return ListView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'itemView' => '_additional',
|
||||
'layout' => "{items}",
|
||||
|
||||
]);
|
||||
},
|
||||
'headerOptions' => ['width' => '300'],
|
||||
],
|
||||
['class' => 'yii\grid\ActionColumn'],
|
||||
],
|
||||
]); ?>
|
||||
|
@ -76,8 +76,9 @@ class UseStatus extends \yii\db\ActiveRecord
|
||||
/**
|
||||
* @return string status text label
|
||||
*/
|
||||
public function getStatusesText()
|
||||
public static function getStatusesText($id)
|
||||
{
|
||||
return $this->statuses[$this->status_id];
|
||||
$model = new self();
|
||||
return $model->statuses[$id];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user