Blame view

frontend/views/accounts/team.php 3.94 KB
b95371cf   Yarik   test
1
2
3
4
  <?php
      /**
       * @var TeamSearch         $searchModel
       * @var ActiveDataProvider $dataProvider
e4a014b8   Yarik   test
5
       * @var string[]           $departments
b95371cf   Yarik   test
6
7
8
9
10
       */
      use common\models\TeamSearch;
      use yii\data\ActiveDataProvider;
      use yii\grid\GridView;
      use yii\helpers\Html;
588209fc   Yarik   test
11
      use yii\widgets\ActiveField;
b95371cf   Yarik   test
12
13
14
15
  
      $this->title = 'Команда';
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
c0e9e0fe   Виталий   tokar commit
16
17
  <div class="login-left-column-title"><?= $this->title ?></div>
  <div class="admin-all-pages-add">
588209fc   Yarik   test
18
      <?= Html::a(Yii::t('app', 'Добавить'), [ 'team-create' ], [ 'class' => 'btn btn-success' ]) ?>
c0e9e0fe   Виталий   tokar commit
19
20
21
  </div>
  
  
b95371cf   Yarik   test
22
  <?= GridView::widget([
e4a014b8   Yarik   test
23
      'options'      => [ 'class' => 'style admin-all-pages-wr' ],
b95371cf   Yarik   test
24
25
26
27
28
      'dataProvider' => $dataProvider,
      'filterModel'  => $searchModel,
      'columns'      => [
          [
              'attribute' => 'team_id',
588209fc   Yarik   test
29
              'label'     => 'ID',
b95371cf   Yarik   test
30
31
          ],
          [
588209fc   Yarik   test
32
33
              'attribute' => 'user',
              'label'     => 'ФИО',
b95371cf   Yarik   test
34
35
          ],
          [
588209fc   Yarik   test
36
37
38
39
40
41
42
              'attribute' => 'link',
              'format'    => 'boolean',
              'label'     => 'Участник МФП',
              'filter'    => [
                  1 => 'Да',
                  0 => 'Нет',
              ],
b95371cf   Yarik   test
43
44
          ],
          [
588209fc   Yarik   test
45
46
47
              'attribute' => 'department',
              'value'     => 'department.name',
              'label'     => 'Отдел компании',
e4a014b8   Yarik   test
48
              'filter'    => $departments,
b95371cf   Yarik   test
49
          ],
e4a014b8   Yarik   test
50
          'position',
b95371cf   Yarik   test
51
          [
588209fc   Yarik   test
52
53
              'attribute' => 'experience_from',
              'value'     => function($model, $key, $index, $column) {
2cee8b86   Yarik   test
54
55
56
57
58
                  if(!empty($model->experience_from)) {
                      return \Yii::$app->formatter->asDate(time(), 'yyyy') - $model->experience_from;
                  } else {
                      return 'Год начала не задан';
                  }
b95371cf   Yarik   test
59
              },
588209fc   Yarik   test
60
              'label'     => 'Опыт, лет',
405c1458   Yarik   test
61
62
              'filter'    => "<div class=\"input-group input-group-xs input-daterange\">
  <span class='field-teamsearch-experience_from_from'>
e4a014b8   Yarik   test
63
  <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' ] . "'>
405c1458   Yarik   test
64
  </span>
588209fc   Yarik   test
65
66
  <span class=\"input-group-addon kv-field-separator\">
  <i class=\"glyphicon glyphicon-resize-horizontal\"></i>
405c1458   Yarik   test
67
68
  </span>
  <span class='field-teamsearch-experience_from_to'>
e4a014b8   Yarik   test
69
  <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'>
405c1458   Yarik   test
70
  </span>
588209fc   Yarik   test
71
  </div>",
b95371cf   Yarik   test
72
          ],
588209fc   Yarik   test
73
          'country_id',
b95371cf   Yarik   test
74
  
588209fc   Yarik   test
75
          [
e4a014b8   Yarik   test
76
77
              'class'    => 'yii\grid\ActionColumn',
              'buttons'  => [
588209fc   Yarik   test
78
                  'update' => function($url, $model, $key) {
c0e9e0fe   Виталий   tokar commit
79
                      return Html::a('<img src="/images/ico_pencil.png" alt="">', [
e4a014b8   Yarik   test
80
81
82
83
                          'team-update',
                          'id' => $model->team_id,
                      ], [
                          'title' => 'Редактировать',
c0e9e0fe   Виталий   tokar commit
84
                      ]);
588209fc   Yarik   test
85
86
                  },
                  'delete' => function($url, $model, $key) {
e4a014b8   Yarik   test
87
88
89
90
91
92
                      return Html::a('<img src="/images/delete-ico.png" alt="">', [
                          'team-delete',
                          'id' => $model->team_id,
                      ], [
                          'title'        => 'Удалить',
                          'aria-label'   => 'Удалить',
588209fc   Yarik   test
93
                          'data-confirm' => 'Вы уверены, что хотите удалить этот элемент?',
e4a014b8   Yarik   test
94
95
                          'data-method'  => 'post',
                          'data-pjax'    => '0',
588209fc   Yarik   test
96
97
98
                      ]);
                  },
              ],
e4a014b8   Yarik   test
99
              'template' => '{update} {delete}',
588209fc   Yarik   test
100
          ],
b95371cf   Yarik   test
101
      ],
588209fc   Yarik   test
102
  ]); ?>