<?php

use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */

$this->title = Yii::t('relation', 'Relation for Group "{group}"', ['group' => $group->name]);
$this->params['breadcrumbs'][] = ['label' => Yii::t('rubrication', 'Tax Groups'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="group-relation">

    <h1><?= Html::encode($this->title) ?></h1>

<!--    <p>-->
<!--        --><?//= Html::a(Yii::t('relation', 'Create relation'), ['create?relation='. $relation_key], ['class' => 'btn btn-success']) ?>
<!--    </p>-->

    <?php
    $dataProvider = new \yii\data\ArrayDataProvider([
        'allModels' => $items,
        'sort' => [
            'attributes' => ['name', 'alias', 'entity1_label', 'entity2_label'],
        ],
        'pagination' => [
            'pageSize' => 10,
        ],
    ]);
    ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],
            'name',
            'alias',
            'entity1_label',
            'entity2_label',
            /*[
                'class' => 'yii\grid\ActionColumn',
                'template' => '{view}',
                'buttons' => [
                    'view' => function ($url, $model) {
                        return Html::a('<span class="glyphicon glyphicon-th-list"></span>', $url, [
                            'title' => Yii::t('relation', 'View pars'),
                        ]);
                    },
                ],
                'urlCreator' => function ($action, $model, $key, $index) {
                    if ($action === 'view') {
                        $url ='/admin/relation/manage/pars?relation='. $model['key'];
                        return $url;
                    }
                }
            ],*/
        ],
    ]); ?>
</div>
