This commit is contained in:
Dennis Eichhorn 2023-05-30 13:58:54 +00:00
commit bd309abee2
2 changed files with 7 additions and 7 deletions

View File

@ -44,14 +44,14 @@ final class BackendController extends Controller
*/ */
public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
{ {
$head = $response->get('Content')->getData('head'); $head = $response->get('Content')->head;
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css'); $head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js'); $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']); $head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Sales/Theme/Backend/sales-analysis-dashboard'); $view->setTemplate('/Modules/Sales/Theme/Backend/sales-analysis-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response)); $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response);
///// /////
$monthlySalesCustomer = []; $monthlySalesCustomer = [];
@ -64,7 +64,7 @@ final class BackendController extends Controller
]; ];
} }
$view->addData('monthlySalesCustomer', $monthlySalesCustomer); $view->data['monthlySalesCustomer'] = $monthlySalesCustomer;
$annualSalesCustomer = []; $annualSalesCustomer = [];
for ($i = 1; $i < 11; ++$i) { for ($i = 1; $i < 11; ++$i) {
@ -75,7 +75,7 @@ final class BackendController extends Controller
]; ];
} }
$view->addData('annualSalesCustomer', $annualSalesCustomer); $view->data['annualSalesCustomer'] = $annualSalesCustomer;
return $view; return $view;
} }

View File

@ -18,7 +18,7 @@ use phpOMS\Localization\Money;
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
*/ */
echo $this->getData('nav')->render(); echo $this->data['nav']->render();
?> ?>
<div class="row"> <div class="row">
@ -119,7 +119,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Monthly Sales / Profit - Monthly
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?> <?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div> </div>
<?php $salesCustomer = $this->getData('monthlySalesCustomer'); ?> <?php $salesCustomer = $this->data['monthlySalesCustomer']; ?>
<div class="portlet-body"> <div class="portlet-body">
<canvas id="sales-region" data-chart='{ <canvas id="sales-region" data-chart='{
"type": "bar", "type": "bar",
@ -243,7 +243,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Annual Sales / Profit - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?> <?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div> </div>
<?php $salesCustomer = $this->getData('annualSalesCustomer'); ?> <?php $salesCustomer = $this->data['annualSalesCustomer']; ?>
<div class="portlet-body"> <div class="portlet-body">
<canvas id="sales-customer-annual" data-chart='{ <canvas id="sales-customer-annual" data-chart='{
"type": "bar", "type": "bar",