portfolio.php 3.38 KB
<?php
    /**
     * @var PortfolioSearch    $searchModel
     * @var ActiveDataProvider $dataProvider
     */
    use common\models\PortfolioSearch;
    use yii\data\ActiveDataProvider;
    use yii\grid\ActionColumn;
    use yii\grid\GridView;
    use yii\helpers\Html;
    use yii\jui\DatePicker;

    $this->title = 'Портфолио';
    $this->params[ 'breadcrumbs' ][] = $this->title;
?>
<div class="login-left-column-title"><?= $this->title ?></div>
<div class="admin-all-pages-add">
    <?= Html::a(Yii::t('app', 'Добавить'), [ 'portfolio-create' ], [ 'class' => 'btn btn-success' ]) ?>
</div>
<?= GridView::widget([
    'options' => ['class'=>'style admin-all-pages-wr'],
    'dataProvider' => $dataProvider,
    'filterModel'  => $searchModel,
    'columns'      => [
        [
            'attribute' => 'portfolio_id',
            'label'     => 'ID',
        ],
        'name',
        [
            'attribute' => 'date_add',
            'filter' => "<div class=\"input-group input-group-xs input-daterange\">
<span class='field-teamsearch-experience_from_from'>".
                DatePicker::widget([
                    'model' => $searchModel,
                    'attribute' => 'date_add_from',
                    'language' => 'ru',
                    'dateFormat' => 'yyyy-MM-dd',
                    'clientOptions' => [
                        'changeYear' => true,
                        'changeMonth' => true,
                    ],
                ]).
                "</span>
<span class=\"input-group-addon kv-field-separator\">
<i class=\"glyphicon glyphicon-resize-horizontal\"></i>
</span>
<span class='field-teamsearch-experience_from_to'>".
                DatePicker::widget([
                    'model' => $searchModel,
                    'attribute' => 'date_add_to',
                    'language' => 'ru',
                    'dateFormat' => 'yyyy-MM-dd',
                    'clientOptions' => [
                        'changeYear' => true,
                        'changeMonth' => true,
                    ],
                ])
                ."</span>
</div>",
            'format' => 'html',
        ],
        'view_count',
        [
            'attribute' => 'specializationString',
        ],
        [
            'class'    => ActionColumn::className(),
            'buttons'  => [
                'update' => function($url, $model, $key) {
                    return Html::a('<img src="/images/ico_pencil.png" alt="">', [
                        'portfolio-update',
                        'id' => $model->portfolio_id,
                    ],[
                        'title'        => 'Редактировать',
                    ]);
                },
                'delete' => function($url, $model, $key) {
                    return Html::a('<img src="/images/delete-ico.png" alt="">', [
                        'portfolio-delete',
                        'id' => $model->portfolio_id,
                    ], [
                        'title'        => 'Удалить',
                        'aria-label'   => 'Удалить',
                        'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
                        'data-method'  => 'post',
                        'data-pjax'    => '0',
                    ]);
                },
            ],
            'template' => '{update} {delete}',
        ],
    ],
]); ?>