Blame view

frontend/views/accounts/projects.php 5.21 KB
eb7e82fb   Administrator   29.02.16
1
2
3
4
5
  <?php

      /**

       * @var ProjectSearch    $searchModel

       * @var ActiveDataProvider $dataProvider

       */

492ed7f7   Yarik   test
6
      use common\models\Project;

eb7e82fb   Administrator   29.02.16
7
8
9
10
11
12
      use common\models\ProjectSearch;

      use yii\data\ActiveDataProvider;

      use yii\grid\ActionColumn;

      use yii\grid\GridView;

      use yii\helpers\Html;

      use yii\jui\DatePicker;

492ed7f7   Yarik   test
13
      use yii\widgets\ActiveField;

eb7e82fb   Administrator   29.02.16
14
  

b9a54f61   Yarik   test
15
      $this->title = Yii::t('app', 'Projects');

eb7e82fb   Administrator   29.02.16
16
17
18
19
      $this->params[ 'breadcrumbs' ][] = $this->title;

  ?>

  <div class="login-left-column-title"><?= $this->title ?></div>

  <div class="admin-all-pages-add">

06ec2844   Administrator   28.03.16
20
      <?= Html::a(Yii::t('app', 'add'), [ 'projects-create' ], [ 'class' => 'btn btn-success' ]) ?>

eb7e82fb   Administrator   29.02.16
21
  </div>

c6206ab6   Виталий   git
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  <div class="admin-table-portfolio">

      <?= GridView::widget([

          'options' => ['class'=>'style admin-all-pages-wr'],

          'dataProvider' => $dataProvider,

          'filterModel'  => $searchModel,

          'columns'      => [

              [

                  'attribute' => 'project_id',

                  'label'     => 'ID',

              ],

              'name',

              [

                  'attribute' => 'date_add',

                  'filter' => "<div class=\"input-group input-group-xs input-daterange\">

eb7e82fb   Administrator   29.02.16
36
  <span class='field-teamsearch-experience_from_from'>".

c6206ab6   Виталий   git
37
38
39
40
41
42
43
44
45
46
47
                      DatePicker::widget([

                          'model' => $searchModel,

                          'attribute' => 'date_add_from',

                          'language' => 'ru',

                          'dateFormat' => 'yyyy-MM-dd',

                          'clientOptions' => [

                              'changeYear' => true,

                              'changeMonth' => true,

                          ],

                      ]).

                      "</span>

eb7e82fb   Administrator   29.02.16
48
49
50
51
  <span class=\"input-group-addon kv-field-separator\">

  <i class=\"glyphicon glyphicon-resize-horizontal\"></i>

  </span>

  <span class='field-teamsearch-experience_from_to'>".

c6206ab6   Виталий   git
52
53
54
55
56
57
58
59
60
61
62
                      DatePicker::widget([

                          'model' => $searchModel,

                          'attribute' => 'date_add_to',

                          'language' => 'ru',

                          'dateFormat' => 'yyyy-MM-dd',

                          'clientOptions' => [

                              'changeYear' => true,

                              'changeMonth' => true,

                          ],

                      ])

                      ."</span>

eb7e82fb   Administrator   29.02.16
63
  </div>",

c6206ab6   Виталий   git
64
65
66
67
68
                  'format' => 'html',

              ],

              [

                  'attribute' => 'budget',

                  'filter' => Html::activeInput('text', $searchModel, 'budget_approx', ['class'=>'form-control']),

239b3249   Yarik   test
69
                  'content' => function($model, $key, $index, $column) {

c6206ab6   Виталий   git
70
71
72
73
74
75
76
77
78
79
                      /**

                       * @var Project $model

                       */

                      if($model->contractual) {

                          return 'Договорной';

                      } elseif(empty($model->budget)) {

                          return 'Не задано';

                      } else {

                          return $model->budget;

                      }

eb7e82fb   Administrator   29.02.16
80
                  },

c6206ab6   Виталий   git
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
                  'label' => $searchModel->getAttributeLabel('budget').' +/- 10%',

              ],

              [

                  'attribute' => 'contractual',

                  'filter' => Html::activeDropDownList($searchModel, 'contractual',[1 => 'Только договорные', 2 => 'Без договорных'], ['prompt' => 'Все', 'class'=>'form-control']),

                  'value' => function($model) {

                      return \Yii::$app->formatter->asBoolean($model->contractual);

                  }

              ],

              'city',

              [

                  'attribute' => 'specializationString',

              ],

              'view_count',

              [

                  'value' => function($model, $key, $index, $column) {

                      return count($model->comments);

eb7e82fb   Administrator   29.02.16
98
                  },

c6206ab6   Виталий   git
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
                  'label' => 'Отклики',

              ],

              [

                  'class'    => ActionColumn::className(),

                  'buttons'  => [

                      'update' => function($url, $model, $key) {

                          return Html::a('<img src="/images/ico_pencil.png" alt="">', [

                              'projects-update',

                              'id' => $model->project_id,

                          ],[

                              'title'        => 'Редактировать',

                          ]);

                      },

                      'delete' => function($url, $model, $key) {

                          return Html::a('<img src="/images/delete-ico.png" alt="">', [

                              'projects-delete',

                              'id' => $model->project_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}',

eb7e82fb   Administrator   29.02.16
126
              ],

eb7e82fb   Administrator   29.02.16
127
          ],

c6206ab6   Виталий   git
128
129
130
      ]); ?>

  </div>