performance on dashboard, larger map

This commit is contained in:
Tykayn 2025-06-04 01:03:07 +02:00 committed by tykayn
parent deeaf2b71e
commit 9a097d2375
4 changed files with 57 additions and 39 deletions

View file

@ -266,7 +266,7 @@ out skel qt;`;
</tbody>
</table>
<h2>{{ places|length }} Lieux</h2>
<h2>{{ places_count }} Lieux</h2>
<h2><button class="btn btn-primary" id="labourer">Labourer les mises à jour</button></h2>
<label for="app_admin_labourer">Rechercher une ville </label>
<input class="form-control" type="text" id="app_admin_labourer" value="75013">

View file

@ -174,42 +174,7 @@
{{ parent() }}
<script src={{asset('js/mapbox/mapbox-gl.js')}}></script>
<script>
function check_validity(e) {
let errors = [];
document.querySelectorAll('.is-invalid').forEach(input => {
input.classList.remove('is-invalid');
});
const nameInput = document.querySelector('input[name="commerce_tag_value__name"]');
if (!nameInput.value.trim()) {
errors.push("Le nom de l'établissement est obligatoire");
nameInput.classList.add('is-invalid');
}
const emailInput = document.querySelector('input[name="commerce_tag_value__contact:email"]');
if (emailInput && emailInput.value) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(emailInput.value)) {
errors.push("L'adresse email n'est pas valide");
emailInput.classList.add('is-invalid');
}
}
const phoneInput = document.querySelector('input[name="commerce_tag_value__contact:phone"]');
if (phoneInput && phoneInput.value) {
const phoneRegex = /^(\+33|0)[1-9](\d{2}){4}$/;
if (!phoneRegex.test(phoneInput.value.replace(/\s/g, ''))) {
errors.push("Le numéro de téléphone n'est pas valide");
phoneInput.classList.add('is-invalid');
}
}
if (errors.length > 0) {
e.preventDefault();
document.querySelector('#validation_messages').innerHTML = errors.join('<br>');
document.querySelector('#validation_messages').classList.add('is-invalid');
}
}
{% if commerce is not empty and mapbox_token is not empty and maptiler_token is not empty and commerce_overpass['@attributes'].lon is defined and commerce_overpass['@attributes'].lat is defined %}
mapboxgl.accessToken = '{{ mapbox_token }}';