Blame view

frontend/views/accounts/feedback-company.php 4.92 KB
14a09168   Alex Savenko   init commit
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
  <?php
      use common\models\FeedbackCompanySearch;
      use yii\data\ActiveDataProvider;
      use yii\grid\ActionColumn;
      use yii\grid\GridView;
      use yii\grid\SerialColumn;
      use yii\helpers\Html;
      use yii\jui\DatePicker;
      use yii\web\View;
  
      /**
       * @var View                  $this
       * @var FeedbackCompanySearch $searchModel
       * @var ActiveDataProvider    $dataProvider
       */
      $this->title = 'Заявки';
      $this->params[ 'breadcrumbs' ][] = $this->title;
  ?>
  <div class="login-left-column-title fix"><?= $this->title ?></div>
  <div class="admin-table-portfolio">
      <?= GridView::widget([
          'options'      => [ 'class' => 'style admin-all-pages-wr fix_last_td_' ],
          'dataProvider' => $dataProvider,
          'filterModel'  => $searchModel,
          'columns'      => [
              [ 'class' => SerialColumn::className() ],
              [
                  'attribute' => 'date_add',
                  'filter'    => "<div class=\"input-group input-group-xs input-daterange\">
  <span class='field-teamsearch-experience_from_from'>" . DatePicker::widget([
                          'model'         => $searchModel,
                          'attribute'     => 'date_add_from',
                          'language'      => 'ru',
                          'dateFormat'    => 'yyyy-MM-dd',
                          'clientOptions' => [
                              'changeYear'  => true,
                              'changeMonth' => true,
                              'maxDate' => ($searchModel->date_add_to?:date('Y-m-d')),
                          ],
                      ]) . "</span>
  <span class=\"input-group-addon kv-field-separator\">
  <i class=\"glyphicon glyphicon-resize-horizontal\"></i>
  </span>
  <span class='field-teamsearch-experience_from_to'>" . DatePicker::widget([
                          'model'         => $searchModel,
                          'attribute'     => 'date_add_to',
                          'language'      => 'ru',
                          'dateFormat'    => 'yyyy-MM-dd',
                          'clientOptions' => [
                              'changeYear'  => true,
                              'changeMonth' => true,
                              'minDate' => $searchModel->date_add_from,
                              'maxDate' => date('Y-m-d'),
                          ],
                      ]) . "</span>
  </div>",
                  'value'     => function($model, $key) {
                      return date('Y-m-d H:i:s', $model->date_add);
                  },
              ],
              [
                  'attribute' => 'name',
                  'label'     => 'Имя и фамилия',
              ],
              'phone',
              [
                  'attribute' => 'status',
                  'filter' => [
                      1 => 'Только непрочитанные',
                  ],
                  'filterInputOptions' => [
                      'prompt' => 'Все записи',
                      'class' => 'form-control',
                  ],
              ],
              [
                  'class'    => ActionColumn::className(),
                  'buttons'  => [
                      'delete' => function($url, $model, $key) {
                          return Html::a(Html::tag('span', '', [
                              'class' => 'glyphicon glyphicon-trash',
                          ]), [
                              'accounts/feedback-delete',
                              'id' => $model->feedback_company_id,
                          ], [
                              'title'        => 'Удалить',
                              'aria-label'   => 'Удалить',
                              'data-confirm' => 'Вы уверены, что хотите удалить данную заявку?',
                              'data-method'  => 'post',
                              'data-pjax'    => 0,
                          ]);
                      },
                      'read'   => function($url, $model, $key) {
                          if($model->status == $model::STATUS_NEW) {
                              return Html::a(Html::tag('span', '', [
                                  'class' => 'glyphicon glyphicon-ok',
                              ]), [
                                  'accounts/feedback-read',
                                  'id' => $model->feedback_company_id,
                              ], [
                                  'title'        => 'Прочесть',
                                  'aria-label'   => 'Прочесть',
                                  'data-confirm' => 'Вы уверены, что хотите отметить заявку прочтенной?',
                                  'data-method'  => 'post',
                                  'data-pjax'    => 0,
                              ]);
                          } else {
                              return false;
                          }
                      },
                  ],
                  'template' => '{read}{delete}',
              ],
          ],
      ]); ?>
  </div>