Completed
Push — master ( 0b0563...9c007b )
by Andrii
11:20
created

SidebarFinanceMenu::items()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 34
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 34
rs 8.8571
cc 3
eloc 23
nc 2
nop 0
1
<?php
2
3
/*
4
 * Finance module for HiPanel
5
 *
6
 * @link      https://github.com/hiqdev/hipanel-module-finance
7
 * @package   hipanel-module-finance
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hipanel\modules\finance\menus;
13
14
use Yii;
15
16
class SidebarFinanceMenu extends \hiqdev\menumanager\Menu
17
{
18
    public function items()
19
    {
20
        if (Yii::$app->user->can('support') && !Yii::$app->user->can('manage')) {
21
            return [];
22
        }
23
24
        return [
25
            'finance' => [
26
                'label' => Yii::t('hipanel/finance', 'Finance'),
27
                'url'   => ['/finance/bill/index'],
28
                'icon'  => 'fa-dollar',
29
                'items' => [
30
                    'payments' => [
31
                        'label' => Yii::t('hipanel/finance', 'Payments'),
32
                        'url'   => ['/finance/bill/index'],
33
                    ],
34
                    'deposit' => [
35
                        'label' => Yii::t('hipanel/finance', 'Recharge account'),
36
                        'url'   => ['/merchant/pay/deposit'],
37
                    ],
38
                    'tariffs' => [
39
                        'label'   => Yii::t('hipanel/finance', 'Tariffs'),
40
                        'url'     => ['/finance/tariff/index'],
41
                        'visible' => Yii::$app->user->can('support'),
42
                    ],
43
                    'holds' => [
44
                        'label'   => Yii::t('hipanel/finance', 'Held payments'),
45
                        'url'     => ['/finance/held-payments/index'],
46
                        'visible' => Yii::$app->user->can('resell'),
47
                    ],
48
                ],
49
            ],
50
        ];
51
    }
52
}
53