From 2965841e81974651a64022a26b9c4d2450d10aa2 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Tue, 3 Jun 2025 10:52:15 +0200 Subject: [PATCH] lister les derniers changements --- src/Controller/PublicController.php | 17 +++++++ templates/public/dashboard.html.twig | 53 ++-------------------- templates/public/latest_changes.html.twig | 55 +++++++++++++++++++++++ templates/public/nav.html.twig | 5 +++ translations/messages.fr.yaml | 1 + 5 files changed, 81 insertions(+), 50 deletions(-) create mode 100644 templates/public/latest_changes.html.twig diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php index af39e86..0051637 100644 --- a/src/Controller/PublicController.php +++ b/src/Controller/PublicController.php @@ -424,4 +424,21 @@ class PublicController extends AbstractController 'places' => $places ]); } + + #[Route('/latest_changes', name: 'app_public_latest_changes')] + public function latestChanges(): Response + { + // Récupérer les commerces modifiés, triés par date de modification décroissante + $places = $this->entityManager->getRepository(Place::class) + ->createQueryBuilder('p') + ->where('p.modified_date IS NOT NULL') + ->orderBy('p.modified_date', 'DESC') + ->setMaxResults(20) + ->getQuery() + ->getResult(); + + return $this->render('public/latest_changes.html.twig', [ + 'places' => $places + ]); + } } \ No newline at end of file diff --git a/templates/public/dashboard.html.twig b/templates/public/dashboard.html.twig index b955589..8ccbb1b 100644 --- a/templates/public/dashboard.html.twig +++ b/templates/public/dashboard.html.twig @@ -1,6 +1,6 @@ {% extends 'base.html.twig' %} -{% block title %}Hello PublicController!{% endblock %} +{% block title %}Tableau de bord{% endblock %} {% block stylesheets %} {{ parent() }} @@ -142,14 +142,14 @@
- + - + @@ -173,54 +173,7 @@
ZoneNombre de commercesNombre de lieux Complétude % Actions

{{ places|length }} Lieux

- {# - - - - - - - - - - - - - - - - - {% for place in places %} - - - - - - - - - - - - {% endfor %} - -
NomTagEmailDate de modificationDate de dernier contactDate de dernière modificationCode postalActions
{% if place.name %} - {{ place.name }} - {% else %} - - {% endif %} {{ place.mainTag }}{{ place.email }}{{ place.modifiedDate | date('Y-m-d H:i:s') }}{{ place.lastContactAttemptDate | date('Y-m-d H:i:s') }}{{ place.modifiedDate | date('Y-m-d H:i:s') }}{{ place.zipCode }} - - - {% if place.name %} - - {% else %} - - {% endif %} - - -
- #} diff --git a/templates/public/latest_changes.html.twig b/templates/public/latest_changes.html.twig new file mode 100644 index 0000000..aea736f --- /dev/null +++ b/templates/public/latest_changes.html.twig @@ -0,0 +1,55 @@ +{% extends 'base.html.twig' %} + +{% block title %}Dernières modifications{% endblock %} + +{% block body %} +

Dernières modifications

+ + + + + + + + + + + + + + + + + + {% for place in places %} + + + + + + + + + + + + {% endfor %} + +
NomTagEmailDate de modificationDate de dernier contactDate de dernière modificationCode postalActions
{% if place.name %} + {{ place.name }} + {% else %} + + {% endif %} {{ place.mainTag }}{{ place.email }}{{ place.modifiedDate | date('Y-m-d H:i:s') }}{{ place.lastContactAttemptDate | date('Y-m-d H:i:s') }}{{ place.modifiedDate | date('Y-m-d H:i:s') }}{{ place.zipCode }} + + + {% if place.name %} + + {% else %} + + {% endif %} + + +
+ +{% endblock %} + diff --git a/templates/public/nav.html.twig b/templates/public/nav.html.twig index 5b9d233..f1992c0 100644 --- a/templates/public/nav.html.twig +++ b/templates/public/nav.html.twig @@ -30,6 +30,11 @@ {{ 'display.places_with_note'|trans }} + diff --git a/translations/messages.fr.yaml b/translations/messages.fr.yaml index 8a766da..44334b7 100644 --- a/translations/messages.fr.yaml +++ b/translations/messages.fr.yaml @@ -28,6 +28,7 @@ display: closed_commerces: "Commerces fermés" places_with_note: "Lieux avec une note" view_stats: "Statistiques de la zone" + latest_changes: "Dernières modifications" help: cuisine: "Sélectionnez les types de cuisine que vous proposez" values: