2021-09-06 11:17:25 +02:00
|
|
|
<?php
|
|
|
|
$variationIcon = '';
|
|
|
|
$variationClass = '';
|
|
|
|
if ($variation == 0) {
|
2021-10-18 14:56:51 +02:00
|
|
|
$variationIcon = $this->FontAwesome->getClass('minus');
|
2021-09-06 11:17:25 +02:00
|
|
|
} elseif ($variation > 0) {
|
2021-10-18 14:56:51 +02:00
|
|
|
$variationIcon = 'trends-arrow-up-white fs-6';
|
2021-09-18 10:22:59 +02:00
|
|
|
$variationClass = 'bg-success';
|
2021-09-06 11:17:25 +02:00
|
|
|
} else {
|
2021-10-18 14:56:51 +02:00
|
|
|
$variationIcon = 'trends-arrow-up-white fs-6 fa-rotate-180 fa-flip-vertical';
|
2021-09-18 10:22:59 +02:00
|
|
|
$variationClass = 'bg-danger';
|
2021-09-06 11:17:25 +02:00
|
|
|
}
|
|
|
|
|
2021-10-18 14:56:51 +02:00
|
|
|
$variationHtml = sprintf(
|
|
|
|
'<div class="badge %s fw-bold"><span class="%s me-2 align-middle"></span>%s</div>',
|
2021-09-06 11:17:25 +02:00
|
|
|
$variationClass,
|
2021-10-18 14:56:51 +02:00
|
|
|
$variationIcon,
|
2021-09-06 11:17:25 +02:00
|
|
|
!empty($variation) ? h($variation) : ''
|
|
|
|
);
|
|
|
|
|
2021-09-07 09:59:36 +02:00
|
|
|
$titleHtml = isset($title) ? h($title) : ($titleHtml ?? '');
|
2021-09-06 11:17:25 +02:00
|
|
|
$leftContent = sprintf('<div class="">%s</div><h2 class="my-2">%s</h2>%s',
|
2021-09-07 09:59:36 +02:00
|
|
|
$titleHtml,
|
2021-09-06 11:17:25 +02:00
|
|
|
h($number ?? ''),
|
|
|
|
$variationHtml
|
|
|
|
);
|
|
|
|
$rightContent = sprintf('<div class="">%s</div>', $this->element('charts/bar', [
|
2021-09-18 10:22:59 +02:00
|
|
|
'chartData' => $chartData,
|
|
|
|
'chartOptions' => [
|
|
|
|
|
|
|
|
]
|
2021-09-06 11:17:25 +02:00
|
|
|
]));
|
|
|
|
|
|
|
|
$cardContent = sprintf('<div class="highlight-panel-container d-flex align-items-center justify-content-between"><div class="number-container">%s</div><div class="chart-container w-50">%s</div></div>', $leftContent, $rightContent);
|
|
|
|
|
|
|
|
echo $this->Bootstrap->card([
|
|
|
|
'variant' => 'secondary',
|
|
|
|
'bodyHTML' => $cardContent,
|
2021-09-18 10:22:59 +02:00
|
|
|
'bodyClass' => 'p-3',
|
|
|
|
'class' => 'grow-on-hover shadow-sm'
|
2021-09-06 11:17:25 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
?>
|