From e96acf4ab87a0c53864a22490bbe09a9bfd990c0 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Sun, 13 Jul 2025 16:59:45 +0200 Subject: [PATCH] addr in submit form --- src/Controller/AdminController.php | 2 +- src/Controller/PublicController.php | 12 +- src/Service/FollowUpService.php | 8 +- src/Service/Motocultrice.php | 2 +- templates/admin/stats.html.twig | 6 +- templates/public/edit.html.twig | 472 +++++++++++---------- templates/public/edit/address.html.twig | 6 +- templates/public/edit/clim.html.twig | 50 ++- templates/public/edit/restaurant.html.twig | 24 +- 9 files changed, 309 insertions(+), 273 deletions(-) diff --git a/src/Controller/AdminController.php b/src/Controller/AdminController.php index d60ecc0..027f765 100644 --- a/src/Controller/AdminController.php +++ b/src/Controller/AdminController.php @@ -632,7 +632,7 @@ final class AdminController extends AbstractController 'completion_data' => json_encode($completionData), 'icons' => \App\Service\FollowUpService::getFollowUpIcons(), 'geojson' => json_encode($geojson), - 'overpass_query' => $overpass_query, + 'overpass_query' => $overpass_query | "", 'josm_url' => $josm_url, 'center' => $center, 'maptiler_token' => $_ENV['MAPTILER_TOKEN'] ?? null, diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php index eac9dc6..9778527 100644 --- a/src/Controller/PublicController.php +++ b/src/Controller/PublicController.php @@ -339,11 +339,13 @@ class PublicController extends AbstractController $currentObjectData = $this->motocultrice->get_osm_object_data($osm_kind, $osm_object_id); $tags_before_modif = $currentObjectData['tags_converted'] ?? []; $tags_after_modif = $tags; - // var_dump('POST brut', $_POST); - // var_dump('request->request->all()', $request->request->all()); - // var_dump('tags extraits', $tags); - // DEBUG : enlever ce die après analyse - // die('DEBUG avant envoi OSM'); +// var_dump('POST brut', $_POST); +// var_dump('request->request->all()', $request->request->all()); +// var_dump('tags extraits', $tags); + var_dump('tags_before_modif', $tags_before_modif); + var_dump('tags after modif', $tags_after_modif); +// DEBUG : enlever ce die après analyse + die('DEBUG avant envoi OSM'); // Récupérer le token OSM depuis les variables d'environnement $osm_api_token = $_ENV['APP_OSM_BEARER']; diff --git a/src/Service/FollowUpService.php b/src/Service/FollowUpService.php index 441c738..92f5aff 100644 --- a/src/Service/FollowUpService.php +++ b/src/Service/FollowUpService.php @@ -330,7 +330,13 @@ class FollowUpService public static function getFollowUpOverpassQueries(): array { - return [ + return [ + 'places' => 'nw["amenity"~"^(library|townhall|restaurant|fast_food|cafe|fuel|pharmacy|bank|bar|hospital|post_office|clinic|pub|car_wash|ice_cream|driving_school|cinema|car_rental|nightclub|bureau_de_change|studio|internet_cafe|money_transfer|casino|vehicle_inspection|frozen_food|boat_rental|coworking_space|workshop|personal_service|camping|dancing_school|training|ski_school|ski_rental|dive_centre|driver_training|nursing_home|funeral_hall|doctors|dentist|theatre|kindergarten|language_school|stripclub|veterinary|convenience|supermarket|clothes|hairdresser|car_repair|bakery|beauty|car|hardware|mobile_phone|butcher|furniture|car_parts|alcohol|florist|scooter|variety_store|electronics|shoes|optician|jewelry|mall|gift|doityourself|greengrocer|books|bicycle|chemist|department_store|laundry|travel_agency|stationery|pet|sports|confectionery|tyres|cosmetics|computer|tailor|tobacco|storage_rental|dry_cleaning|trade|copyshop|motorcycle|funeral_directors|beverages|newsagent|garden_centre|massage|pastry|interior_decoration|general|deli|toys|houseware|wine|seafood|pawnbroker|tattoo|paint|wholesale|photo|second_hand|bed|kitchen|outdoor|fabric|antiques|coffee|gas|e-cigarette|perfumery|craft|hearing_aids|money_lender|appliance|electrical|tea|motorcycle_repair|boutique|baby_goods|bag|musical_instrument|dairy|pet_grooming|music|carpet|rental|fashion_accessories|cheese|chocolate|medical_supply|leather|sewing|cannabis|locksmith|games|video_games|hifi|window_blind|caravan|tool_hire|household_linen|bathroom_furnishing|shoe_repair|watches|nutrition_supplements|fishing|erotic|frame|grocery|boat|repair|weapons|gold_buyer|lighting|pottery|security|groundskeeping|herbalist|curtain|health_food|flooring|printer_ink|anime|camera|scuba_diving|candles|printing|garden_furniture|food|estate_agent|insurance|it|accountant|employment_agency|tax_advisor|financial|advertising_agency|logistics|newspaper|financial_advisor|consulting|travel_agent|coworking|moving_company|lawyer|architect|construction_company|credit_broker|graphic_design|property_management|cleaning)$"](area.searchArea); + nw["shop"]["shop"!~"vacant"](area.searchArea); + nw["tourism"~"^(hotel|hostel|motel|wilderness_hut|yes|chalet|gallery|guest_house|museum|zoo|theme_park|aquarium|alpine_hut|apartment)$"](area.searchArea); + nw["healthcare"](area.searchArea); + nw["information"="office"](area.searchArea); + nw["office"](area.searchArea);', 'fire_hydrant' => 'nwr["emergency"="fire_hydrant"](area.searchArea);', 'charging_station' => 'nwr["amenity"="charging_station"](area.searchArea);', 'toilets' => 'nwr["amenity"="toilets"](area.searchArea);', diff --git a/src/Service/Motocultrice.php b/src/Service/Motocultrice.php index 5f5ef7e..b49e3e2 100644 --- a/src/Service/Motocultrice.php +++ b/src/Service/Motocultrice.php @@ -179,7 +179,7 @@ out meta;'; } if($has_opening_hours) { - $modified_request_post['commerce_tag_value__opening_hours'] = $request_post['commerce_tag_value__opening_hours']; + $modified_request_post['commerce_tag_value__custom__opening_hours'] = $request_post['custom__opening_hours']; } return $modified_request_post; diff --git a/templates/admin/stats.html.twig b/templates/admin/stats.html.twig index 71d00cc..3e0f9b6 100644 --- a/templates/admin/stats.html.twig +++ b/templates/admin/stats.html.twig @@ -191,6 +191,7 @@ {% set overpass_type_queries = { 'fire_hydrant': 'nwr["emergency"="fire_hydrant"](area.searchArea);', 'charging_station': 'nwr["amenity"="charging_station"](area.searchArea);', + 'bicycle_parking' : 'nwr["amenity"="bicycle_parking"](area.searchArea);', 'toilets': 'nwr["amenity"="toilets"](area.searchArea);', 'bus_stop': 'nwr["highway"="bus_stop"](area.searchArea);', 'defibrillator': 'nwr["emergency"="defibrillator"](area.searchArea);', @@ -200,13 +201,14 @@ 'laboratory': 'nwr["healthcare"="laboratory"](area.searchArea);', 'school': 'nwr["amenity"="school"](area.searchArea);', 'police': 'nwr["amenity"="police"](area.searchArea);', + 'drinking_water' : 'nwr["amenity"="drinking_water"](area.searchArea);', 'healthcare': 'nwr["healthcare"](area.searchArea);nwr["amenity"="doctors"](area.searchArea);nwr["amenity"="pharmacy"](area.searchArea);nwr["amenity"="hospital"](area.searchArea);nwr["amenity"="clinic"](area.searchArea);nwr["amenity"="social_facility"](area.searchArea);' } %} {% set theme_groups = { 'emergency': ['fire_hydrant', 'defibrillator'], - 'transport': ['bus_stop', 'charging_station'], - 'healthcare': ['healthcare', 'laboratory'], + 'transport': ['bus_stop', 'charging_station', 'bicycle_parking'], + 'healthcare': ['healthcare', 'laboratory', 'drinking_water'], 'education': ['school'], 'security': ['police', 'camera'], 'infrastructure': ['toilets', 'recycling', 'substation'] diff --git a/templates/public/edit.html.twig b/templates/public/edit.html.twig index 91cbf7d..01eccd9 100644 --- a/templates/public/edit.html.twig +++ b/templates/public/edit.html.twig @@ -4,204 +4,219 @@ {% block body %} -
+
-
-
-

