diff --git a/assets/edit.js b/assets/edit.js
index abc0d3c..75bed7e 100644
--- a/assets/edit.js
+++ b/assets/edit.js
@@ -4,13 +4,36 @@
* pour le formulaire de modification
*/
function updateCompletionProgress() {
- const inputs = document.querySelectorAll('input[type="text"]');
+ const inputs = document.querySelectorAll('input[data-important]');
let filledInputs = 0;
let totalInputs = inputs.length;
+ let missingFields = [];
inputs.forEach(input => {
if (input.value.trim() !== '') {
filledInputs++;
+ } else {
+ // Get the field label or name for display in the popup
+ let fieldName = '';
+ const label = input.closest('.row')?.querySelector('.form-label, .label-translated');
+ if (label) {
+ fieldName = label.textContent.trim();
+ } else {
+ // If no label found, try to get a meaningful name from the input
+ const name = input.getAttribute('name');
+ if (name) {
+ // Extract field name from the attribute (e.g., commerce_tag_value__contact:email -> Email)
+ const parts = name.split('__');
+ if (parts.length > 1) {
+ fieldName = parts[1].replace('commerce_tag_value_', '').replace('contact:', '');
+ // Capitalize first letter
+ fieldName = fieldName.charAt(0).toUpperCase() + fieldName.slice(1);
+ } else {
+ fieldName = name;
+ }
+ }
+ }
+ missingFields.push(fieldName || input.getAttribute('name') || 'Champ inconnu');
}
});
@@ -19,7 +42,64 @@ function updateCompletionProgress() {
if (progressBar) {
progressBar.style.width = completionPercentage + '%';
progressBar.setAttribute('aria-valuenow', completionPercentage);
- document.querySelector('#completion_display').innerHTML = `Votre commerce est complété à ${Math.round(completionPercentage)}%`;
+
+ // Create the completion display with a clickable question mark
+ const displayElement = document.querySelector('#completion_display');
+
+ // Format missing fields as an HTML list for better readability
+ let missingFieldsContent = '';
+ if (missingFields.length > 0) {
+ missingFieldsContent = '
';
+ // Filter out empty or undefined field names and sort them alphabetically
+ missingFields
+ .filter(field => field && field.trim() !== '')
+ .sort()
+ .forEach(field => {
+ missingFieldsContent += `
${field}
`;
+ });
+ missingFieldsContent += '
';
+ } else {
+ missingFieldsContent = 'Tous les champs importants sont remplis !';
+ }
+
+ displayElement.innerHTML = `Votre commerce est complété à ${Math.round(completionPercentage)}% ?`;
+
+ // Initialize the Bootstrap popover
+ const popoverTrigger = displayElement.querySelector('.missing-fields-info');
+ if (popoverTrigger) {
+ // Add click handler to focus on the first missing field
+ popoverTrigger.addEventListener('click', function(e) {
+ e.preventDefault(); // Prevent scrolling to top
+
+ // Find the first missing field
+ const missingInput = document.querySelector('input[data-important]:not(.good_filled)');
+ if (missingInput) {
+ // Focus on the first missing field
+ missingInput.focus();
+ // Scroll to the field if needed
+ missingInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
+ }
+ });
+
+ // Use setTimeout to ensure this runs after the current execution context
+ setTimeout(() => {
+ if (typeof bootstrap !== 'undefined' && bootstrap.Popover) {
+ // Destroy existing popover if any
+ const existingPopover = bootstrap.Popover.getInstance(popoverTrigger);
+ if (existingPopover) {
+ existingPopover.dispose();
+ }
+ // Initialize new popover
+ new bootstrap.Popover(popoverTrigger, {
+ html: true,
+ trigger: 'click',
+ container: 'body'
+ });
+ } else {
+ console.warn('Bootstrap popover not available');
+ }
+ }, 0);
+ }
}
}
@@ -43,4 +123,4 @@ function parseCuisine() {
}
window.updateCompletionProgress = updateCompletionProgress;
-window.parseCuisine = parseCuisine;
\ No newline at end of file
+window.parseCuisine = parseCuisine;
diff --git a/assets/styles/app.css b/assets/styles/app.css
index 09f609b..bc76a06 100644
--- a/assets/styles/app.css
+++ b/assets/styles/app.css
@@ -18,13 +18,22 @@ body {
#qrcode {
margin-bottom: 8rem;
}
-
-.filled {
- background-color: rgba(0, 255, 0, 0.2) !important;
+input[data-important]{
+ border-color: #7a8fbb ;
+ border-left-width: 5px ;
}
-.filled:hover {
- background-color: #8abb7a !important;
+input[data-important]:before{
+ content : ">" !important ;
+}
+
+.filled, .good_filled {
+ border-color: rgba(0, 255, 0, 0.8) !important;
+ color: #082b0a !important;
+}
+
+.filled:hover , .good_filled:hover {
+ background-color: #d9ffd1 !important;
}
.no-name {
diff --git a/src/Controller/PublicController.php b/src/Controller/PublicController.php
index 3de52d3..66eceb1 100644
--- a/src/Controller/PublicController.php
+++ b/src/Controller/PublicController.php
@@ -319,7 +319,11 @@ class PublicController extends AbstractController
$osm_kind = $request->request->get('osm_kind', 'node');
// Récupérer tous les tags du formulaire
$tags = [];
- $request_post = $request->request->all();
+ $request_post = $request->request->all();
+
+ var_dump($request_post);
+
+
$request_post = $this->motocultrice->map_post_values($request_post);
$request_post = $request_post ?? [];
// Log temporaire pour debug POST
@@ -343,6 +347,11 @@ class PublicController extends AbstractController
// Récupérer le token OSM depuis les variables d'environnement
$osm_api_token = $_ENV['APP_OSM_BEARER'];
+
+ var_dump($tags_after_modif);
+ die("tosssp");
+
+
try {
$client = new Client();
diff --git a/src/Service/Motocultrice.php b/src/Service/Motocultrice.php
index 66e7add..912d670 100644
--- a/src/Service/Motocultrice.php
+++ b/src/Service/Motocultrice.php
@@ -27,6 +27,10 @@ class Motocultrice
'harassment_prevention',
'image',
'panoramax',
+ 'opening_hours',
+ 'email',
+ 'contact:email',
+ 'contact:mastodon',
];
// les tags OSM que l'on estime nécessaires pour un commerce
public $base_tags = [
diff --git a/templates/public/edit.html.twig b/templates/public/edit.html.twig
index 52a0cc0..6b1946f 100644
--- a/templates/public/edit.html.twig
+++ b/templates/public/edit.html.twig
@@ -12,7 +12,7 @@
@@ -38,6 +38,7 @@
@@ -49,18 +50,56 @@
-
-
- Téléphone
+
+
+ Téléphone
-
+
+
+
+ {% include 'public/edit/opening_hours.html.twig' %}
+
+
{% if commerce_overpass.tags_converted.image is defined and commerce_overpass.tags_converted.image|length > 0 %}
{% endif %}
- {% include 'public/edit/opening_hours.html.twig' %}
{% include 'public/edit/clim.html.twig' %}
@@ -192,8 +230,8 @@
class="btn btn-outline-secondary">
{{ 'display.view_on_osm'|trans }}
-{# #}
+ {# #}
\ No newline at end of file
diff --git a/templates/public/edit/opening_hours.html.twig b/templates/public/edit/opening_hours.html.twig
index d860204..7aede30 100644
--- a/templates/public/edit/opening_hours.html.twig
+++ b/templates/public/edit/opening_hours.html.twig
@@ -1,24 +1,26 @@
-
-
- {{ 'display.opening_hours'|trans }}
+
+
+ {{ 'display.opening_hours'|trans }}
{{ 'display.opening_hours_description'|trans }}
- {% if commerce_overpass.tags_converted.opening_hours is defined and commerce_overpass.tags_converted.opening_hours != '' %}
-
+ {% if commerce_overpass.tags_converted.opening_hours is defined and commerce_overpass.tags_converted.opening_hours != '' %}
+
{% else %}
-
+
{% endif %}
-
+
\ No newline at end of file
diff --git a/templates/public/edit/tags.html.twig b/templates/public/edit/tags.html.twig
index 31a7338..6902b93 100644
--- a/templates/public/edit/tags.html.twig
+++ b/templates/public/edit/tags.html.twig
@@ -27,7 +27,7 @@
{% endif %}
- {# {% if k not in excluded_tags_to_render %} #}
+ {% if k not in excluded_tags_to_render %}