From 5441abd405594a486073fe258d8f2e7b0e8a8d15 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 18 Jun 2025 00:41:24 +0200 Subject: [PATCH 1/3] refacto labourage form --- assets/utils.js | 285 +++++++++++++++ public/js/app.js | 0 public/js/utils.js | 166 --------- src/Controller/AdminController.php | 3 +- src/Entity/Stats.php | 81 +++++ templates/admin/stats.html.twig | 381 ++++++++++++--------- templates/admin/stats/row.html.twig | 3 + templates/admin/stats/table-head.html.twig | 4 + templates/public/dashboard.html.twig | 107 ++---- templates/public/edit.html.twig | 1 + templates/public/home.html.twig | 38 +- templates/public/labourage-form.html.twig | 29 ++ 12 files changed, 674 insertions(+), 424 deletions(-) delete mode 100644 public/js/app.js delete mode 100644 public/js/utils.js create mode 100644 templates/public/labourage-form.html.twig diff --git a/assets/utils.js b/assets/utils.js index 8b692b7..140e648 100644 --- a/assets/utils.js +++ b/assets/utils.js @@ -179,6 +179,291 @@ function openInPanoramax() { window.open(panoramaxUrl); } + +function enableLabourageForm() { + + // Récupérer les éléments du formulaire + const citySearchInput = document.getElementById('citySearch'); + const citySuggestionsList = document.getElementById('citySuggestions'); + + if (citySearchInput && citySuggestionsList) { + // Configurer la recherche de ville avec la fonction existante + setupCitySearch('citySearch', 'citySuggestions', function (result_search) { + console.log('code_insee', result_search.insee); + // Activer le spinner dans le bouton de labourage + const labourageBtn = document.querySelector('.btn-labourer'); + if (labourageBtn) { + labourageBtn.innerHTML = ' Chargement...'; + labourageBtn.disabled = true; + } + console.log('result_search', result_search, getLabourerUrl(result_search)); + window.location.href = getLabourerUrl(result_search); + }); + } +} +// Fonction pour gérer la recherche de villes +/** + * Configure la recherche de ville avec autocomplétion + * @param {string} inputId - ID de l'input de recherche + * @param {string} suggestionListId - ID de la liste des suggestions + * @param {Function} onSelect - Callback appelé lors de la sélection d'une ville + */ +function setupCitySearch(inputId, suggestionListId, onSelect) { + const searchInput = document.getElementById(inputId); + const suggestionList = document.getElementById(suggestionListId); + + window.searchInput = searchInput; + window.suggestionList = suggestionList; + window.onSelect = onSelect; + + if (!searchInput || !suggestionList) return; + + let timeoutId = null; + + let searchOngoing = false; + searchInput.addEventListener('input', function () { + console.log('input', this.value); + clearTimeout(timeoutId); + const query = this.value.trim(); + + + timeoutId = setTimeout(() => { + if (!searchOngoing) { + searchOngoing = true; + performSearch(query); + searchOngoing = false; + } + }, 300); + }); + +} + + +function performSearch(query) { + console.log('performSearch', query); + fetch(`https://geo.api.gouv.fr/communes?nom=${encodeURIComponent(query)}&fields=nom,code,codesPostaux&limit=5`) + .then(response => response.json()) + .then(data => { + const citySuggestions = data.map(city => ({ + name: city.nom, + postcode: city.codesPostaux[0], + insee: city.code + })); + displaySuggestions(citySuggestions); + }) + .catch(error => { + console.error('Erreur lors de la recherche:', error); + clearSuggestions(); + }); +} + +function displaySuggestions(suggestions) { + console.log('displaySuggestions', suggestions); + clearSuggestions(); + suggestions.forEach(suggestion => { + const li = document.createElement('li'); + li.className = 'list-group-item p-2'; + li.textContent = `${suggestion.name} (${suggestion.postcode})`; + li.addEventListener('click', () => { + searchInput.value = suggestion.name; + clearSuggestions(); + if (onSelect) onSelect(suggestion); + }); + window.suggestionList.appendChild(li); + }); + + window.suggestionList.classList.remove('d-none'); + console.log('window.suggestionList', window.suggestionList); +} + +function clearSuggestions() { + window.suggestionList.innerHTML = ''; +} + +// Fermer les suggestions en cliquant en dehors +document.addEventListener('click', function (e) { + if (window.searchInput && !window.searchInput?.contains(e.target) && !window.suggestionList?.contains(e.target)) { + clearSuggestions(); + } +}); + +// Fonction pour formater l'URL de labourage +/** + * Génère l'URL de labourage pour un code postal donné + * @param {string} zipCode - Le code postal + * @returns {string} L'URL de labourage + */ +function getLabourerUrl(obj) { + + return `/admin/labourer/${obj.insee}`; +} + +// Fonction pour gérer la soumission du formulaire d'ajout de ville +function handleAddCityFormSubmit(event) { + event.preventDefault(); + const form = event.target; + const submitButton = form.querySelector('button[type="submit"]'); + const zipCodeInput = form.querySelector('input[name="zip_code"]'); + if (!zipCodeInput.value) { + return; + } + // Afficher le spinner + submitButton.disabled = true; + const originalContent = submitButton.innerHTML; + submitButton.innerHTML = ' Labourer...'; + // Rediriger + window.location.href = getLabourerUrl(zipCodeInput.value); +} + +/** + * Colore les cellules d'un tableau en fonction des pourcentages + * @param {string} selector - Le sélecteur CSS pour cibler les cellules à colorer + * @param {string} color - La couleur de base en format RGB (ex: '154, 205, 50') + */ +function colorizePercentageCells(selector, color = '154, 205, 50') { + document.querySelectorAll(selector).forEach(cell => { + const percentage = parseInt(cell.textContent); + if (!isNaN(percentage)) { + const alpha = percentage / 100; + cell.style.backgroundColor = `rgba(${color}, ${alpha})`; + } + }); +} + +/** + * Colore les cellules d'un tableau avec un gradient relatif à la valeur maximale + * @param {string} selector - Le sélecteur CSS pour cibler les cellules à colorer + * @param {string} color - La couleur de base en format RGB (ex: '154, 205, 50') + */ +function colorizePercentageCellsRelative(selector, color = '154, 205, 50') { + // Récupérer toutes les cellules + const cells = document.querySelectorAll(selector); + + // Trouver la valeur maximale + let maxValue = 0; + cells.forEach(cell => { + const value = parseInt(cell.textContent); + if (!isNaN(value) && value > maxValue) { + maxValue = value; + } + }); + + // Appliquer le gradient relatif à la valeur max + cells.forEach(cell => { + const value = parseInt(cell.textContent); + if (!isNaN(value)) { + const alpha = value / maxValue; // Ratio relatif au maximum + cell.style.backgroundColor = `rgba(${color}, ${alpha})`; + } + }); +} + +/** + * Ajuste dynamiquement la taille du texte des éléments list-group-item selon leur nombre + * @param {string} selector - Le sélecteur CSS des éléments à ajuster + * @param {number} [minFont=0.8] - Taille de police minimale en rem + * @param {number} [maxFont=1.2] - Taille de police maximale en rem + */ +function adjustListGroupFontSize(selector, minFont = 0.8, maxFont = 1.2) { + const items = document.querySelectorAll(selector); + const count = items.length; + let fontSize = maxFont; + if (count > 0) { + // Plus il y a d'items, plus la taille diminue, mais jamais en dessous de minFont + fontSize = Math.max(minFont, maxFont - (count - 5) * 0.05); + } + items.forEach(item => { + item.style.fontSize = fontSize + 'rem'; + }); +} + +function check_validity() { + if (!document.getElementById('editLand')) { + return; + } + + const form = document.getElementById('editLand'); + const fields = { + 'name': { + required: true, + message: 'Le nom est requis' + }, + 'contact:street': { + required: true, + message: 'La rue est requise' + }, + 'contact:housenumber': { + required: true, + message: 'Le numéro est requis' + }, + 'contact:phone': { + pattern: /^(?:(?:\+|00)33|0)\s*[1-9](?:[\s.-]*\d{2}){4}$/, + message: 'Le numéro de téléphone n\'est pas valide' + }, + 'contact:email': { + pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, + message: 'L\'adresse email n\'est pas valide' + }, + 'contact:website': { + pattern: /^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/, + message: 'L\'URL du site web n\'est pas valide' + } + }; + + let isValid = true; + const errorMessages = {}; + + // Supprimer les messages d'erreur précédents + document.querySelectorAll('.error-message').forEach(el => el.remove()); + + // Vérifier chaque champ + for (const [fieldName, rules] of Object.entries(fields)) { + const input = form.querySelector(`[name="${fieldName}"]`); + if (!input) continue; + + const value = input.value.trim(); + let fieldError = null; + + // Ne valider que si le champ n'est pas vide + if (value) { + if (rules.pattern && !rules.pattern.test(value)) { + fieldError = rules.message; + } + } else if (rules.required) { + // Si le champ est vide et requis + fieldError = rules.message; + } + + if (fieldError) { + isValid = false; + errorMessages[fieldName] = fieldError; + + // Créer et afficher le message d'erreur + const errorDiv = document.createElement('div'); + errorDiv.className = 'error-message text-danger small mt-1'; + errorDiv.textContent = fieldError; + input.parentNode.appendChild(errorDiv); + + // Ajouter une classe d'erreur au champ + input.classList.add('is-invalid'); + } else { + input.classList.remove('is-invalid'); + } + } + + return isValid; +} + +// Exporter les fonctions dans window +window.setupCitySearch = setupCitySearch; +window.getLabourerUrl = getLabourerUrl; +window.handleAddCityFormSubmit = handleAddCityFormSubmit; +window.colorizePercentageCells = colorizePercentageCells; +window.colorizePercentageCellsRelative = colorizePercentageCellsRelative; +window.adjustListGroupFontSize = adjustListGroupFontSize; +window.check_validity = check_validity; +window.enableLabourageForm = enableLabourageForm; +window.performSearch = performSearch; window.openInPanoramax = openInPanoramax; window.listChangesets = listChangesets; window.updateMapHeightForLargeScreens = updateMapHeightForLargeScreens; diff --git a/public/js/app.js b/public/js/app.js deleted file mode 100644 index e69de29..0000000 diff --git a/public/js/utils.js b/public/js/utils.js deleted file mode 100644 index a75b7f1..0000000 --- a/public/js/utils.js +++ /dev/null @@ -1,166 +0,0 @@ -// Fonction pour gérer la recherche de villes -/** - * Configure la recherche de ville avec autocomplétion - * @param {string} inputId - ID de l'input de recherche - * @param {string} suggestionListId - ID de la liste des suggestions - * @param {Function} onSelect - Callback appelé lors de la sélection d'une ville - */ -function setupCitySearch(inputId, suggestionListId, onSelect) { - const searchInput = document.getElementById(inputId); - const suggestionList = document.getElementById(suggestionListId); - - if (!searchInput || !suggestionList) return; - - let timeoutId = null; - - searchInput.addEventListener('input', function () { - clearTimeout(timeoutId); - const query = this.value.trim(); - - if (query.length < 2) { - clearSuggestions(); - return; - } - - timeoutId = setTimeout(() => performSearch(query), 300); - }); - - function performSearch(query) { - fetch(`https://geo.api.gouv.fr/communes?nom=${encodeURIComponent(query)}&fields=nom,code,codesPostaux&limit=5`) - .then(response => response.json()) - .then(data => { - const citySuggestions = data.map(city => ({ - name: city.nom, - postcode: city.codesPostaux[0], - insee: city.code - })); - displaySuggestions(citySuggestions); - }) - .catch(error => { - console.error('Erreur lors de la recherche:', error); - clearSuggestions(); - }); - } - - function displaySuggestions(suggestions) { - clearSuggestions(); - suggestions.forEach(suggestion => { - const li = document.createElement('li'); - li.className = 'list-group-item'; - li.textContent = `${suggestion.name} (${suggestion.postcode})`; - li.addEventListener('click', () => { - searchInput.value = suggestion.name; - clearSuggestions(); - if (onSelect) onSelect(suggestion); - }); - suggestionList.appendChild(li); - }); - } - - function clearSuggestions() { - suggestionList.innerHTML = ''; - } - - // Fermer les suggestions en cliquant en dehors - document.addEventListener('click', function (e) { - if (!searchInput.contains(e.target) && !suggestionList.contains(e.target)) { - clearSuggestions(); - } - }); -} - -// Fonction pour formater l'URL de labourage -/** - * Génère l'URL de labourage pour un code postal donné - * @param {string} zipCode - Le code postal - * @returns {string} L'URL de labourage - */ -function getLabourerUrl(zipCode) { - return `/admin/labourer/${zipCode}`; -} - -// Fonction pour gérer la soumission du formulaire d'ajout de ville -function handleAddCityFormSubmit(event) { - event.preventDefault(); - const form = event.target; - const submitButton = form.querySelector('button[type="submit"]'); - const zipCodeInput = form.querySelector('input[name="zip_code"]'); - if (!zipCodeInput.value) { - return; - } - // Afficher le spinner - submitButton.disabled = true; - const originalContent = submitButton.innerHTML; - submitButton.innerHTML = ' Labourer...'; - // Rediriger - window.location.href = getLabourerUrl(zipCodeInput.value); -} - -/** - * Colore les cellules d'un tableau en fonction des pourcentages - * @param {string} selector - Le sélecteur CSS pour cibler les cellules à colorer - * @param {string} color - La couleur de base en format RGB (ex: '154, 205, 50') - */ -function colorizePercentageCells(selector, color = '154, 205, 50') { - document.querySelectorAll(selector).forEach(cell => { - const percentage = parseInt(cell.textContent); - if (!isNaN(percentage)) { - const alpha = percentage / 100; - cell.style.backgroundColor = `rgba(${color}, ${alpha})`; - } - }); -} - -/** - * Colore les cellules d'un tableau avec un gradient relatif à la valeur maximale - * @param {string} selector - Le sélecteur CSS pour cibler les cellules à colorer - * @param {string} color - La couleur de base en format RGB (ex: '154, 205, 50') - */ -function colorizePercentageCellsRelative(selector, color = '154, 205, 50') { - // Récupérer toutes les cellules - const cells = document.querySelectorAll(selector); - - // Trouver la valeur maximale - let maxValue = 0; - cells.forEach(cell => { - const value = parseInt(cell.textContent); - if (!isNaN(value) && value > maxValue) { - maxValue = value; - } - }); - - // Appliquer le gradient relatif à la valeur max - cells.forEach(cell => { - const value = parseInt(cell.textContent); - if (!isNaN(value)) { - const alpha = value / maxValue; // Ratio relatif au maximum - cell.style.backgroundColor = `rgba(${color}, ${alpha})`; - } - }); -} - -/** - * Ajuste dynamiquement la taille du texte des éléments list-group-item selon leur nombre - * @param {string} selector - Le sélecteur CSS des éléments à ajuster - * @param {number} [minFont=0.8] - Taille de police minimale en rem - * @param {number} [maxFont=1.2] - Taille de police maximale en rem - */ -function adjustListGroupFontSize(selector, minFont = 0.8, maxFont = 1.2) { - const items = document.querySelectorAll(selector); - const count = items.length; - let fontSize = maxFont; - if (count > 0) { - // Plus il y a d'items, plus la taille diminue, mais jamais en dessous de minFont - fontSize = Math.max(minFont, maxFont - (count - 5) * 0.05); - } - items.forEach(item => { - item.style.fontSize = fontSize + 'rem'; - }); -} - -function check_validity() { - if (!document.getElementById('editLand')) { - return; - } - // ... suite du code ... -} \ No newline at end of file diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index 89782b9..dc2479a 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -39,7 +39,7 @@ final class AdminController extends AbstractController // Récupérer les stats existantes pour la zone $stats = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $insee_code]); - + $urls = $stats->getAllCTCUrlsMap(); $statsHistory = $this->entityManager->getRepository(StatsHistory::class) ->createQueryBuilder('sh') @@ -90,6 +90,7 @@ final class AdminController extends AbstractController 'maptiler_token' => $_ENV['MAPTILER_TOKEN'], 'mapbox_token' => $_ENV['MAPBOX_TOKEN'], 'statsHistory' => $statsHistory, + 'CTC_urls' => $urls, ]); } diff --git a/src/Entity/Stats.php b/src/Entity/Stats.php index 4278af8..2295028 100644 --- a/src/Entity/Stats.php +++ b/src/Entity/Stats.php @@ -86,6 +86,87 @@ class Stats #[ORM\Column(nullable: true)] private ?int $avec_name = null; + public function getCTCurlBase(): ?string + { + $base = 'https://complete-tes-commerces.fr/'; + $zone = $this->zone; + + $departement = substr($zone, 0, 2); + $insee_code = $zone; + $slug = strtolower(str_replace(' ', '-', $this->getName())); + $url = $base . $departement . '/' . $insee_code . '-'.$slug.'/json/' . $slug ; + + return $url; + } + + public function getLastStats(): string + { + return $this->getParametricJsonFromCTC('_last_stats'); + } + + public function getDailyStats(): string + { + return $this->getParametricJsonFromCTC('_dailystats'); + } + + public function getOSMClosedSirets(): string + { + return $this->getParametricJsonFromCTC('_osm_closed_siret'); + } + + public function getOSMDisusedShops(): string + { + return $this->getParametricJsonFromCTC('_osm_disused_shops'); + } + + public function getOSMNoSiteShops(): string + { + return $this->getParametricJsonFromCTC('_osm_no_site_shops'); + } + + public function getPanoFile(): string + { + return $this->getParametricJsonFromCTC('_pano_file'); + } + + public function getClosedPanoFile(): string + { + return $this->getParametricJsonFromCTC('_closed_pano_file'); + } + + public function getSireneMatches(): string + { + return $this->getParametricJsonFromCTC('_sirene_matches'); + } + + + + public function getParametricJsonFromCTC($suffixe): string + { + $url = $this->getCTCurlBase().$suffixe.'.json'; + + return $url; + } + + + public function getAllCTCUrlsMap(): ?array + { + $functions = [ + 'getLastStats', + 'getDailyStats', + 'getOSMClosedSirets', + 'getOSMDisusedShops', + 'getOSMNoSiteShops', + ]; + + $urls = []; + foreach ($functions as $function) { + $urls[$function] = $this->$function(); + } + return $urls; + } + + // calcule le pourcentage de complétion de la zone public function computeCompletionPercent(): ?int { diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig index 0822950..753e5b4 100644 --- a/templates/admin/stats.html.twig +++ b/templates/admin/stats.html.twig @@ -22,163 +22,6 @@ {% endblock %} -{% block javascripts %} - {{ parent() }} - - - - - -{% endblock %} {% block body %}
@@ -387,6 +230,167 @@ +{% endblock %} + +{% block javascripts %} + {{ parent() }} + + + + {# #} + + + -{% endblock %} \ No newline at end of file + +{% endblock %} diff --git a/templates/admin/stats/row.html.twig b/templates/admin/stats/row.html.twig index 8afee49..cbabaed 100644 --- a/templates/admin/stats/row.html.twig +++ b/templates/admin/stats/row.html.twig @@ -86,6 +86,9 @@ {{ commerce.noteContent }} {{ commerce.siret }} + {# (si siret clos) #} + + diff --git a/templates/admin/stats/table-head.html.twig b/templates/admin/stats/table-head.html.twig index 1ac9d7d..f378bb0 100644 --- a/templates/admin/stats/table-head.html.twig +++ b/templates/admin/stats/table-head.html.twig @@ -42,6 +42,10 @@ Siret + + Siret clos + + Osm id diff --git a/templates/public/dashboard.html.twig b/templates/public/dashboard.html.twig index 67bf609..35f2df1 100644 --- a/templates/public/dashboard.html.twig +++ b/templates/public/dashboard.html.twig @@ -23,7 +23,6 @@ overflow-y: auto; width: 100%; z-index: 1000; - display: none; } .suggestion-item { padding: 8px 12px; @@ -50,58 +49,6 @@ {% endblock %} -{% block javascripts %} - {{ parent() }} - - - -{% endblock %} {% block body %}
@@ -167,34 +114,30 @@
-
-
-
-
-

Labourer une ville

-

- - Rechercher une ville pour labourer ses commerces -

-
-
- -
-
- - -
-
-
-
-
+ {% include 'public/labourage-form.html.twig' %} {% endblock %} + + +{% block javascripts %} + {{ parent() }} + + + +{% endblock %} \ No newline at end of file diff --git a/templates/public/edit.html.twig b/templates/public/edit.html.twig index 209091f..e1715cb 100644 --- a/templates/public/edit.html.twig +++ b/templates/public/edit.html.twig @@ -184,6 +184,7 @@ {% block javascripts %} {{ parent() }} + + + {% endblock %} -{% block javascripts %} - {{ parent() }} - -{% endblock %} - diff --git a/templates/public/labourage-form.html.twig b/templates/public/labourage-form.html.twig new file mode 100644 index 0000000..fba9e47 --- /dev/null +++ b/templates/public/labourage-form.html.twig @@ -0,0 +1,29 @@ +
+
+
+
+

Labourer une ville

+

+ + Rechercher une ville pour labourer ses commerces +

+
+
+ +
+
+ + +
+
+
+
+
\ No newline at end of file From e0646ad97fe458697a78fba97b5fed05f7c27393 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 18 Jun 2025 00:54:31 +0200 Subject: [PATCH 2/3] remove logs --- templates/admin/stats.html.twig | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig index 753e5b4..26be913 100644 --- a/templates/admin/stats.html.twig +++ b/templates/admin/stats.html.twig @@ -442,6 +442,8 @@ function getCompletionColor(completion) { } // Convertir le pourcentage en couleur verte (0% = blanc, 100% = vert foncé) const intensity = Math.floor((completion / 100) * 255); + console.log('completion', completion, intensity); + return `rgb(0, ${intensity}, 0)`; } @@ -522,7 +524,7 @@ function updateMarkers(features, map, currentMarkerType, dropMarkers, overpassDa // Créer un cercle pour chaque feature const circle = turf.circle( feature.geometry.coordinates, - 0.5, // rayon en kilomètres + 0.02, // rayon en kilomètres (réduit de 0.5 à 0.2) { steps: 64, units: 'kilometers' } ); @@ -640,7 +642,6 @@ window.updateMarkers = updateMarkers; }); // Enlever la virgule finale query = query.replace(/,$/, ''); - console.log('josm query', query); return query; } @@ -658,7 +659,6 @@ window.updateMarkers = updateMarkers; throw new Error(`HTTP error! status: ${response.status}`); } const data = await response.json(); - console.log('Données reçues:', data); // Stocker les données Overpass data.elements.forEach(element => { @@ -734,8 +734,6 @@ window.updateMarkers = updateMarkers; tempLink.style.display = 'none'; document.body.appendChild(tempLink); - console.log('josmUrl', josmUrl); - tempLink.href = josmUrl; tempLink.click(); document.body.removeChild(tempLink); @@ -747,12 +745,10 @@ window.updateMarkers = updateMarkers; return; } const query = createJOSMQuery(josm_elements); - console.log('map', map); openJOSMQuery(map, query); } document.addEventListener('DOMContentLoaded', function() { - console.log('DOMContentLoaded'); maplibre = new maplibregl.Map({ container: 'map', @@ -823,8 +819,7 @@ window.updateMarkers = updateMarkers; document.getElementById('openInJOSM').addEventListener('click', openInJOSM); // Attendre que la carte soit chargée avant d'ajouter les écouteurs d'événements - map.on('load', function() { - console.log('Map loaded'); + map.on('load', function() { map_is_loaded = true; // Changer le curseur au survol des marqueurs map.on('mouseenter', function(e) { @@ -914,7 +909,7 @@ window.updateMarkers = updateMarkers; // si oui, on remplit la case des infos en cas de siret clos avec la propriété "vente", puis "radiation", puis "liquidation". avec chacun une icone bootstrap. // on compte les sirets clos et on remplit l'entête du tableau en comptant. async function markClosedSiretsOnTable() { - // 1. Récupérer la liste des SIRETs fermés via l’API + // 1. Récupérer la liste des SIRETs fermés via l'API const response = await fetch(CTC_urls.getOSMClosedSirets); const closedSirets = await response.json(); // [{siret, vente, radiation, liquidation, ...}, ...] const closedSiretMap = {}; @@ -949,7 +944,7 @@ window.updateMarkers = updateMarkers; } }); - // 4. Mettre à jour l’entête du tableau avec le nombre de SIRETs clos + // 4. Mettre à jour l'entête du tableau avec le nombre de SIRETs clos const headerClosed = document.querySelector('.header-closed-count'); if (headerClosed) { headerClosed.textContent = closedCount; From 964de52ad4bcd725a020f88933c94b6f76d8bc96 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 18 Jun 2025 01:23:16 +0200 Subject: [PATCH 3/3] ajout donut des tags --- assets/utils.js | 3 +- templates/admin/stats.html.twig | 86 ++++++++++++++++++++++++++++++--- 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/assets/utils.js b/assets/utils.js index 140e648..e6cd43a 100644 --- a/assets/utils.js +++ b/assets/utils.js @@ -454,6 +454,7 @@ function check_validity() { return isValid; } + // Exporter les fonctions dans window window.setupCitySearch = setupCitySearch; window.getLabourerUrl = getLabourerUrl; @@ -469,4 +470,4 @@ window.listChangesets = listChangesets; window.updateMapHeightForLargeScreens = updateMapHeightForLargeScreens; window.searchInseeCode = searchInseeCode; window.genererCouleurPastel = genererCouleurPastel; -window.check_validity = check_validity; +window.check_validity = check_validity; \ No newline at end of file diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig index 26be913..e1c1abe 100644 --- a/templates/admin/stats.html.twig +++ b/templates/admin/stats.html.twig @@ -122,7 +122,8 @@ -
+
+
Données OpenStreetMap
@@ -236,9 +237,7 @@ {{ parent() }} - - {# #} - + {% endblock %}