- {{ 'display.welcome'|trans }} - {% set main_tag = commerce.mainTag is defined and commerce.mainTag is not empty ? commerce.mainTag : (commerce_overpass.tags_converted.main_tag is defined ? commerce_overpass.tags_converted.main_tag : null) %} - {% if main_tag %} - {{ tag_emoji(main_tag) }} - {% endif %} - {{ commerce_overpass.tags_converted.name }} - {{ commerce.stats.name }} -

-
- {% include 'public/edit/address.html.twig' %} +
+
+

+ {{ 'display.welcome'|trans }} + {% set main_tag = commerce.mainTag is defined and commerce.mainTag is not empty ? commerce.mainTag : (commerce_overpass.tags_converted.main_tag is defined ? commerce_overpass.tags_converted.main_tag : null) %} + {% if main_tag %} + {{ tag_emoji(main_tag) }} + {% endif %} + {{ commerce_overpass.tags_converted.name }} - {{ commerce.stats.name }} +

+
- {% if commerce_overpass is not empty %} -
- + {% if commerce_overpass is not empty %} +
+    {% if commerce_overpass.tags_converted is defined %}
+        {{ commerce_overpass.tags_converted |json_encode }}
+    {% endif %}
+    
-
-
- -
-
- -
+ + {% include 'public/edit/address.html.twig' %} + + +
+
+
+
+ +
+
- -
-
-
- {% if commerce_overpass.tags_converted.image is defined and commerce_overpass.tags_converted.image|length > 0 %} - - {% endif %} - - - {% if commerce_overpass.tags_converted.image is defined and commerce_overpass.tags_converted.image|length > 0 %} - Image de la façade - {% endif %} - {{ commerce_overpass.tags_converted.image }} +
+
+
+ {% if commerce_overpass.tags_converted.image is defined and commerce_overpass.tags_converted.image|length > 0 %} + + {% endif %} + + + + {% if commerce_overpass.tags_converted.image is defined and commerce_overpass.tags_converted.image|length > 0 %} + Image de la façade + {% endif %} + {{ commerce_overpass.tags_converted.image }} {% if commerce_overpass.tags_converted.panoramax is defined or commerce_overpass.tags_converted.wikimedia_commons is defined %} - + url d'image sur Panoramax : {{ commerce_overpass.tags_converted.panoramax is defined ? commerce_overpass.tags_converted.panoramax : '' }} - + wikimedia_commons: - - {% endif %} -
- - - {% if commerce_overpass.tags_converted.amenity is defined and (commerce_overpass.tags_converted.amenity == 'restaurant' or commerce_overpass.tags_converted.amenity == 'bar' or commerce_overpass.tags_converted.amenity == 'cafe' or commerce_overpass.tags_converted.amenity == 'fast_food') %} - {% include 'public/edit/restaurant.html.twig' %} + {% endif %} +
- - {% if hide_filled_inputs and (commerce_overpass.tags_converted.opening_hours) is defined and commerce_overpass.tags_converted.opening_hours is empty %} - + {% if commerce_overpass.tags_converted.amenity is defined and (commerce_overpass.tags_converted.amenity == 'restaurant' or commerce_overpass.tags_converted.amenity == 'bar' or commerce_overpass.tags_converted.amenity == 'cafe' or commerce_overpass.tags_converted.amenity == 'fast_food') %} + {% include 'public/edit/restaurant.html.twig' %} + {% endif %} + + + + {% if hide_filled_inputs and (commerce_overpass.tags_converted.opening_hours) is defined and commerce_overpass.tags_converted.opening_hours is empty %} + opening_hours {{ 'display.already_filled'|trans }} - {% endif %} - {% include 'public/edit/opening_hours.html.twig' %} - {% include 'public/edit/clim.html.twig' %} - {% if hide_filled_inputs and (commerce_overpass.tags_converted.wheelchair) is defined and commerce_overpass.tags_converted.wheelchair is empty %} - + {% endif %} + {% include 'public/edit/opening_hours.html.twig' %} + + + {% include 'public/edit/clim.html.twig' %} + {% if hide_filled_inputs and (commerce_overpass.tags_converted.wheelchair) is defined and commerce_overpass.tags_converted.wheelchair is empty %} + {{ 'display.already_filled'|trans }} - - {% endif %} - {% include 'public/edit/wheelchair.html.twig' %} - - {% if hide_filled_inputs and (commerce_overpass.tags_converted.ask_angela) is defined and commerce_overpass.tags_converted.ask_angela is not empty %} - + + {% endif %} + {% include 'public/edit/wheelchair.html.twig' %} + + {% if hide_filled_inputs and (commerce_overpass.tags_converted.ask_angela) is defined and commerce_overpass.tags_converted.ask_angela is not empty %} + {{ 'display.already_filled'|trans }} - {% endif %} - {% include 'public/edit/ask_angela.html.twig' %} + {% endif %} + {% include 'public/edit/ask_angela.html.twig' %} -
- +
-
+ +
Téléphone - -
- -
- - {% include 'public/edit/social_media.html.twig' %} - - -
- {# {% include 'public/edit/tags.html.twig' with { 'excluded_tags_to_render': excluded_tags_to_render, - 'commerce_overpass': commerce_overpass, - 'hide_filled_inputs': hide_filled_inputs } %} - #} - {% include 'public/edit/tags.html.twig' with { 'excluded_tags_to_render': {}, - 'commerce_overpass': commerce_overpass, - 'hide_filled_inputs': hide_filled_inputs } %} - +
- -
-

Prévisualisation des tags OSM (texte à copier-coller)

- {% set tags_for_textarea = {} %} - {% for k, v in commerce_overpass.tags_converted %} - {% if v is not empty %} - {% set tags_for_textarea = tags_for_textarea|merge({ (k): v }) %} - {% endif %} - {% endfor %} - {% include 'public/_tags_textarea.html.twig' with { 'tags': tags_for_textarea } %} -
- -
-
- -
-
- - - {% endif %} -
+ + + + {% include 'public/edit/social_media.html.twig' %} + {% include 'public/edit/wheelchair.html.twig' %} + + {% include 'public/edit/tags.html.twig' %} + +
+

Prévisualisation des tags OSM (texte à copier-coller)

+ {% set tags_for_textarea = {} %} + {% for k, v in commerce_overpass.tags_converted %} + {% if v is not empty %} + {% set tags_for_textarea = tags_for_textarea|merge({ (k): v }) %} + {% endif %} + {% endfor %} + {% include 'public/_tags_textarea.html.twig' with { 'tags': tags_for_textarea } %} +
+ +
+
+ +
+
+ + + {% endif %}
-
-
-
- - - - {{ 'display.contact_humans'|trans }} - - - +
+
+
+
- -
+ + + {{ 'display.contact_humans'|trans }} + + + + +
+
- {{ 'display.last_modification'|trans }}: {{ commerce_overpass['@attributes'].timestamp }}, + {{ 'display.last_modification'|trans }}: {{ commerce_overpass['@attributes'].timestamp }}, {{ 'display.days_ago'|trans({'%days%': date(commerce_overpass['@attributes'].timestamp).diff(date()).days}) }} - {{ 'display.by'|trans }} - {{ commerce_overpass['@attributes'].user }} -
+ {{ 'display.by'|trans }} + {{ commerce_overpass['@attributes'].user }} +
+
{% if commerce.stats %} - - zone {{commerce.stats.zone}} + + zone {{ commerce.stats.zone }} {% endif %} - + Dashboard
@@ -212,116 +227,117 @@

-
+
- + {% endblock %} {% block completion_progress %} -
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
{% endblock %} {% block javascripts %} {{ parent() }} - - + + + {% endblock %} \ No newline at end of file diff --git a/templates/public/edit/address.html.twig b/templates/public/edit/address.html.twig index 53d5292..79f2c06 100644 --- a/templates/public/edit/address.html.twig +++ b/templates/public/edit/address.html.twig @@ -4,12 +4,12 @@ {# {{ dump(commerce_overpass)}} #}
- - + +
- +
\ No newline at end of file diff --git a/templates/public/edit/clim.html.twig b/templates/public/edit/clim.html.twig index d6a1602..74bd76b 100644 --- a/templates/public/edit/clim.html.twig +++ b/templates/public/edit/clim.html.twig @@ -1,22 +1,32 @@ -
-

- -

-
-
- - -
-
- - -
-
- - -
+
+

+ +

+
+
+ + +
+
+ + +
+
+ + +
\ No newline at end of file diff --git a/templates/public/edit/restaurant.html.twig b/templates/public/edit/restaurant.html.twig index 3d74f87..193166a 100644 --- a/templates/public/edit/restaurant.html.twig +++ b/templates/public/edit/restaurant.html.twig @@ -12,50 +12,50 @@
+ value="{% if commerce_overpass.tags_converted.cuisine is defined %}{{ commerce_overpass.tags_converted.cuisine }}{% endif %}"> {{'display.help.cuisine'|trans}}
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +