66 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
<?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 */
 | 
						||
 | 
						||
$this->title = 'Компании';
 | 
						||
$this->params['breadcrumbs'][] = $this->title;
 | 
						||
?>
 | 
						||
<div class="company-index">
 | 
						||
 | 
						||
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
 | 
						||
 | 
						||
    <p>
 | 
						||
        <?= Html::a('Добавить', ['create'], ['class' => 'btn btn-success']) ?>
 | 
						||
    </p>
 | 
						||
 | 
						||
    <?= GridView::widget([
 | 
						||
        'dataProvider' => $dataProvider,
 | 
						||
        'filterModel' => $searchModel,
 | 
						||
        'columns' => [
 | 
						||
            ['class' => 'yii\grid\SerialColumn'],
 | 
						||
 | 
						||
            //'id',
 | 
						||
            'name',
 | 
						||
            [
 | 
						||
                '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',
 | 
						||
            [
 | 
						||
                'attribute' => 'status_id',
 | 
						||
                'value' => function($model){
 | 
						||
                    return isset($model->status->name) ? $model->status->name : 'Не задано';
 | 
						||
                },
 | 
						||
                'filter'    => kartik\select2\Select2::widget([
 | 
						||
                    'model' => $searchModel,
 | 
						||
                    'attribute' => 'status_id',
 | 
						||
                    'data' => \common\models\Status::getStatusesArray(\common\models\UseStatus::USE_COMPANY),
 | 
						||
                    'options' => ['placeholder' => 'Начните вводить...','class' => 'form-control'],
 | 
						||
                    'pluginOptions' => [
 | 
						||
                        'allowClear' => true
 | 
						||
                    ],
 | 
						||
                ]),
 | 
						||
            ],
 | 
						||
            //'created_at',
 | 
						||
            //'updated_at',
 | 
						||
 | 
						||
            ['class' => 'yii\grid\ActionColumn'],
 | 
						||
        ],
 | 
						||
    ]); ?>
 | 
						||
</div>
 |