style dashboard, remove bike parking in places selection

This commit is contained in:
Tykayn 2025-06-05 15:43:11 +02:00 committed by tykayn
parent 5a05cd22d1
commit 4c1a7729a1
5 changed files with 59 additions and 15 deletions

View file

@ -638,8 +638,11 @@ document.addEventListener('DOMContentLoaded', () => {
// Afficher l'indicateur de chargement // Afficher l'indicateur de chargement
document.querySelector('#loading_search_insee').classList.remove('d-none'); document.querySelector('#loading_search_insee').classList.remove('d-none');
const response = await fetch(`https://geo.api.gouv.fr/communes?nom=${query}&fields=nom,code,codesPostaux&limit=10`); const response = await fetch(`https://geo.api.gouv.fr/communes?nom=${query}&fields=nom,code,codesPostaux&limit=10`);
const data = await response.json(); const data = await response.json();
document.querySelector('#loading_search_insee').classList.add('d-none');
return data.map(commune => ({ return data.map(commune => ({
label: `${commune.nom} (code insee ${commune.code})`, label: `${commune.nom} (code insee ${commune.code})`,
insee: commune.code, insee: commune.code,

View file

@ -58,8 +58,13 @@ table.js-sort-table th:active {
.maplibregl-popup-content { .maplibregl-popup-content {
overflow: auto; overflow: auto;
min-width: 300px; min-width: 300px;
max-height: 400px; max-height: 11rem !important;
}
.maplibregl-popup-content table {
width: 100%;
max-height: 300px;
overflow: auto;
} }
.maplibregl-popup-content h1, .maplibregl-popup-content h1,

View file

@ -331,6 +331,7 @@ class PublicController extends AbstractController
$place->update_place_from_overpass_data($commerce); $place->update_place_from_overpass_data($commerce);
$this->entityManager->persist($place); $this->entityManager->persist($place);
$this->entityManager->flush(); $this->entityManager->flush();
$this->entityManager->clear();
$stats = $place->getStats(); $stats = $place->getStats();
@ -350,6 +351,7 @@ class PublicController extends AbstractController
$this->entityManager->persist($stats); $this->entityManager->persist($stats);
$this->entityManager->persist($place); $this->entityManager->persist($place);
$this->entityManager->flush(); $this->entityManager->flush();
$this->entityManager->clear();
return $this->render('public/view.html.twig', [ return $this->render('public/view.html.twig', [
'controller_name' => 'PublicController', 'controller_name' => 'PublicController',

View file

@ -163,21 +163,31 @@ out center tags;';
$places = []; $places = [];
if (isset($data['elements'])) { if (isset($data['elements'])) {
foreach ($data['elements'] as $element) { $batchSize = 100; // Traiter par lots de 100 éléments
if (isset($element['tags'])) { $totalElements = count($data['elements']);
$email = ""; for ($i = 0; $i < $totalElements; $i += $batchSize) {
$batch = array_slice($data['elements'], $i, $batchSize);
$places[] = [
'id' => $element['id'], foreach ($batch as $element) {
'type' => $element['type'], if (isset($element['tags'])) {
'name' => $element['tags']['name'] ?? '', $email = "";
'email' => $email,
'lat' => $element['lat'] ?? null, $places[] = [
'lon' => $element['lon'] ?? null, 'id' => $element['id'],
'tags' => $element['tags'] 'type' => $element['type'],
]; 'name' => $element['tags']['name'] ?? '',
'email' => $email,
'lat' => $element['lat'] ?? null,
'lon' => $element['lon'] ?? null,
'tags' => $element['tags']
];
}
} }
// Libérer la mémoire après chaque lot
unset($batch);
gc_collect_cycles();
} }
} }

View file

@ -217,6 +217,30 @@ out skel qt;`;
</tbody> </tbody>
</table> </table>
{% if totalPages > 1 %}
<nav aria-label="Page navigation">
<ul class="pagination justify-content-center">
{% if currentPage > 1 %}
<li class="page-item">
<a class="page-link" href="{{ path('app_public_dashboard', {'page': currentPage - 1}) }}">Précédent</a>
</li>
{% endif %}
{% for i in 1..totalPages %}
<li class="page-item {% if i == currentPage %}active{% endif %}">
<a class="page-link" href="{{ path('app_public_dashboard', {'page': i}) }}">{{ i }}</a>
</li>
{% endfor %}
{% if currentPage < totalPages %}
<li class="page-item">
<a class="page-link" href="{{ path('app_public_dashboard', {'page': currentPage + 1}) }}">Suivant</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
<h2>{{ places_count }} Lieux</h2> <h2>{{ places_count }} Lieux</h2>
<h2><button class="btn btn-primary" id="labourer">Labourer les mises à jour</button></h2> <h2><button class="btn btn-primary" id="labourer">Labourer les mises à jour</button></h2>
<label for="app_admin_labourer">Rechercher une ville par son nom <label for="app_admin_labourer">Rechercher une ville par son nom