Completed
Push — master ( c65426...810841 )
by Dmitry
13:57
created

CreateReferralPricesButton::run()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 9.552
c 0
b 0
f 0
cc 2
nc 1
nop 0
1
<?php
2
3
namespace hipanel\modules\finance\widgets;
4
5
use Yii;
6
use yii\bootstrap\Dropdown;
7
use yii\bootstrap\Html;
8
9
class CreateReferralPricesButton extends CreatePricesButton
10
{
11
    public function run()
12
    {
13
        return Html::tag('div', Html::a(Yii::t('hipanel.finance.price', 'Create prices') .
14
                '&nbsp;&nbsp;' .
15
                Html::tag('span', null, ['class' => 'caret']), '#', [
16
                'data-toggle' => 'dropdown', 'class' => 'dropdown-toggle btn btn-success btn-sm',
17
            ]) . Dropdown::widget([
18
                'options' => ['class' => 'pull-right'],
19
                'items' => array_filter([
20
                    $this->model->supportsSharedPrices() ? [
21
                        'encode' => false,
22
                        'url' => '#',
23
                        'label' => Yii::t('hipanel.finance.price', 'Create shared prices'),
24
                        'linkOptions' => [
25
                            'data' => [
26
                                'toggle' => 'modal',
27
                                'target' => '#create-shared-prices-modal',
28
                            ],
29
                        ],
30
                    ] : null,
31
                ]),
32
            ]), ['class' => 'dropdown']);
33
    }
34
}
35