1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use hipanel\modules\finance\grid\SalesInPlanGridView; |
4
|
|
|
use hipanel\modules\finance\models\Price; |
5
|
|
|
use hipanel\modules\finance\models\Sale; |
6
|
|
|
use hipanel\modules\finance\widgets\CreatePricesButton; |
7
|
|
|
use hipanel\widgets\IndexPage; |
8
|
|
|
use yii\data\ArrayDataProvider; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @var \yii\web\View $this |
12
|
|
|
* @var \hipanel\modules\finance\models\Plan $model |
13
|
|
|
* @var IndexPage $page |
14
|
|
|
* @var \hipanel\modules\finance\helpers\PlanInternalsGrouper $grouper |
15
|
|
|
* @var Sale[] $salesByObject |
16
|
|
|
* @var Price[][] $pricesByMainObject |
17
|
|
|
*/ |
18
|
|
|
[$salesByObject, $pricesByMainObject] = $grouper->group(); |
19
|
|
|
|
20
|
|
|
?> |
21
|
|
|
|
22
|
|
|
<?php if (!$model->your_tariff) : ?> |
23
|
|
|
<?php $page->beginContent('bulk-actions') ?> |
24
|
|
|
<?php if (Yii::$app->user->can('price.update')) : ?> |
25
|
|
|
<?= $page->renderBulkButton('@price/update', Yii::t('hipanel', 'Update'), ['color' => 'warning']) ?> |
26
|
|
|
<?php endif ?> |
27
|
|
|
<?php if (Yii::$app->user->can('price.delete')) : ?> |
28
|
|
|
<?= $page->renderBulkDeleteButton('@price/delete') ?> |
29
|
|
|
<?php endif ?> |
30
|
|
|
<?php $page->endContent() ?> |
31
|
|
|
|
32
|
|
|
<?php $page->beginContent('main-actions') ?> |
33
|
|
|
<?php if (Yii::$app->user->can('plan.create')) : ?> |
34
|
|
|
<?= CreatePricesButton::widget(compact('model')) ?> |
35
|
|
|
<?php endif ?> |
36
|
|
|
<?php $page->endContent() ?> |
37
|
|
|
<?php endif ?> |
38
|
|
|
|
39
|
|
|
<?php $page->beginContent('table') ?> |
40
|
|
|
<?php $page->beginBulkForm() ?> |
41
|
|
|
<?= SalesInPlanGridView::widget([ |
42
|
|
|
'boxed' => false, |
43
|
|
|
'showHeader' => false, |
44
|
|
|
'pricesBySoldObject' => $pricesByMainObject, |
45
|
|
|
'dataProvider' => new ArrayDataProvider([ |
46
|
|
|
'allModels' => $salesByObject, |
47
|
|
|
'pagination' => false, |
48
|
|
|
]), |
49
|
|
|
'summaryRenderer' => function () { |
50
|
|
|
return ''; // remove unnecessary summary |
51
|
|
|
}, |
52
|
|
|
'columns' => [ |
53
|
|
|
'object_link', |
54
|
|
|
'object_label', |
55
|
|
|
'seller', |
56
|
|
|
'buyer', |
57
|
|
|
'time', |
58
|
|
|
'price_related_actions', |
59
|
|
|
'estimate_placeholder', |
60
|
|
|
], |
61
|
|
|
]) ?> |
62
|
|
|
<?php $page->endBulkForm() ?> |
63
|
|
|
<?php $page->endContent() ?> |
|
|
|
|
64
|
|
|
|
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.