chg: [home] Added link to index for each panels

pull/72/head
mokaddem 2021-09-07 09:59:36 +02:00
parent 8548332762
commit 3f4e2ae4b8
5 changed files with 57 additions and 47 deletions

View File

@ -13,7 +13,7 @@ $routes->plugin(
['controller' => 'Tags']
);
// $routes->get('/', ['controller' => 'Tags']);
$routes->get('/', ['controller' => 'Tags', 'action' => 'index']);
// $routes->get('/{id}', ['controller' => 'Tags', 'action' => 'view']);
// $routes->put('/{id}', ['controller' => 'Tags', 'action' => 'edit']);
}

View File

@ -1,17 +1,25 @@
<?php
// $Parsedown = new Parsedown();
// echo $Parsedown->text($md);
?>
<h2><?= __('Home') ?></h2>
<div class="row">
<?php foreach ($statistics as $modelName => $statistics): ?>
<div class="col-sm-6 col-md-4 col-l-3 col-xl-2 mb-2">
<?php
$modelName = explode('.', $modelName);
$modelName = $modelName[count($modelName)-1];
$exploded = explode('.', $modelName);
$modelForDisplay = $exploded[count($exploded)-1];
$panelTitle = $this->Html->link(
h($modelForDisplay),
$this->Url->build([
'controller' => $modelForDisplay,
'action' => 'index',
]),
['class' => 'text-white']
);
echo $this->element('widgets/highlight-panel', [
'title' => $modelName,
'titleHtml' => $panelTitle,
'number' => $statistics['amount'],
'variation' => $statistics['variation'] ?? '',
'chartData' => $statistics['timeline'] ?? []

View File

@ -14,51 +14,48 @@ foreach ($chartData as $i => $entry) {
<div id="<?= $chartId ?>"></div>
<script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
<script>
(function() {
const passedOptions = <?= json_encode($chartOptions) ?>;
const defaultOptions = {
chart: {
id: '<?= $chartId ?>',
type: 'bar',
sparkline: {
enabled: true
$(document).ready(function() {
const passedOptions = <?= json_encode($chartOptions) ?>;
const defaultOptions = {
chart: {
id: '<?= $chartId ?>',
type: 'bar',
sparkline: {
enabled: true
},
dropShadow: {
enabled: true,
top: 1,
left: 1,
blur: 2,
opacity: 0.2,
},
animations: {
enabled: false
},
},
dropShadow: {
enabled: true,
top: 1,
left: 1,
blur: 2,
opacity: 0.2,
},
animations: {
enabled: false
},
},
series: [{
data: <?= json_encode($data) ?>,
}],
colors: ['var(--success)'],
tooltip: {
x: {
show: false
},
y: {
title: {
formatter: function formatter(val) {
return '';
series: [{
data: <?= json_encode($data) ?>,
}],
colors: ['var(--success)'],
tooltip: {
x: {
show: false
},
y: {
title: {
formatter: function formatter(val) {
return '';
}
}
}
},
theme: '<?= !empty($darkMode) ? 'dark' : 'light' ?>'
},
theme: '<?= !empty($darkMode) ? 'dark' : 'light' ?>'
},
}
const chartOptions = Object.assign({}, defaultOptions, passedOptions)
new ApexCharts(document.querySelector('#<?= $chartId ?>'), chartOptions).render();
})()
}
const chartOptions = Object.assign({}, defaultOptions, passedOptions)
new ApexCharts(document.querySelector('#<?= $chartId ?>'), chartOptions).render();
})
</script>
<style>

View File

@ -17,8 +17,9 @@ $variationHtml = sprintf('<div class="%s"><span class="%s mr-2"></span>%s</div>'
!empty($variation) ? h($variation) : ''
);
$titleHtml = isset($title) ? h($title) : ($titleHtml ?? '');
$leftContent = sprintf('<div class="">%s</div><h2 class="my-2">%s</h2>%s',
h($title ?? ''),
$titleHtml,
h($number ?? ''),
$variationHtml
);

View File

@ -1,3 +1,7 @@
:root {
--cerebrate: #924da6;
}
.pagination li.page-item > a.page-link > .ellipsis {
line-height: 12px;
vertical-align: top;