team.php
3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* @var TeamSearch $searchModel
* @var ActiveDataProvider $dataProvider
*/
use common\models\TeamSearch;
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\widgets\ActiveField;
$this->title = 'Команда';
$this->params[ 'breadcrumbs' ][] = $this->title;
?>
<h1><?= $this->title ?></h1>
<p>
<?= Html::a(Yii::t('app', 'Добавить'), [ 'team-create' ], [ 'class' => 'btn btn-success' ]) ?>
</p>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
[
'attribute' => 'team_id',
'label' => 'ID',
],
[
'attribute' => 'user',
'label' => 'ФИО',
],
[
'attribute' => 'link',
'format' => 'boolean',
'label' => 'Участник МФП',
'filter' => [
1 => 'Да',
0 => 'Нет',
],
],
[
'attribute' => 'department',
'value' => 'department.name',
'label' => 'Отдел компании',
],
[
'attribute' => 'experience_from',
'value' => function($model, $key, $index, $column) {
return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from;
},
'label' => 'Опыт, лет',
'filter' => "<div class=\"input-group input-group-xs input-daterange\">" . (new ActiveField([
'template' => '{input}',
'inputOptions' => [
'style' => 'width:auto',
'class' => 'form-control',
'min' => '0',
'max' => '100',
],
'options' => [
'tag' => 'span',
'class' => '',
],
'model' => $searchModel,
'attribute' => 'experience_from_from',
]))->input('number') . "
<span class=\"input-group-addon kv-field-separator\">
<i class=\"glyphicon glyphicon-resize-horizontal\"></i>
</span>" . (new ActiveField([
'template' => '{input}',
'inputOptions' => [
'style' => 'width:auto',
'class' => 'form-control',
'min' => '0',
'max' => '100',
],
'options' => [
'tag' => 'span',
'class' => '',
],
'model' => $searchModel,
'attribute' => 'experience_from_to',
]))->input('number') . "
</div>",
],
'position',
'country_id',
[
'class' => 'yii\grid\ActionColumn',
'buttons' => [
'update' => function($url, $model, $key) {
return Html::a('Update', ['team-update', 'id' => $model->team_id]);
},
'delete' => function($url, $model, $key) {
return Html::a('Delete', ['team-delete', 'id' => $model->team_id], [
'title' => 'Удалить',
'aria-label' => 'Удалить',
'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
'data-method' => 'post',
'data-pjax' => '0',
]);
},
],
'template' => '{update} {delete}'
],
],
]); ?>