66 lines
2.2 KiB
PHP
Raw Normal View History

2018-10-11 17:24:47 +03:00
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel backend\modules\company\models\CompanySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
2018-11-05 12:45:21 +03:00
$this->title = 'Компании';
2018-10-11 17:24:47 +03:00
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="company-index">
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<p>
2018-11-05 12:45:21 +03:00
<?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
2018-10-11 17:24:47 +03:00
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
2018-11-05 12:45:21 +03:00
//'id',
2018-10-11 17:24:47 +03:00
'name',
2018-12-03 12:10:39 +03:00
[
'attribute' => 'project.name',
'label' => 'Проект',
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
'name' => 'CompanySearch[projectId]',
'data' => \common\models\Project::getList(),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
//'description:ntext',
//'status_id',
[
2019-07-04 12:29:42 +03:00
'attribute' => 'status_id',
2018-12-03 12:10:39 +03:00
'value' => function($model){
2019-07-04 12:29:42 +03:00
return isset($model->status->name) ? $model->status->name : 'Не задано';
2018-12-03 12:10:39 +03:00
},
'filter' => kartik\select2\Select2::widget([
'model' => $searchModel,
2019-07-04 12:29:42 +03:00
'attribute' => 'status_id',
2018-12-03 12:10:39 +03:00
'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_COMPANY),
'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
'pluginOptions' => [
'allowClear' => true
],
]),
],
2018-10-11 17:24:47 +03:00
//'created_at',
//'updated_at',
['class' => 'yii\grid\ActionColumn'],
],
]); ?>
</div>