Blame view

frontend/views/accounts/team.php 3.75 KB
b95371cf   Yarik   test
1
2
3
4
5
6
7
8
9
  <?php
      /**
       * @var TeamSearch         $searchModel
       * @var ActiveDataProvider $dataProvider
       */
      use common\models\TeamSearch;
      use yii\data\ActiveDataProvider;
      use yii\grid\GridView;
      use yii\helpers\Html;
588209fc   Yarik   test
10
      use yii\widgets\ActiveField;
b95371cf   Yarik   test
11
12
13
14
  
      $this->title = 'Команда';
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
588209fc   Yarik   test
15
16
17
18
  <h1><?= $this->title ?></h1>
  <p>
      <?= Html::a(Yii::t('app', 'Добавить'), [ 'team-create' ], [ 'class' => 'btn btn-success' ]) ?>
  </p>
b95371cf   Yarik   test
19
20
21
22
23
24
  <?= GridView::widget([
      'dataProvider' => $dataProvider,
      'filterModel'  => $searchModel,
      'columns'      => [
          [
              'attribute' => 'team_id',
588209fc   Yarik   test
25
              'label'     => 'ID',
b95371cf   Yarik   test
26
27
          ],
          [
588209fc   Yarik   test
28
29
              'attribute' => 'user',
              'label'     => 'ФИО',
b95371cf   Yarik   test
30
31
          ],
          [
588209fc   Yarik   test
32
33
34
35
36
37
38
              'attribute' => 'link',
              'format'    => 'boolean',
              'label'     => 'Участник МФП',
              'filter'    => [
                  1 => 'Да',
                  0 => 'Нет',
              ],
b95371cf   Yarik   test
39
40
          ],
          [
588209fc   Yarik   test
41
42
43
              'attribute' => 'department',
              'value'     => 'department.name',
              'label'     => 'Отдел компании',
b95371cf   Yarik   test
44
45
          ],
          [
588209fc   Yarik   test
46
47
              'attribute' => 'experience_from',
              'value'     => function($model, $key, $index, $column) {
b95371cf   Yarik   test
48
49
                  return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from;
              },
588209fc   Yarik   test
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
              '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>",
b95371cf   Yarik   test
84
          ],
588209fc   Yarik   test
85
86
          'position',
          'country_id',
b95371cf   Yarik   test
87
  
588209fc   Yarik   test
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
          [
              '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}'
          ],
b95371cf   Yarik   test
106
      ],
588209fc   Yarik   test
107
  ]); ?>