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 | View Code Duplication | <?php if (Yii::$app->user->can('deposit')) : ?> |
|
0 ignored issues
–
show
|
|||
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() ?> |
||
76 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.