Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/components/bitrix/catalog.report.store_sale.chart/ |
Upload File : |
<?php use Bitrix\Catalog\Access\AccessController; use Bitrix\Catalog\Access\ActionDictionary; use Bitrix\Currency\CurrencyManager; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Catalog\Component\Report\StoreChart\StoreChart; use Bitrix\Catalog\Integration\Report\StoreStock\StoreStockSale; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) { die(); } if (!Loader::includeModule('catalog')) { echo Loc::getMessage('STORE_SALE_CHART_NO_LOADED_CATALOG'); die(); } class CatalogReportStoreSaleChartComponent extends StoreChart { protected function getChartId(): string { return 'store-sale-chart'; } protected function getInnerChartData(): array { return $this->arParams['RESULT']['data']['chart']; } protected function fetchAndBuildStoreColumnData(array $stores): array { return array_map(static function($store) { return [ 'sum_shipped' => $store['SUM_SHIPPED'], 'sum_arrived' => $store['SUM_ARRIVED'], 'sold_percent' => StoreStockSale::computeSoldPercent($store['SUM_SHIPPED'] ?? 0, $store['SUM_ARRIVED'] ?? 0), 'name' => $store['TITLE'], ]; }, $stores); } protected function buildLinkToSliderDetails(string $linkContent): string { return "<a class=\"stores-sale-chart-label-link\" onclick=\"BX.Catalog.Report.StoreSaleChartManager.Instance.openDetailSlider()\" > {$linkContent} </a>" ; } protected function initializeAdditionalData(): void { /** @var Bitrix\Report\VisualConstructor\Entity\Widget $widget */ $widget = $this->arParams['WIDGET']; $this->arResult['chartData']['widgetId'] = $widget->getGId(); $this->arResult['chartData']['boardId'] = $widget->getBoardId();; } }