HeldPaymentsGridView   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 54
ccs 0
cts 45
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A columns() 0 51 1
1
<?php
2
/**
3
 * Finance module for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-finance
6
 * @package   hipanel-module-finance
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\finance\grid;
12
13
use hipanel\grid\ActionColumn;
14
use Yii;
15
use yii\helpers\Inflector;
16
17
class HeldPaymentsGridView extends \hipanel\grid\BoxedGridView
18
{
19
    public function columns()
20
    {
21
        return array_merge(parent::columns(), [
22
            'user_comment' => [
23
                'attribute' => 'user_comment',
24
                'filterAttribute' => 'user_comment_like',
25
            ],
26
            'tech_comment' => [
27
                'attribute' => 'tech_comment',
28
            ],
29
            'payment_system' => [
30
                'header' => Yii::t('hipanel:finance', 'Payment system'),
31
                'value' => function ($model) {
32
                    return Inflector::titleize($model->params['system']);
33
                },
34
            ],
35
            'txn' => [
36
                'header' => Yii::t('hipanel:finance', 'TXN'),
37
                'value' => function ($model) {
38
                    return $model->params['txn'];
39
                },
40
            ],
41
            'label' => [
42
                'header' => Yii::t('hipanel', 'Description'),
43
                'value' => function ($model) {
44
                    return $model->params['label'];
45
                },
46
            ],
47
            'amount' => [
48
                'header' => Yii::t('hipanel:finance', 'Amount'),
49
                'format' => 'html',
50
                'value' => function ($model) {
51
                    $html = Yii::t('hipanel:finance:change', 'Full:') . '&nbsp;' . Yii::$app->formatter->asCurrency($model->params['sum'], $model->params['purse_currency']) . '<br />';
52
                    $html .= Yii::t('hipanel:finance:change', 'Fee:') . '&nbsp;' . Yii::$app->formatter->asCurrency($model->params['fee'], $model->params['purse_currency']) . '<br />';
53
                    $html .= Yii::t('hipanel:finance:change', 'Sum:') . '&nbsp;' . Yii::$app->formatter->asCurrency($model->params['sum'] - $model->params['fee'], $model->params['purse_currency']);
54
55
                    return $html;
56
                },
57
            ],
58
            'time' => [
59
                'value' => function ($model) {
60
                    return Yii::$app->formatter->asDatetime($model->time);
61
                },
62
            ],
63
            'actions' => [
64
                'class' => ActionColumn::class,
65
                'template' => '{view}',
66
                'header' => Yii::t('hipanel', 'Actions'),
67
            ],
68
        ]);
69
    }
70
}
71