<?php

use app\models\Authors;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\ActionColumn;
use yii\grid\GridView;

/** @var yii\web\View $this */
/** @var app\models\AuthorsSearch $searchModel */
/** @var yii\data\ActiveDataProvider $dataProvider */

$this->title = 'Authors';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="authors-index">

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

    <p>
        <?= Html::a('Create Authors', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
		'layout' => "{errors}\n{pager}\n{items}\n{pager}\n{summary}",
		'pager' => [
			'prevPageCssClass' => 'page-item',
			'firstPageLabel' => 'Начало',
			'lastPageLabel' => 'Конец',
			'linkOptions' => [ 'class'=>'page-link'],
			'pageCssClass' => 'page-item',
			'disabledListItemSubTagOptions' => ['tag' => 'a', 'class' => 'page-link'],
		],
        'columns' => [
			[
				'attribute' => 'id',
				'value' => 'id',
				'contentOptions'=>['style'=>'width: 30px;']
			],
            'uid',
            'name',
            'url:url',
            'jobTitle',
            //'phone',
			[
				'attribute' => 'active',
				'value' => 'active',
				'contentOptions'=>['style'=>'width: 30px;']
			],
            [
                'class' => ActionColumn::className(),
                'buttonOptions' => ['class' => 'btn btn-default'],
                'contentOptions'=>['style'=>'min-width: 100px;'],
				'visibleButtons' =>[
					'delete' => false,
				],
                'urlCreator' => function ($action, Authors $model, $key, $index, $column) {
                    return Url::toRoute([$action, 'id' => $model->id]);
                 }
            ],
        ],
    ]); ?>


</div>
