= Html::encode($this->title) ?>
= Html::a(Yii::t('user', 'Добавить пользователя'), Url::to(['create']), ['class' => 'btn btn-outline-primary btn-sm']) ?>
'user-form',
'method' => 'get',
'action' => '/user',
]); ?>
= $form->field($searchModel, 'role')->dropDownList(UserHelper::roleNameList(), ['prompt' => Yii::t('user', 'Все')]) ?>
= $form->field($searchModel, 'status')->dropDownList(UserHelper::statusNameList(), ['prompt' => Yii::t('user', 'Все')]) ?>
= Html::submitButton(Yii::t('user', 'Фильтр'), ['class' => 'btn btn-sm btn-success']) ?>
= Html::a(Yii::t('user', 'Сбросить фильтр'), Url::to(['/user']), ['class' => 'btn btn-outline-dark btn-sm']) ?>
= GridView::widget([
'tableOptions' => ['class' => 'table table-striped table-bordered'],
'dataProvider' => $dataProvider,
'pager' => [
'firstPageLabel' => Yii::t('user', 'В начало'),
'lastPageLabel' => Yii::t('user', 'В конец'),
],
'columns' => [
['class' => yii\grid\SerialColumn::class],
'email',
[
'attribute' => 'role',
'format' => 'raw',
'value' => function ($model) {
if ($model->role) {
return UserHelper::roleNameList($model->role);
} else {
return Yii::t('user', 'Роль не указана');
}
},
],
[
'attribute' => 'status',
'format' => 'raw',
'value' => function ($model) {
return UserHelper::statusNameList($model->status);
},
],
[
'class' => yii\grid\ActionColumn::class,
'template' => '{reset-password}',
'buttons' => [
'reset-password' => function ($url, $model, $key) {
$hidden = 'd-none';
if ($model->status == UserHelper::STATUS_ACTIVE) {
$hidden = '';
}
return Html::a(Yii::t('user', 'Сброс пароля'), $url, ['class' => "btn btn-sm btn-outline-secondary reset-password-{$model->id} $hidden", 'data-id' => $model->id]);
},
],
],
[
'class' => yii\grid\ActionColumn::class,
'template' => '{update}',
'buttons' => [
'update' => function ($url, $model, $key) {
return Html::a(Yii::t('user', '{icon}', [
'icon' => HtmlHelper::ICON_UPDATE,
]), $url);
},
],
],
[
'class' => yii\grid\ActionColumn::class,
'template' => '{ban}',
'buttons' => [
'ban' => function ($url, $model, $key) {
if ($model->status != UserHelper::STATUS_BLOCKED_MANUAL && $model->status != UserHelper::STATUS_BLOCKED_AUTO) {
return Html::a(Yii::t('user', '{icon}', [
'icon' => HtmlHelper::ICON_DELETE,
]), $url);
} else {
return '';
}
},
],
],
],
]); ?>