1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use hipanel\modules\ticket\grid\TicketGridView; |
4
|
|
|
use hipanel\modules\ticket\grid\TicketGridLegend; |
5
|
|
|
use hipanel\widgets\gridLegend\GridLegend; |
6
|
|
|
use hipanel\widgets\IndexPage; |
7
|
|
|
use hipanel\widgets\Pjax; |
8
|
|
|
use yii\helpers\Html; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @var \hipanel\modules\ticket\models\Thread $model |
12
|
|
|
* @var \yii\data\ActiveDataProvider $dataProvider |
13
|
|
|
* @var \hiqdev\higrid\representations\RepresentationCollection $representationCollection |
14
|
|
|
* @var \hipanel\models\IndexPageUiOptions $uiModel |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
$this->title = Yii::t('hipanel:ticket', 'Tickets'); |
18
|
|
|
$this->params['subtitle'] = array_filter(Yii::$app->request->get($model->formName(), [])) ? Yii::t('hipanel', 'filtered list') : Yii::t('hipanel', 'full list'); |
19
|
|
|
$this->params['breadcrumbs'][] = $this->title; |
20
|
|
|
|
21
|
|
|
$this->registerCss(<<<'CSS' |
22
|
|
|
.list-inline { |
23
|
|
|
display: inline-block; |
24
|
|
|
padding-left: .5em; |
25
|
|
|
margin-bottom: 5px; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
.table-list-cell { |
29
|
|
|
position: relative; |
30
|
|
|
display: table-cell; |
31
|
|
|
padding: 0px 10px; |
32
|
|
|
vertical-align: top; |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
.table-list-cell-type { |
36
|
|
|
padding-top: 15px; |
37
|
|
|
padding-left: 0; |
38
|
|
|
padding-right: 0; |
39
|
|
|
width: 20px; |
40
|
|
|
text-align: center; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
.table-list-title { |
44
|
|
|
width: 740px; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
#ticket-grid td.answer .label { |
48
|
|
|
text-align: center; |
49
|
|
|
font-size: 9px; |
50
|
|
|
padding: 2px 5px; |
51
|
|
|
line-height: .9; |
52
|
|
|
} |
53
|
|
|
CSS |
54
|
|
|
); |
55
|
|
|
?> |
56
|
|
|
|
57
|
|
|
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true])) ?> |
58
|
|
|
<?php $page = IndexPage::begin(compact('model', 'dataProvider')) ?> |
59
|
|
|
|
60
|
|
|
<?php $page->setSearchFormData(compact(['state_data', 'topic_data', 'priority_data'])) ?> |
61
|
|
|
|
62
|
|
|
<?php $page->beginContent('main-actions') ?> |
63
|
|
|
<?= Html::a(Yii::t('hipanel:ticket', 'Create ticket'), ['@ticket/create'], ['class' => 'btn btn-sm btn-success']) ?> |
64
|
|
|
<?php $page->endContent() ?> |
65
|
|
|
|
66
|
|
|
<?php $page->beginContent('legend') ?> |
67
|
|
|
<?= GridLegend::widget(['legendItem' => new TicketGridLegend($model)]) ?> |
68
|
|
|
<?php $page->endContent() ?> |
69
|
|
|
|
70
|
|
|
<?php $page->beginContent('sorter-actions') ?> |
71
|
|
|
<?= $page->renderSorter([ |
72
|
|
|
'attributes' => Yii::$app->user->can('support') ? [ |
73
|
|
|
'create_time', 'lastanswer', 'spent', |
74
|
|
|
'subject', 'responsible_id', 'recipient', 'author', 'author_seller', |
75
|
|
|
] : ['subject'], |
76
|
|
|
]) ?> |
77
|
|
|
<?php $page->endContent() ?> |
78
|
|
|
|
79
|
|
|
<?php $page->beginContent('bulk-actions') ?> |
80
|
|
|
<?php if (Yii::$app->user->can('support')) : ?> |
81
|
|
|
<?= $page->renderBulkButton('subscribe', Yii::t('hipanel:ticket', 'Subscribe')) ?> |
82
|
|
|
<?= $page->renderBulkButton('unsubscribe', Yii::t('hipanel:ticket', 'Unsubscribe')) ?> |
83
|
|
|
<?php endif ?> |
84
|
|
|
<?= $page->renderBulkButton('close', Yii::t('hipanel:ticket', 'Close'), [ |
85
|
|
|
'color' => 'danger', |
86
|
|
|
'confirm' => Yii::t('hipanel:ticket', 'Are you sure you want to close these tickets?') |
87
|
|
|
]) ?> |
88
|
|
|
<?php $page->endContent() ?> |
89
|
|
|
|
90
|
|
|
<?php $page->beginContent('table') ?> |
91
|
|
|
<?php $page->beginBulkForm() ?> |
92
|
|
|
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true, 'id' => 'ticket-grid-pjax'])) ?> |
93
|
|
|
<?= TicketGridView::widget([ |
94
|
|
|
'boxed' => false, |
95
|
|
|
'id' => 'ticket-grid', |
96
|
|
|
'tableOptions' => ['class' => 'table table-striped table-bordered table-condensed'], |
97
|
|
|
'dataProvider' => $dataProvider, |
98
|
|
|
'filterModel' => $model, |
99
|
|
|
'rowOptions' => static function ($model) { |
100
|
|
|
return GridLegend::create(new TicketGridLegend($model))->gridRowOptions(); |
101
|
|
|
}, |
102
|
|
|
'enableListChecker' => true, |
103
|
|
|
'columns' => $representationCollection->getByName($uiModel->representation)->getColumns(), |
104
|
|
|
]); ?> |
105
|
|
|
<?php Pjax::end() ?> |
106
|
|
|
<?php $page->endBulkForm() ?> |
107
|
|
|
<?php $page->endContent() ?> |
108
|
|
|
<?php $page->end() ?> |
109
|
|
|
<?php Pjax::end() ?> |
|
|
|
|
110
|
|
|
|
Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.
A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.