$this->params['breadcrumbs'][] = $this->title; $gridId = 'admin-grid'; $gridConfig = ['id' => $gridId, 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'rowOptions' => function ($model, $index, $widget, $grid) { if ($model->intStatus == 0) { return ['class' => 'danger']; } else { return []; } }, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'varName', 'varEmail:email', ['attribute' => 'role', 'value' => function (Admin $data) { $result = []; /** @var mistim\modules\rbac\models\AuthAssignmentModel $role */ foreach ($data->roles as $role) { $result[] = $role->item_name; } return implode(', ', $result); }], ['attribute' => 'dateCreated', 'format' => ['date', 'php:Y-m-d H:i'], 'contentOptions' => ['width' => '190px'], 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'dateCreated', 'template' => '{addon}{input}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])], ['attribute' => 'dateLastEnter', 'format' => ['date', 'php:Y-m-d H:i'], 'contentOptions' => ['width' => '190px'], 'filter' => DatePicker::widget(['model' => $searchModel, 'attribute' => 'dateLastEnter', 'template' => '{addon}{input}', 'clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']])]]]; $showActions = false; if (Yii::$app->user->can('/admin/administrator/view')) { $actions[] = '{view}'; $showActions = $showActions || true; } if (Yii::$app->user->can('/admin/administrator/update')) { $actions[] = '{update}'; $showActions = $showActions || true; } if (Yii::$app->user->can('/admin/administrator/delete')) { $actions[] = '{delete}'; $showActions = $showActions || true; } if ($showActions === true) { $gridConfig['columns'][] = ['class' => ActionColumn::className(), 'template' => implode(' ', $actions), 'contentOptions' => ['align' => 'center', 'width' => '100px']];
/** * @inheritdoc */ public function init() { parent::init(); Html::addCssClass($this->options, 'form-control'); Html::addCssClass($this->containerOptions, 'input-group date'); }