PreOrderGridView   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
eloc 24
dl 0
loc 36
c 0
b 0
f 0
ccs 0
cts 28
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 34 1
1
<?php
2
/**
3
 * Server module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-server
6
 * @package   hipanel-module-server
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\server\grid;
12
13
use hipanel\grid\ActionColumn;
14
use hipanel\modules\server\helpers\ServerHelper;
15
use hipanel\modules\server\widgets\OSFormatter;
16
use Yii;
17
18
class PreOrderGridView extends \hipanel\grid\BoxedGridView
19
{
20
    public function columns()
21
    {
22
        return array_merge(parent::columns(), [
23
            'tech_details' => [
24
                'format' => 'raw',
25
                'label' => Yii::t('hipanel:finance:change', 'Operation details'),
26
                'value' => function ($model) {
27
                    $params = $model->params;
28
29
                    return OSFormatter::widget([
30
                        'osimages' => ServerHelper::getOsimages($params['tariff_type']),
31
                        'imageName' => $params['osimage'],
32
                        'infoCircle' => false,
33
                    ]);
34
                },
35
            ],
36
            'user_comment' => [
37
                'filterAttribute' => 'user_comment_like',
38
                'value' => function ($model) {
39
                    return $model->user_comment;
40
                },
41
            ],
42
            'tech_comment' => [
43
                'attribute' => 'tech_comment',
44
            ],
45
            'time' => [
46
                'value' => function ($model) {
47
                    return Yii::$app->formatter->asDatetime($model->time);
48
                },
49
            ],
50
            'actions' => [
51
                'class' => ActionColumn::class,
52
                'template' => '{view}',
53
                'header' => Yii::t('hipanel', 'Actions'),
54
            ],
55
        ]);
56
    }
57
}
58