lister les derniers changements

This commit is contained in:
Tykayn 2025-06-03 10:52:15 +02:00 committed by tykayn
parent 1ec88b47a1
commit 2965841e81
5 changed files with 81 additions and 50 deletions

View file

@ -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
]);
}
}

View file

@ -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 @@
<div id="mapDashboard"></div>
<input class="form-control" type="text" id="app_admin_labourer" value="75013">
<button class="btn btn-default" id="labourer" >Labourer</button>
<button class="btn btn-primary" id="labourer">Labourer les mises à jour</button>
<table class="table table-hover table-striped table-responsive">
<thead>
<tr>
<th>Zone</th>
<th>Nombre de commerces</th>
<th>Nombre de lieux</th>
<th>Complétude %</th>
<th>Actions</th>
</tr>
@ -173,54 +173,7 @@
</table>
<h2>{{ places|length }} Lieux</h2>
{#
<table class="table table-striped table-hover table-responsive">
<thead>
<tr>
<th>Nom</th>
<th>Tag</th>
<th>Email</th>
<th>Date de modification</th>
<th>Date de dernier contact</th>
<th>Date de dernière modification</th>
<th>Code postal</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for place in places %}
<tr>
<td>{% if place.name %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': place.name|url_encode, 'uuid': place.uuidForUrl}) }}">{{ place.name }}</a>
{% else %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': '?', 'uuid': place.uuidForUrl}) }}"><i class="bi bi-question-circle"></i></a>
{% endif %} </td>
<td>{{ place.mainTag }}</td>
<td>{{ place.email }}</td>
<td>{{ place.modifiedDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.lastContactAttemptDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.modifiedDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.zipCode }}</td>
<td>
<a href="https://www.openstreetmap.org/{{place.osmKind}}/{{ place.osmId }}" target="_blank"><i class="bi bi-globe"></i></a>
{% if place.name %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': place.name|url_encode, 'uuid': place.uuidForUrl}) }}"><i class="bi bi-pencil"></i></a>
{% else %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': '?', 'uuid': place.uuidForUrl}) }}"><i class="bi bi-pencil"></i></a>
{% endif %}
<a href="{{ path('app_admin_delete', {'id': place.id}) }}" onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce lieu ?')"><i class="bi bi-trash"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
#}
</div>
</div>
</div>

View file

@ -0,0 +1,55 @@
{% extends 'base.html.twig' %}
{% block title %}Dernières modifications{% endblock %}
{% block body %}
<h1>Dernières modifications</h1>
<table class="table table-striped table-hover table-responsive">
<thead>
<tr>
<th>Nom</th>
<th>Tag</th>
<th>Email</th>
<th>Date de modification</th>
<th>Date de dernier contact</th>
<th>Date de dernière modification</th>
<th>Code postal</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for place in places %}
<tr>
<td>{% if place.name %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': place.name|url_encode, 'uuid': place.uuidForUrl}) }}">{{ place.name }}</a>
{% else %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': '?', 'uuid': place.uuidForUrl}) }}"><i class="bi bi-question-circle"></i></a>
{% endif %} </td>
<td>{{ place.mainTag }}</td>
<td>{{ place.email }}</td>
<td>{{ place.modifiedDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.lastContactAttemptDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.modifiedDate | date('Y-m-d H:i:s') }}</td>
<td>{{ place.zipCode }}</td>
<td>
<a href="https://www.openstreetmap.org/{{place.osmKind}}/{{ place.osmId }}" target="_blank"><i class="bi bi-globe"></i></a>
{% if place.name %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': place.name|url_encode, 'uuid': place.uuidForUrl}) }}"><i class="bi bi-pencil"></i></a>
{% else %}
<a href="{{ path('app_public_edit', {'zipcode': place.zipCode, 'name': '?', 'uuid': place.uuidForUrl}) }}"><i class="bi bi-pencil"></i></a>
{% endif %}
<a href="{{ path('app_admin_delete', {'id': place.id}) }}" onclick="return confirm('Êtes-vous sûr de vouloir supprimer ce lieu ?')"><i class="bi bi-trash"></i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endblock %}

View file

@ -30,6 +30,11 @@
<i class="bi bi-file-earmark-text"></i>
{{ 'display.places_with_note'|trans }}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{{ path('app_public_latest_changes') }}">
<i class="bi bi-clock-fill"></i>
{{ 'display.latest_changes'|trans }}</a>
</li>
</ul>
</div>
</div>

View file

@ -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: