team.php
3.99 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
<?php
/**
* @var TeamSearch $searchModel
* @var ActiveDataProvider $dataProvider
* @var string[] $departments
*/
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;
?>
<div class="login-left-column-title"><?= $this->title ?></div>
<div class="admin-all-pages-add">
<?= Html::a(Yii::t('app', 'add'), [ 'team-create' ], [ 'class' => 'btn btn-success' ]) ?>
</div>
<?= GridView::widget([
'options' => [ 'class' => 'style admin-all-pages-wr' ],
'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' => 'Отдел компании',
'filter' => $departments,
],
'position',
[
'attribute' => 'experience_from',
'value' => function($model, $key, $index, $column) {
if(!empty($model->experience_from)) {
return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from;
} else {
return 'Год начала не задан';
}
},
'label' => 'Опыт, лет',
'filter' => "<div class=\"input-group input-group-xs input-daterange\">
<span class='field-teamsearch-experience_from_from'>
<input type='number' id='teamsearch-experience_from_from' class='form-control' name='TeamSearch[experience_from_from]' value='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_from' ] . "' min='0' max='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_to' ] . "'>
</span>
<span class=\"input-group-addon kv-field-separator\">
<i class=\"glyphicon glyphicon-resize-horizontal\"></i>
</span>
<span class='field-teamsearch-experience_from_to'>
<input type='number' id='teamsearch-experience_from_to' class='form-control' name='TeamSearch[experience_from_to]' value='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_to' ] . "' min='" . \Yii::$app->request->get('TeamSearch')[ 'experience_from_from' ] . "' max='100'>
</span>
</div>",
],
'country_id',
[
'class' => 'yii\grid\ActionColumn',
'buttons' => [
'update' => function($url, $model, $key) {
return Html::a('<img src="/images/ico_pencil.png" alt="">', [
'team-update',
'id' => $model->team_id,
], [
'title' => 'Редактировать',
]);
},
'delete' => function($url, $model, $key) {
return Html::a('<img src="/images/delete-ico.png" alt="">', [
'team-delete',
'id' => $model->team_id,
], [
'title' => Yii::t('app', 'delete'),
'aria-label' => Yii::t('app', 'delete'),
'data-confirm' => Yii::t('app', 'delete_confirm'),
'data-method' => 'post',
'data-pjax' => '0',
]);
},
],
'template' => '{update} {delete}',
],
],
]); ?>