1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Finance module for HiPanel |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-finance |
6
|
|
|
* @package hipanel-module-finance |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\finance\menus; |
12
|
|
|
|
13
|
|
|
use hipanel\widgets\AjaxModalWithTemplatedButton; |
14
|
|
|
use hiqdev\yii2\menus\Menu; |
15
|
|
|
use yii\bootstrap\Modal; |
16
|
|
|
use yii\helpers\Html; |
17
|
|
|
|
18
|
|
|
use Yii; |
19
|
|
|
|
20
|
|
|
class RequisiteActionsMenu extends Menu |
21
|
|
|
{ |
22
|
|
|
public $model; |
23
|
|
|
|
24
|
|
|
public function items() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
|
|
'view' => [ |
28
|
|
|
'label' => Yii::t('hipanel', 'View'), |
29
|
|
|
'icon' => 'fa-info', |
30
|
|
|
'url' => ['@requisite/view', 'id' => $this->model->id], |
31
|
|
|
'encode' => false, |
32
|
|
|
], |
33
|
|
|
'edit' => [ |
34
|
|
|
'label' => Yii::t('hipanel', 'Edit'), |
35
|
|
|
'icon' => 'fa-pencil', |
36
|
|
|
'url' => ['@contact/update', 'id' => $this->model->id], |
37
|
|
|
'encode' => false, |
38
|
|
|
], |
39
|
|
|
[ |
40
|
|
|
'label' => AjaxModalWithTemplatedButton::widget([ |
41
|
|
|
'ajaxModalOptions' => [ |
42
|
|
|
'id' => 'reserve-number-modal-' . $this->model->id, |
43
|
|
|
'bulkPage' => false, |
44
|
|
|
'header' => Html::tag('h4', $item['label'], ['class' => 'modal-title']), |
|
|
|
|
45
|
|
|
'scenario' => 'default', |
46
|
|
|
'actionUrl' => ['reserve-number', 'id' => $this->model->id], |
47
|
|
|
'size' => Modal::SIZE_LARGE, |
48
|
|
|
'handleSubmit' => ['reserve-number', 'id' => $this->model->id], |
49
|
|
|
'toggleButton' => [ |
50
|
|
|
'tag' => 'a', |
51
|
|
|
'label' => Html::tag('i', null, ['class' => 'fa fa-ticket']) . " " . Yii::t('hipanel:finance', 'Reserve number'), |
52
|
|
|
'style' => 'cursor: pointer;', |
53
|
|
|
], |
54
|
|
|
], |
55
|
|
|
'toggleButtonTemplate' => '{toggleButton}', |
56
|
|
|
]), |
57
|
|
|
'encode' => false, |
58
|
|
|
'visible' => Yii::$app->user->can('requisites.update') && $this->model->isRequisite(), |
59
|
|
|
], |
60
|
|
|
]; |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.