Blame view

frontend/views/accounts/participant.php 6.21 KB
2f324895   Yarik   test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <?php
      /**
       * @var View                $this
       * @var PortfolioUserSearch $searchModel
       * @var ActiveDataProvider  $dataProvider
       */
      use common\models\PortfolioUser;
      use common\models\PortfolioUserSearch;
      use yii\data\ActiveDataProvider;
      use yii\grid\ActionColumn;
      use yii\grid\DataColumn;
      use yii\grid\GridView;
      use yii\helpers\Html;
      use yii\web\View;
  
      $this->title = 'Портфолио участник';
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
c6206ab6   Виталий   git
19
  <div class="login-left-column-title fix"><?= $this->title ?></div>
2f324895   Yarik   test
20
21
  <div class="admin-table-portfolio">
      <?= GridView::widget([
aa08967c   Виталий   git
22
          'options'      => [ 'class' => 'style admin-all-pages-wr fix_last_td_' ],
2f324895   Yarik   test
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
          'dataProvider' => $dataProvider,
          'filterModel'  => $searchModel,
          'columns'      => [
              [
                  'attribute' => 'project',
                  'content'   => function($model, $key, $index, $column) {
                      /**
                       * @var PortfolioUser $model
                       */
                      $type = $model->portfolio->user->type;
                      $type_string = ( $type == 2 ) ? 'company' : 'performer';
                      return Html::a($model->portfolio->name, [
                          $type_string . '/portfolio-view',
                          $type_string . '_id' => $model->portfolio->user_id,
                          'portfolio_id'       => $model->portfolio->portfolio_id,
                      ], [
                          'target' => '_blank',
                      ]);
                  },
              ],
              [
                  'attribute' => 'position',
                  'value'     => function($model, $key, $index, $column) {
                      /**
                       * @var PortfolioUser $model
                       * @var DataColumn    $column
                       * @var int           $key
                       * @var int           $index
                       */
                      if(empty( $model[ $column->attribute ] )) {
                          return NULL;
                      } else {
                          return $model[ $column->attribute ];
                      }
                  },
              ],
              [
                  'attribute'     => 'time',
                  'filter'        => Html::tag('div', Html::activeInput('text', $searchModel, 'time_from', [ 'class' => 'form-control' ]), [ 'style' => 'width:70px;display:inline-block' ]) . Html::tag('div', Html::tag('i', '', [
                          'class' => 'glyphicon glyphicon-resize-horizontal',
                          'style' => 'left:3px',
                      ]), [ 'style' => 'width:20px;display:inline-block;' ]) . Html::tag('div', Html::activeInput('text', $searchModel, 'time_to', [ 'class' => 'form-control' ]), [ 'style' => 'width:70px;display:inline-block' ]) . ( ( $searchModel->hasErrors('time_from') ) ? Html::error($searchModel, 'time_from', [ 'class' => 'help-block' ]) : '' ) . ( ( $searchModel->hasErrors('time_to') ) ? Html::error($searchModel, 'time_to', [ 'class' => 'help-block' ]) : '' ),
                  'filterOptions' => [
                      'class' => ( $searchModel->hasErrors('time_from') || $searchModel->hasErrors('time_to') ) ? 'has-error' : '',
                      'style' => 'width: 200px',
                  ],
              ],
              [
                  'attribute' => 'status',
                  'filter'    => [
                      1 => 'Подтверждено',
                      2 => 'Ожидание',
                  ],
                  'value'     => function($model) {
                      if($model->status == 1) {
                          return 'Подтвержден';
                      } elseif($model->status == 2) {
                          return 'В ожидании';
                      } else {
                          return 'Неизвестный';
                      }
                  },
              ],
              [
                  'class'    => ActionColumn::className(),
                  'buttons'  => [
                      'confirm' => function($url, $model, $key) {
                          return ( $model->status == 2 ) ? Html::a(Html::img('/images/tick.png', [
                              'width'  => '15px',
                              'height' => '15px',
                          ]), [
                              'accounts/participant-confirm',
                              'id' => $model->portfolio_user_id,
                          ], [
                              'title'        => 'Подтвердить',
                              'aria-label'   => 'Подтвердить',
                              'data-confirm' => 'Вы уверены, что хотите подтвердить участие в данном проекте?',
                              'data-method'  => 'post',
                              'data-pjax'    => 0,
                          ]) : '';
                      },
                      'edit'    => function($url, $model, $key) {
                          return Html::a(Html::img('/images/ico_pencil.png'), [
                              'accounts/participant-edit',
                              'id' => $model->portfolio_user_id,
                          ], [
                              'title'      => 'Редактировать',
                              'aria-label' => 'Редактировать',
                              'data-pjax'  => 0,
                          ]);
                      },
                      'deny'    => function($url, $model, $key) {
                          return Html::a(Html::img('/images/delete-ico.png'), [
                              'accounts/participant-delete',
                              'id' => $model->portfolio_user_id,
                          ], [
                              'title'        => 'Удалить',
                              'aria-label'   => 'Удалить',
                              'data-confirm' => 'Вы уверены, что хотите отказаться от участия в данном проекте?',
                              'data-method'  => 'post',
                              'data-pjax'    => 0,
                          ]);
                      },
                  ],
                  'template' => '{confirm}{edit}{deny}',
              ],
          ],
      ]); ?>
  </div>