diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/php.xml b/.idea/php.xml
index 75ef1e3..231d24e 100644
--- a/.idea/php.xml
+++ b/.idea/php.xml
@@ -10,6 +10,11 @@
+
+
+
+
+
@@ -155,6 +160,11 @@
+
+
+
+
+
@@ -163,6 +173,11 @@
+
+
+
+
+
diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php
index ea7df39..bf23c9e 100644
--- a/src/Controller/AdminController.php
+++ b/src/Controller/AdminController.php
@@ -1967,7 +1967,7 @@ final class AdminController extends AbstractController
// Set OSM object type and OSM ID from the Place
$demande->setOsmObjectType($place->getOsmKind());
- $demande->setOsmId((int)$place->getOsmId());
+ $demande->setOsmId($place->getOsmId());
$this->entityManager->persist($demande);
$this->entityManager->flush();
diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php
index bee6d4f..8ba7c90 100644
--- a/src/Controller/PublicController.php
+++ b/src/Controller/PublicController.php
@@ -148,10 +148,11 @@ class PublicController extends AbstractController
// Save the OSM ID if provided
if (isset($data['osmId']) && !empty($data['osmId'])) {
- $demande->setOsmId((int)$data['osmId']);
+ $demande->setOsmId($data['osmId']);
}
// Check if a Place exists with the same OSM ID and type
+ $place = null;
if ($demande->getOsmId() && $demande->getOsmObjectType()) {
$existingPlace = $this->entityManager->getRepository(Place::class)->findOneBy([
'osm_kind' => $demande->getOsmObjectType(),
@@ -162,6 +163,45 @@ class PublicController extends AbstractController
// Link the Place UUID to the Demande
$demande->setPlaceUuid($existingPlace->getUuidForUrl());
$demande->setPlace($existingPlace);
+ $place = $existingPlace;
+ } else {
+ // Create a new Place if one doesn't exist
+ $place = new Place();
+ $place->setOsmId((string)$demande->getOsmId());
+ $place->setOsmKind($demande->getOsmObjectType());
+
+ // Get OSM data from Overpass API
+ $commerce_overpass = $this->motocultrice->get_osm_object_data($demande->getOsmObjectType(), $demande->getOsmId());
+
+ if ($commerce_overpass) {
+ // Update the Place with OSM data
+ $place->update_place_from_overpass_data($commerce_overpass);
+
+ // Link the Place to the Demande
+ $demande->setPlaceUuid($place->getUuidForUrl());
+ $demande->setPlace($place);
+
+ // Persist the Place
+ $this->entityManager->persist($place);
+ }
+ }
+
+ // Link the Place to a Stat object using the INSEE code
+ if ($place && $demande->getInsee()) {
+ $stats = $place->getStats();
+ if (!$stats) {
+ $stats_exist = $this->entityManager->getRepository(Stats::class)->findOneBy(['zone' => $demande->getInsee()]);
+ if ($stats_exist) {
+ $stats = $stats_exist;
+ } else {
+ $stats = new Stats();
+ $stats->setZone((string)$demande->getInsee());
+ $this->entityManager->persist($stats);
+ }
+
+ $stats->addPlace($place);
+ $place->setStats($stats);
+ }
}
}
diff --git a/src/Entity/Demande.php b/src/Entity/Demande.php
index 0e96f05..2d35ab1 100644
--- a/src/Entity/Demande.php
+++ b/src/Entity/Demande.php
@@ -41,8 +41,8 @@ class Demande
#[ORM\Column(length: 10, nullable: true)]
private ?string $osmObjectType = null;
- #[ORM\Column(nullable: true)]
- private ?int $osmId = null;
+ #[ORM\Column(nullable: true, type: 'string', length: 255)]
+ private ?string $osmId = null;
public function __construct()
{
@@ -163,12 +163,12 @@ class Demande
return $this;
}
- public function getOsmId(): ?int
+ public function getOsmId(): ?string
{
return $this->osmId;
}
- public function setOsmId(?int $osmId): static
+ public function setOsmId(?string $osmId): static
{
$this->osmId = $osmId;
diff --git a/templates/public/cities.html.twig b/templates/public/cities.html.twig
index 2abe76c..11eaa51 100644
--- a/templates/public/cities.html.twig
+++ b/templates/public/cities.html.twig
@@ -133,6 +133,13 @@
{% endif %}
{% endfor %}
{% endif %}
+
+ // Enable the labourage form
+ if (typeof enableLabourageForm === 'function') {
+ enableLabourageForm();
+ } else {
+ console.error('enableLabourageForm function not found');
+ }
});
{% endblock %}
diff --git a/templates/public/home.html.twig b/templates/public/home.html.twig
index a9c2343..7afd5cf 100644
--- a/templates/public/home.html.twig
+++ b/templates/public/home.html.twig
@@ -112,6 +112,15 @@
background-color: #f5f5f5;
color: #000;
}
+
+ #resultsMap {
+ height: 400px;
+ width: 100%;
+ margin-top: 1rem;
+ margin-bottom: 1rem;
+ border-radius: 8px;
+ display: none;
+ }
{% endblock %}
@@ -162,7 +171,8 @@
Visibilité Maximale
- Vos informations apparaîtront sur TomTom, Apple Plans, Facebook, CoMaps et des
+
Vos informations apparaîtront sur TomTom, Apple Plans, Facebook, CoMaps et
+ des
centaines d'autres applications.
@@ -222,9 +232,23 @@
Exemple: Café de la Place, Lyon
+
+
+
+
+
+
+
+
+
+
+
+
@@ -328,15 +352,15 @@
{% block javascripts %}
{{ parent() }}
{% endblock %}