Completed
Push — master ( c2bc12...ef5bc2 )
by Dmitry
04:55
created

src/views/bill/index.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
use hipanel\modules\finance\grid\BillGridView;
4
use hipanel\modules\finance\widgets\ExchangeRatesLine;
5
use hipanel\widgets\IndexPage;
6
use hipanel\widgets\Pjax;
7
use yii\helpers\Html;
8
9
/**
10
 * @var \yii\web\View $this
11
 * @var array $billTypes
12
 * @var array $billGroupLabels
13
 * @var \hiqdev\hiart\ActiveDataProvider $dataProvider
14
 * @var \hiqdev\hiart\ActiveRecord $model
15
 * @var \hipanel\modules\finance\models\ExchangeRate[] $rates
16
 */
17
$this->title = Yii::t('hipanel:finance', 'Bills');
18
$this->params['breadcrumbs'][] = $this->title;
19
$subtitle = array_filter(Yii::$app->request->get($model->formName(), [])) ? Yii::t('hipanel', 'filtered list') : Yii::t('hipanel', 'full list');
20
$this->params['subtitle'] = $subtitle . ' ' . ExchangeRatesLine::widget(['rates' => $rates]);
21
22
?>
23
24
<?php Pjax::begin(array_merge(Yii::$app->params['pjax'], ['enablePushState' => true])) ?>
25
    <?php $page = IndexPage::begin(compact('model', 'dataProvider')) ?>
26
27
        <?php $page->setSearchFormData(compact('billTypes', 'billGroupLabels')) ?>
28
29
        <?php $page->beginContent('main-actions') ?>
30
            <?php if (Yii::$app->user->can('deposit')) : ?>
31
                <?= Html::a(Yii::t('hipanel:finance', 'Recharge account'), ['@pay/deposit'], ['class' => 'btn btn-sm btn-success']) ?>
32
            <?php endif ?>
33
            <?php if (Yii::$app->user->can('bill.create')) : ?>
34
                <?= Html::a(Yii::t('hipanel:finance', 'Add payment'), ['@bill/create'], ['class' => 'btn btn-sm btn-success']) ?>
35
                <?= Html::a(Yii::t('hipanel:finance', 'Currency exchange'), ['@bill/create-exchange'], ['class' => 'btn btn-sm btn-default']) ?>
36
                <?= Html::a(Yii::t('hipanel:finance', 'Import payments'), ['@bill/import'], ['class' => 'btn btn-sm btn-default']) ?>
37
            <?php endif ?>
38
        <?php $page->endContent() ?>
39
40
        <?php $page->beginContent('sorter-actions') ?>
41
            <?= $page->renderSorter([
42
                'attributes' => array_filter([
43
                    'sum', 'balance',
44
                    'type', 'descr',
45
                     Yii::$app->user->can('resell') ? 'client' : null,
46
                     Yii::$app->user->can('support') ? 'seller' : null
47
                ]),
48
            ]) ?>
49
        <?php $page->endContent() ?>
50
51
        <?php $page->beginContent('bulk-actions') ?>
52
            <?php if (Yii::$app->user->can('bill.create')) : ?>
53
                <?= $page->renderBulkButton('copy', Yii::t('hipanel', 'Copy')) ?>
54
            <?php endif ?>
55
            <?php if (Yii::$app->user->can('bill.update')) : ?>
56
                <?= $page->renderBulkButton('@bill/update', Yii::t('hipanel', 'Update')) ?>
57
            <?php endif ?>
58
            <?php if (Yii::$app->user->can('bill.delete')) : ?>
59
                <?= $page->renderBulkDeleteButton('delete') ?>
60
            <?php endif ?>
61
        <?php $page->endContent() ?>
62
63
        <?php $page->beginContent('table') ?>
64
        <?php $page->beginBulkForm() ?>
65
            <?= BillGridView::widget([
66
                'boxed' => false,
67
                'dataProvider' => $dataProvider,
68
                'filterModel'  => $model,
69
                'currencies' => $this->context->getCurrencyTypes(),
70
                'columns' => $representationCollection->getByName($uiModel->representation)->getColumns(),
71
            ]) ?>
72
        <?php $page->endBulkForm() ?>
73
        <?php $page->endContent() ?>
74
    <?php $page->end() ?>
75
<?php Pjax::end() ?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
76