1 | <?php |
||
19 | class ValueColumn extends Column |
||
20 | { |
||
21 | public $attribute = 'value'; |
||
22 | |||
23 | /** |
||
24 | * @var integer |
||
25 | */ |
||
26 | private $planId; |
||
27 | |||
28 | public function init() |
||
35 | |||
36 | protected function renderDataCellContent($model, $key, $index) |
||
46 | |||
47 | private function registerClientScript() |
||
48 | { |
||
49 | $calculateValueUrl = Url::toRoute(['@plan/calculate-values', 'planId' => $this->planId]); |
||
50 | $view = Yii::$app->view; |
||
51 | $view->registerAssetBundle(PriceEstimator::class); |
||
52 | $view->registerJs(/** @lang ECMAScript 6 */ |
||
53 | " |
||
54 | ;(function ($, window, document, undefined) { |
||
55 | let Estimator = $('#bulk-plan').priceEstimator({ |
||
56 | url: '${calculateValueUrl}', |
||
57 | estimatePlan: true, |
||
58 | rowSelector: '.price-item', |
||
59 | totalCellSelector: '#plan-monthly-value', |
||
60 | totalPerObjectSelector: '.total-per-object', |
||
61 | }); |
||
62 | Estimator.update(); |
||
63 | })(jQuery, window, document); |
||
64 | "); |
||
65 | } |
||
66 | |||
67 | private function findPlanId() |
||
71 | } |
||
72 |