1 | <?php |
||
26 | class TicketGridView extends BoxedGridView |
||
27 | { |
||
28 | public $enableListChecker = false; |
||
29 | |||
30 | public $resizableColumns = false; |
||
31 | |||
32 | public function columns() |
||
33 | { |
||
34 | return array_merge(parent::columns(), [ |
||
35 | 'subject' => [ |
||
36 | 'attribute' => 'subject', |
||
37 | 'format' => 'raw', |
||
38 | 'filterInputOptions' => ['style' => 'width:100%', 'class' => 'form-control'], |
||
39 | 'value' => function ($model) { |
||
40 | $decorator = new ThreadDecorator($model); |
||
41 | $title = Html::a($decorator->subject, $model->threadUrl, [ |
||
42 | 'class' => 'text-bold', |
||
43 | 'style' => $model->state === Thread::STATE_CLOSE ? 'color: black !important;' : '', |
||
44 | ]); |
||
45 | $topics = Topic::widget(['topics' => $model->topics]); |
||
46 | $info = Html::tag( |
||
47 | 'span', |
||
48 | sprintf('#%s %s %s', |
||
49 | $model->id, |
||
50 | Html::tag('span', Yii::t('hipanel:ticket', $model->state_label), ['class' => 'text-bold']), |
||
51 | Yii::$app->formatter->asDatetime($model->create_time) |
||
52 | ), |
||
53 | ['class' => 'text-muted', 'style' => 'font-size: smaller;'] |
||
54 | ); |
||
55 | |||
56 | return implode('', [ |
||
57 | Html::tag('span', $title . $topics, ['style' => 'display: flex; justify-content: space-between;']), |
||
58 | $info, |
||
59 | ]); |
||
60 | }, |
||
61 | ], |
||
62 | 'author_id' => [ |
||
63 | 'class' => ClientColumn::class, |
||
64 | 'label' => Yii::t('hipanel:ticket', 'Author'), |
||
65 | 'idAttribute' => 'author_id', |
||
66 | 'sortAttribute' => 'author', |
||
67 | 'attribute' => 'author_id', |
||
68 | <<<<<<< HEAD |
||
|
|||
69 | 'format' => 'raw', |
||
70 | ======= |
||
71 | 'contentOptions' => [ |
||
72 | 'style' => 'width: 1%; white-space: nowrap;', |
||
73 | ], |
||
74 | >>>>>>> 9fa50bd532db1148300eaafb98a058eb277f89b7 |
||
75 | 'value' => function ($model) { |
||
76 | return ClientSellerLink::widget(compact('model')); |
||
77 | }, |
||
78 | ], |
||
79 | 'responsible_id' => [ |
||
80 | 'class' => ClientColumn::class, |
||
81 | 'idAttribute' => 'responsibles', |
||
82 | 'sortAttribute' => 'responsible', |
||
83 | 'attribute' => 'responsible', |
||
84 | 'clientType' => ['admin', 'reseller', 'manager'], |
||
85 | <<<<<<< HEAD |
||
86 | 'format' => 'raw', |
||
87 | ======= |
||
88 | 'contentOptions' => [ |
||
89 | 'style' => 'width: 1%; white-space: nowrap;', |
||
90 | ], |
||
91 | >>>>>>> 9fa50bd532db1148300eaafb98a058eb277f89b7 |
||
92 | 'value' => function ($model) { |
||
93 | return Html::a(Html::encode($model['responsible']), ['/client/client/view', 'id' => $model->responsible_id]); |
||
94 | }, |
||
95 | 'visible' => Yii::$app->user->can('support'), |
||
96 | ], |
||
97 | 'recipient_id' => [ |
||
98 | 'class' => ClientColumn::class, |
||
99 | 'idAttribute' => 'recipient_id', |
||
100 | 'label' => Yii::t('hipanel:ticket', 'Recipient'), |
||
101 | 'sortAttribute' => 'recipient', |
||
102 | 'attribute' => 'recipient_id', |
||
103 | <<<<<<< HEAD |
||
104 | 'format' => 'raw', |
||
105 | ======= |
||
106 | 'contentOptions' => [ |
||
107 | 'style' => 'width: 1%; white-space: nowrap;', |
||
108 | ], |
||
109 | >>>>>>> 9fa50bd532db1148300eaafb98a058eb277f89b7 |
||
110 | 'value' => function ($model) { |
||
111 | return Html::a(Html::encode($model->recipient), ['/client/client/view', 'id' => $model->recipient_id]); |
||
112 | }, |
||
113 | 'visible' => Yii::$app->user->can('support'), |
||
114 | ], |
||
115 | 'answer_count' => [ |
||
116 | 'attribute' => 'answer_count', |
||
117 | 'label' => Yii::t('hipanel:ticket', 'Answers'), |
||
118 | 'format' => 'raw', |
||
119 | 'filter' => false, |
||
120 | 'enableSorting' => false, |
||
121 | 'value' => function ($model) { |
||
122 | $lastAnswer = [ |
||
123 | ClientSellerLink::widget([ |
||
124 | 'model' => $model, |
||
125 | 'clientAttribute' => 'replier', |
||
126 | 'clientIdAttribute' => 'replier_id', |
||
127 | 'sellerAttribute' => false, |
||
128 | ]), '<br>', |
||
129 | |||
130 | Html::tag('span', Yii::$app->formatter->asRelativeTime($model->reply_time), [ |
||
131 | 'style' => 'font-size: smaller;white-space: nowrap;', |
||
132 | 'class' => 'text-muted', |
||
133 | ]), ' ', |
||
134 | |||
135 | Html::tag('span', $model->answer_count, [ |
||
136 | 'class' => 'label label-default', |
||
137 | 'title' => Yii::t('hipanel:ticket', |
||
138 | 'Ticket contains {n, plural, one{# answer} other{# answers}}', |
||
139 | ['n' => $model->answer_count] |
||
140 | ), |
||
141 | ]), |
||
142 | ]; |
||
143 | |||
144 | return implode('', $lastAnswer); |
||
145 | }, |
||
146 | 'contentOptions' => [ |
||
147 | 'class' => 'answer', |
||
148 | 'style' => 'width: 1%; white-space: nowrap;', |
||
149 | ], |
||
150 | ], |
||
151 | 'actions' => [ |
||
152 | 'class' => MenuColumn::class, |
||
153 | 'menuClass' => TicketActionsMenu::class, |
||
154 | ], |
||
155 | ]); |
||
156 | } |
||
157 | |||
169 |