diff --git a/assets/app.js b/assets/app.js
index d27d220a..f290bca1 100644
--- a/assets/app.js
+++ b/assets/app.js
@@ -23,7 +23,16 @@ import './dashboard-charts.js';
import Chart from 'chart.js/auto';
import ChartDataLabels from 'chartjs-plugin-datalabels';
import maplibregl from 'maplibre-gl';
-import { genererCouleurPastel, setupCitySearch, handleAddCityFormSubmit, enableLabourageForm, getLabourerUrl, adjustListGroupFontSize, toggleCompletionInfo } from './utils.js';
+import {
+ genererCouleurPastel,
+ setupCitySearch,
+ handleAddCityFormSubmit,
+ enableLabourageForm,
+ getLabourerUrl,
+ adjustListGroupFontSize,
+ toggleCompletionInfo,
+ updateMapHeightForLargeScreens
+} from './utils.js';
import Tablesort from 'tablesort';
window.Chart = Chart;
@@ -34,6 +43,7 @@ window.getLabourerUrl = getLabourerUrl;
window.ChartDataLabels = ChartDataLabels;
window.maplibregl = maplibregl;
window.toggleCompletionInfo = toggleCompletionInfo;
+window.updateMapHeightForLargeScreens = updateMapHeightForLargeScreens;
Chart.register(ChartDataLabels);
@@ -41,6 +51,11 @@ Chart.register(ChartDataLabels);
document.addEventListener('DOMContentLoaded', () => {
console.log('DOMContentLoaded');
+ if(updateMapHeightForLargeScreens){
+
+ updateMapHeightForLargeScreens();
+ window.addEventListener('resize', updateMapHeightForLargeScreens);
+ }
const randombg = genererCouleurPastel();
// Appliquer la couleur au body
@@ -184,7 +199,6 @@ document.addEventListener('DOMContentLoaded', () => {
});
}
- enableLabourageForm();
+ enableLabourageForm();
adjustListGroupFontSize('.list-group-item');
});
-
\ No newline at end of file
diff --git a/assets/dashboard-charts.js b/assets/dashboard-charts.js
index 1976d38d..ea5ab2ae 100644
--- a/assets/dashboard-charts.js
+++ b/assets/dashboard-charts.js
@@ -97,7 +97,7 @@ document.addEventListener('DOMContentLoaded', function() {
align: 'center',
color: '#000',
display: true,
- font: { weight: 'bold' },
+ font: { weight: '400', size : "1rem" },
formatter: (value, context) => {
return context.dataset.data[context.dataIndex].label;
}
@@ -107,7 +107,7 @@ document.addEventListener('DOMContentLoaded', function() {
label: 'Régression linéaire',
type: 'line',
data: regressionLine,
- borderColor: 'rgba(0, 0, 0, 0.7)',
+ borderColor: 'rgba(162, 255, 40, 0.7)',
borderWidth: 2,
pointRadius: 0,
fill: false,
@@ -135,7 +135,7 @@ document.addEventListener('DOMContentLoaded', function() {
return [
`${d.label}`,
`Population: ${d.x.toLocaleString()}`,
- `Lieux / 1000 hab: ${d.y.toFixed(2)}`,
+ `Lieux / hab: ${d.y.toFixed(2)}`,
`Total lieux: ${Math.round(Math.pow(d.r / 2, 2))}`,
`Complétion: ${d.completion}%`
];
diff --git a/assets/utils.js b/assets/utils.js
index a6db7069..616e6434 100644
--- a/assets/utils.js
+++ b/assets/utils.js
@@ -97,7 +97,7 @@ async function searchInseeCode(query) {
}
}
-function updateMapHeightForLargeScreens() {
+export function updateMapHeightForLargeScreens() {
const mapFound = document.querySelector('#map');
if (mapFound && window.innerHeight > 800 && window.innerWidth > 800) {
mapFound.style.height = window.innerWidth * 0.8 + 'px';
@@ -171,13 +171,24 @@ export function enableLabourageForm() {
const form = citySearchInput.closest('form');
setupCitySearch('citySearch', 'citySuggestions', function (result_search) {
if (form) {
- const labourageBtn = form.querySelector('.btn-labourer');
+ const labourageBtn = form.querySelector('button[type="submit"]');
if (labourageBtn) {
- labourageBtn.innerHTML = ' Chargement...';
- labourageBtn.disabled = true;
+ // Remplir le champ caché avec le code INSEE
+ const inseeInput = form.querySelector('#selectedZipCode');
+ if (inseeInput) {
+ inseeInput.value = result_search.insee;
+ }
+ // Changer l'action du formulaire pour pointer vers la bonne URL
+ form.action = getLabourerUrl(result_search);
+
+ // Changer le texte du bouton et le désactiver
+ labourageBtn.innerHTML = ' Labourage de ' + result_search.name + '...';
+ labourageBtn.disabled = true;
+
+ // Soumettre le formulaire
+ form.submit();
}
}
- window.location.href = getLabourerUrl(result_search);
});
}
}
@@ -191,7 +202,7 @@ export function setupCitySearch(inputId, suggestionListId, onSelect) {
let timeoutId = null;
let searchOngoing = false;
- searchInput.addEventListener('input', function () {
+ searchInput.addEventListener('keyup', function () {
clearTimeout(timeoutId);
const query = this.value.trim();
if (query.length < 3) {
@@ -329,7 +340,6 @@ export function calculateCompletion(properties) {
if (properties.website || properties['contact:website']) completed++;
if (properties.phone || properties['contact:phone']) completed++;
if (properties.wheelchair) completed++;
- if (properties.note) completed++;
return {
percentage: total > 0 ? (completed / total) * 100 : 0,
diff --git a/src/Entity/Place.php b/src/Entity/Place.php
index 3196a7b5..d7d204d8 100644
--- a/src/Entity/Place.php
+++ b/src/Entity/Place.php
@@ -22,7 +22,7 @@ class Place
#[ORM\Column(length: 10)]
private ?string $osm_kind = null;
- #[ORM\Column(length: 255)]
+ #[ORM\Column(length: 255, nullable: true)]
private ?string $email = null;
#[ORM\Column]
@@ -252,20 +252,31 @@ class Place
// Setters from tags
$this->setName($tags['name'] ?? null);
- $this->setStreet($tags['addr:street'] ?? $tags['contact:street'] ?? null);
- $this->setHousenumber($tags['addr:housenumber'] ?? $tags['contact:housenumber'] ?? null);
+
+ $street = isset($tags['addr:street']) ? $tags['addr:street'] : (isset($tags['contact:street']) ? $tags['contact:street'] : null);
+ $this->setStreet($street);
+
+ $housenumber = isset($tags['addr:housenumber']) ? $tags['addr:housenumber'] : (isset($tags['contact:housenumber']) ? $tags['contact:housenumber'] : null);
+ $this->setHousenumber($housenumber);
+
if (isset($tags['addr:postcode'])) {
$this->setZipCode(intval($tags['addr:postcode']));
}
- $this->setEmail($tags['contact:email'] ?? $tags['email'] ?? null);
- $this->setSiret($tags['ref:FR:SIRET'] ?? null);
+
+ $email = isset($tags['contact:email']) ? $tags['contact:email'] : (isset($tags['email']) ? $tags['email'] : null);
+ $this->setEmail($email);
+
+ $siret = isset($tags['ref:FR:SIRET']) ? $tags['ref:FR:SIRET'] : null;
+ $this->setSiret($siret);
// Boolean "has" properties
$this->setHasOpeningHours(!empty($tags['opening_hours']));
$this->setHasWheelchair(!empty($tags['wheelchair']));
// has address logic
- $this->setHasAddress(!empty($this->getStreet()) && !empty($this->getHousenumber()));
+
+ $this->setHasAddress(!empty($this->getStreet()) && !empty($this->getHousenumber())
+ | (isset($tags['addr:street']) && isset($tags['addr:housenumber'])) );
// has website logic (with multiple possible tags)
$websiteTags = ['website', 'contact:website', 'url', 'contact:url'];
@@ -277,6 +288,7 @@ class Place
}
}
$this->setHasWebsite($hasWebsite);
+
// has note logic
$noteContent = '';
@@ -335,7 +347,7 @@ class Place
return $this->email;
}
- public function setEmail(string $email): static
+ public function setEmail(?string $email): static
{
$this->email = $email;
diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig
index b72fd664..a125ce2e 100644
--- a/templates/admin/stats.html.twig
+++ b/templates/admin/stats.html.twig
@@ -305,7 +305,8 @@
{% block javascripts %}
{{ parent() }}
-
+
-
-
-
{% endblock %}
diff --git a/templates/public/dashboard.html.twig b/templates/public/dashboard.html.twig
index 030af770..72210de5 100644
--- a/templates/public/dashboard.html.twig
+++ b/templates/public/dashboard.html.twig
@@ -260,20 +260,9 @@
{
label: 'Villes',
data: bubbleChartData,
- backgroundColor: bubbleChartData.map(d => `rgba(255, 99, 132, ${d.completion / 100})`),
- borderColor: 'rgba(255, 99, 132, 1)',
- },
- // regressionLine ? {
- // label: 'Régression linéaire',
- // type: 'line',
- // data: regressionLine,
- // borderColor: 'rgba(0, 0, 0, 0.7)',
- // borderWidth: 2,
- // pointRadius: 0,
- // fill: false,
- // order: 0,
- // tension: 0
- // } : null
+ backgroundColor: bubbleChartData.map(d => `rgba(75, 192, 192, ${d.completion / 100})`),
+ borderColor: 'rgba(75, 192, 192, 1)',
+ },
].filter(Boolean)
},
options: {
@@ -284,7 +273,8 @@
align: 'center',
color: '#000',
font: {
- weight: 'bold'
+ weight: '400',
+ size: "10px",
},
formatter: (value, context) => {
return context.dataset.data[context.dataIndex].label;
@@ -303,7 +293,7 @@
return [
`${d.label}`,
`Population: ${d.x.toLocaleString()}`,
- `Lieux / 1000 hab: ${d.y.toFixed(2)}`,
+ `Lieux / hab: ${d.y.toFixed(2)}`,
`Total lieux: ${Math.round(Math.pow(d.r / 2, 2))}`,
`Complétion: ${d.completion}%`
];