mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
plusieurs courbes de progression
This commit is contained in:
parent
d9219db84f
commit
123bd8d4d1
2 changed files with 39 additions and 7 deletions
|
@ -386,11 +386,24 @@ final class AdminController extends AbstractController
|
|||
$statsHistory->setDate(new \DateTime())
|
||||
->setStats($stats);
|
||||
|
||||
// Compter les Places avec email et SIRET
|
||||
$placesWithEmail = 0;
|
||||
$placesWithSiret = 0;
|
||||
foreach ($stats->getPlaces() as $place) {
|
||||
if ($place->getEmail() && $place->getEmail() !== '') {
|
||||
$placesWithEmail++;
|
||||
}
|
||||
if ($place->getSiret() && $place->getSiret() !== '') {
|
||||
$placesWithSiret++;
|
||||
}
|
||||
}
|
||||
|
||||
$statsHistory->setPlacesCount($stats->getPlaces()->count())
|
||||
->setOpeningHoursCount($stats->getAvecHoraires())
|
||||
->setAddressCount($stats->getAvecAdresse())
|
||||
->setWebsiteCount($stats->getAvecSite())
|
||||
->setSiretCount($stats->getAvecSiret())
|
||||
->setSiretCount($placesWithSiret)
|
||||
->setEmailsCount($placesWithEmail)
|
||||
// ->setAccessibiliteCount($stats->getAvecAccessibilite())
|
||||
// ->setNoteCount($stats->getAvecNote())
|
||||
->setCompletionPercent($stats->getCompletionPercent())
|
||||
|
|
|
@ -13,19 +13,19 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
|
||||
// Préparer les données pour chaque aspect
|
||||
const labels = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
'{{ stat.date|date('d/m/Y') }}'{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
const completionData = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{{ stat.completionPercent }}{% if not loop.last %},{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
const openingHoursData = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{% if stat.placesCount > 0 %}
|
||||
{{ ((stat.openingHoursCount / stat.placesCount) * 100)|round(1) }}{% if not loop.last %},{% endif %}
|
||||
{% else %}
|
||||
|
@ -35,7 +35,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
];
|
||||
|
||||
const addressData = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{% if stat.placesCount > 0 %}
|
||||
{{ ((stat.addressCount / stat.placesCount) * 100)|round(1) }}{% if not loop.last %},{% endif %}
|
||||
{% else %}
|
||||
|
@ -45,7 +45,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
];
|
||||
|
||||
const websiteData = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{% if stat.placesCount > 0 %}
|
||||
{{ ((stat.websiteCount / stat.placesCount) * 100)|round(1) }}{% if not loop.last %},{% endif %}
|
||||
{% else %}
|
||||
|
@ -55,7 +55,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
];
|
||||
|
||||
const siretData = [
|
||||
{% for stat in statsHistory %}
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{% if stat.placesCount > 0 %}
|
||||
{{ ((stat.siretCount / stat.placesCount) * 100)|round(1) }}{% if not loop.last %},{% endif %}
|
||||
{% else %}
|
||||
|
@ -64,6 +64,16 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
{% endfor %}
|
||||
];
|
||||
|
||||
const emailData = [
|
||||
{% for stat in statsHistory|reverse %}
|
||||
{% if stat.placesCount > 0 %}
|
||||
{{ ((stat.emailsCount / stat.placesCount) * 100)|round(1) }}{% if not loop.last %},{% endif %}
|
||||
{% else %}
|
||||
0{% if not loop.last %},{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
];
|
||||
|
||||
new Chart(ctx, {
|
||||
type: 'line',
|
||||
data: {
|
||||
|
@ -113,6 +123,15 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
tension: 0.3,
|
||||
fill: false,
|
||||
borderWidth: 2
|
||||
},
|
||||
{
|
||||
label: 'Emails (%)',
|
||||
data: emailData,
|
||||
borderColor: 'rgb(199, 199, 199)',
|
||||
backgroundColor: 'rgba(199, 199, 199, 0.1)',
|
||||
tension: 0.3,
|
||||
fill: false,
|
||||
borderWidth: 2
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue