60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<?php
|
|
|
|
use common\models\User;
|
|
use kartik\grid\GridView;
|
|
use yii\helpers\ArrayHelper;
|
|
use yii\helpers\Html;
|
|
use yii\web\YiiAsset;
|
|
use yii\widgets\DetailView;
|
|
|
|
/* @var $this yii\web\View */
|
|
/* @var $model backend\modules\employee\models\Manager */
|
|
/* @var $managerEmployeeSearchModel backend\modules\employee\models\ManagerEmployeeSearch */
|
|
/* @var $managerEmployeeDataProvider yii\data\ActiveDataProvider */
|
|
|
|
$this->title = 'Менеджер: ' . ArrayHelper::getValue($model,'user.username');
|
|
$this->params['breadcrumbs'][] = ['label' => 'Managers', 'url' => ['index']];
|
|
$this->params['breadcrumbs'][] = $this->title;
|
|
YiiAsset::register($this);
|
|
?>
|
|
<div class="manager-view">
|
|
|
|
<p>
|
|
<?= Html::a('Список', ['index', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
|
<?= Html::a('Изменить', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
|
|
<?= Html::a('Удалить', ['delete', 'id' => $model->id], [
|
|
'class' => 'btn btn-danger',
|
|
'data' => [
|
|
'confirm' => 'Вы уверены, что хотите удалить менеджера?',
|
|
'method' => 'post',
|
|
],
|
|
]) ?>
|
|
</p>
|
|
|
|
<?= DetailView::widget([
|
|
'model' => $model,
|
|
'attributes' => [
|
|
'id',
|
|
[
|
|
'attribute' => 'user_id',
|
|
'value' => ArrayHelper::getValue($model,'user.username'),
|
|
],
|
|
],
|
|
]) ?>
|
|
|
|
<?= GridView::widget([
|
|
'dataProvider' => $managerEmployeeDataProvider,
|
|
// 'filterModel' => $managerEmployeeSearchModel,
|
|
'columns' => [
|
|
['class' => 'yii\grid\SerialColumn'],
|
|
[
|
|
'attribute' => 'user_id',
|
|
'filter' => User::find()->select(['username', 'id'])->indexBy('id')->column(),
|
|
'value' => 'user.username',
|
|
],
|
|
['class' => 'yii\grid\ActionColumn'],
|
|
],
|
|
]); ?>
|
|
|
|
</div>
|