4 use yii\helpers\ArrayHelper;
9 use app\models\Regions;
11 /* @var $this yii\web\View */
12 /* @var $searchModel app\models\LocationsSearch */
13 /* @var $dataProvider yii\data\ActiveDataProvider */
15 $this->title = Yii::t('locations', 'Locations');
16 $this->params[ 'breadcrumbs' ][] = [ 'label' => Yii::t('items', 'Items'), 'url' => [ 'items/index' ]];
17 $this->params[ 'breadcrumbs' ][] = $this->title;
19 <div class="locations-index">
21 <h1><?= Html::encode($this->title) ?></h1>
24 <?= Html::a(Yii::t('locations', 'Create location'), [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
27 <?php Pjax::begin(); ?>
28 <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
30 <?= GridView::widget([
31 'id' => 'LocationsTable',
32 'dataProvider' => $dataProvider,
33 'filterModel' => $searchModel,
35 [ 'class' => 'yii\grid\SerialColumn' ],
39 // Название места размещения
40 [ 'attribute' => 'name',
41 'value' => function ($data)
43 return showUrlUpdate($data->name, $data);
49 [ 'attribute' => 'regionName',
50 'filter' => Html::activeDropDownList(
53 ArrayHelper::merge([ '' => Yii::t('locations', 'All regions') ], ArrayHelper::map(Regions::find()->orderBy('name')->all(), 'name', 'name')),
54 [ 'class' => 'form-control' ],
56 'value' => function ($data)
58 return showUrlUpdate($data->regions->name, $data);
63 [ 'class' => 'yii\grid\ActionColumn', 'template' => '{delete}' ],