mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
up handle overrides with edit questions
This commit is contained in:
parent
de64feb549
commit
5d9bb8b5e6
28 changed files with 6390 additions and 62 deletions
|
@ -9,6 +9,24 @@
|
|||
<!-- JavaScript Bootstrap avec Popper.js -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
|
||||
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
|
||||
<style>
|
||||
.body-landing {
|
||||
background-color:rgb(255, 255, 255);
|
||||
min-height: 50vh;
|
||||
}
|
||||
table td{
|
||||
padding: 1rem;
|
||||
}
|
||||
table, thead, tbody, tr{
|
||||
width: 100%;
|
||||
}
|
||||
table tr:nth-child(odd){
|
||||
background-color:rgb(235, 235, 235);
|
||||
}
|
||||
table tr:nth-child(even){
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
</style>
|
||||
{% block stylesheets %}
|
||||
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
|
|
|
@ -13,6 +13,12 @@
|
|||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
.is-invalid {
|
||||
border: 1px solid red;
|
||||
}
|
||||
.is-invalid #validation_messages {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -64,32 +70,20 @@
|
|||
<label for="commerce_tag_value__name">{{'display.keys.name'|trans}}</label>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<input type="text" class="form-control" name="commerce_tag_value__name" value=" {% if commerce.tags_converted.name is defined %}{{ commerce.tags_converted.name }}{% endif %}">
|
||||
<input type="text" class="form-control" name="commerce_tag_value__name" value=" {% if commerce.tags_converted.name is defined %}{{ commerce.tags_converted.name }}{% elseif commerce_overpass['@attributes'].name is defined %}{{ commerce_overpass['@attributes'].name }}{% endif %}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# cas d'une mairie
|
||||
#}
|
||||
|
||||
{# {% if commerce.tags_converted.amenity is defined %}
|
||||
{% if commerce.tags_converted.amenity == 'townhall' %}
|
||||
{% include 'public/edit/townhall.html.twig' %}
|
||||
{% endif %}
|
||||
|
||||
{% if commerce.tags_converted.amenity == 'restaurant' %}
|
||||
{% include 'public/edit/restaurant.html.twig' %}
|
||||
{% endif %}
|
||||
{% endif %} #}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% include 'public/edit/ask_angela.html.twig' %}
|
||||
{# {# {% include 'public/edit/wheelchair.html.twig' %} #}
|
||||
{# {% include 'public/edit/opening_hours.html.twig' %}
|
||||
{% include 'public/edit/address.html.twig' %} #} #}
|
||||
{% include 'public/edit/wheelchair.html.twig' %}
|
||||
{% include 'public/edit/opening_hours.html.twig' %}
|
||||
{% include 'public/edit/address.html.twig' %}
|
||||
{% include 'public/edit/tags.html.twig' %}
|
||||
|
||||
<div id="validation_messages"></div>
|
||||
<button type="submit" class="btn btn-primary">{{ 'display.submit'|trans }}</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
@ -107,7 +101,6 @@
|
|||
<a href="https://www.openstreetmap.org/node/{{ commerce_overpass['@attributes'].id }}" target="_blank">{{ 'display.view_on_osm'|trans }}</a>
|
||||
</div>
|
||||
|
||||
{# {{ dump(commerce_overpass) }} #}
|
||||
</span>
|
||||
|
||||
<div class="disclaimer p-3">
|
||||
|
@ -138,7 +131,50 @@
|
|||
{{ parent() }}
|
||||
<script src='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.js'></script>
|
||||
<script>
|
||||
{% if commerce is not empty and mapbox_token is not empty and maptiler_token is not empty %}
|
||||
|
||||
// Validation du formulaire avant envoi
|
||||
document.querySelector('form').addEventListener('submit', function(e) {
|
||||
let errors = [];
|
||||
// Réinitialiser les classes d'erreur
|
||||
document.querySelectorAll('.is-invalid').forEach(input => {
|
||||
input.classList.remove('is-invalid');
|
||||
});
|
||||
|
||||
// Vérification du nom
|
||||
const nameInput = document.querySelector('input[name="commerce_tag_value__name"]');
|
||||
if (!nameInput.value.trim()) {
|
||||
errors.push("Le nom de l'établissement est obligatoire");
|
||||
nameInput.classList.add('is-invalid');
|
||||
}
|
||||
|
||||
// Vérification de l'email
|
||||
const emailInput = document.querySelector('input[name="commerce_tag_value__contact:email"]');
|
||||
if (emailInput && emailInput.value) {
|
||||
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
||||
if (!emailRegex.test(emailInput.value)) {
|
||||
errors.push("L'adresse email n'est pas valide");
|
||||
emailInput.classList.add('is-invalid');
|
||||
}
|
||||
}
|
||||
|
||||
// Vérification du téléphone
|
||||
const phoneInput = document.querySelector('input[name="commerce_tag_value__contact:phone"]');
|
||||
if (phoneInput && phoneInput.value) {
|
||||
const phoneRegex = /^(\+33|0)[1-9](\d{2}){4}$/;
|
||||
if (!phoneRegex.test(phoneInput.value.replace(/\s/g, ''))) {
|
||||
errors.push("Le numéro de téléphone n'est pas valide");
|
||||
phoneInput.classList.add('is-invalid');
|
||||
}
|
||||
}
|
||||
|
||||
// Affichage des erreurs si présentes
|
||||
if (errors.length > 0) {
|
||||
e.preventDefault();
|
||||
document.querySelector('#validation_messages').innerHTML = errors.join('<br>');
|
||||
document.querySelector('#validation_messages').classList.add('is-invalid');
|
||||
}
|
||||
});
|
||||
{% if commerce is not empty and mapbox_token is not empty and maptiler_token is not empty and commerce_overpass['@attributes'].lon is defined and commerce_overpass['@attributes'].lat is defined %}
|
||||
mapboxgl.accessToken = '{{ mapbox_token }}';
|
||||
map = new mapboxgl.Map({
|
||||
container: 'map',
|
||||
|
|
|
@ -9,9 +9,25 @@
|
|||
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-5">
|
||||
<label for="commerce_tag_value__angela">{{'display.ask_angela'|trans}}</label>
|
||||
<label for="custom__ask_angela">{{'display.ask_angela'|trans}}</label>
|
||||
{% if commerce_overpass.tags_converted.harassment_prevention is defined %}
|
||||
{{ dump(commerce_overpass.tags_converted.harassment_prevention) }}
|
||||
{% endif %}
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="custom__ask_angela" id="ask_angela_yes" value="ask_angela" {% if commerce_overpass.tags_converted.harassment_prevention is defined and commerce_overpass.tags_converted.harassment_prevention == 'ask_angela' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="ask_angela_yes">
|
||||
{{ 'display.ask_angela_yes'|trans }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="custom__ask_angela" id="ask_angela_no" value="" {% if commerce_overpass.tags_converted.harassment_prevention is not defined or commerce_overpass.tags_converted.harassment_prevention == 'no' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="ask_angela_no">
|
||||
{{ 'display.ask_angela_no'|trans }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" name="commerce_tag_value__angela" value="yes">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% if commerce_overpass.tags_converted.opening_hours is defined %}
|
||||
{{ dump(commerce_overpass.tags_converted.opening_hours) }}
|
||||
{% else %}
|
||||
<input type="text" name="commerce_tag_value__opening_hours" value="">
|
||||
<input type="text" name="custom__opening_hours" value="">
|
||||
<br> ajoutez les horaires au format OSM
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="col-md-5">
|
||||
<input type="text" class="form-control" name="commerce_tag_value__{{ k }}" value="{{ v }}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
|
|
@ -1,15 +1,31 @@
|
|||
<div id="wheelchair">
|
||||
<h2>{{ 'display.wheelchair'|trans }}</h2>
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-5">
|
||||
<label for="commerce_tag_value__wheelchair">{{'display.keys.wheelchair'|trans}}</label>
|
||||
|
||||
<select class="form-control" placeholder="{{'display.please_select'|trans}}" name="commerce_tag_value__wheelchair" value="{% if commerce.tags_converted.wheelchair is defined %}{{ commerce.tags_converted.wheelchair }}{% endif %}">
|
||||
<option value="">{{'display.please_select'|trans}}</option>
|
||||
<option value="yes">{{'display.values.wheelchair.yes'|trans}}</option>
|
||||
<option value="limited">{{'display.values.wheelchair.limited'|trans}}</option>
|
||||
<option value="no">{{'display.values.wheelchair.no'|trans}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<h2>{{ 'display.wheelchair'|trans }}</h2>
|
||||
<div class="row mb-3 p-4">
|
||||
<div class="col-md-5">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="commerce_tag_value__wheelchair" id="wheelchair_empty" value="" {% if commerce_overpass.tags_converted.wheelchair is not defined or commerce_overpass.tags_converted.wheelchair == '' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="wheelchair_empty">
|
||||
{{'display.please_select'|trans}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="commerce_tag_value__wheelchair" id="wheelchair_yes" value="yes" {% if commerce_overpass.tags_converted.wheelchair is defined and commerce_overpass.tags_converted.wheelchair == 'yes' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="wheelchair_yes">
|
||||
{{'display.values.wheelchair.yes'|trans}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="commerce_tag_value__wheelchair" id="wheelchair_limited" value="limited" {% if commerce_overpass.tags_converted.wheelchair is defined and commerce_overpass.tags_converted.wheelchair == 'limited' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="wheelchair_limited">
|
||||
{{'display.values.wheelchair.limited'|trans}}
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="radio" name="commerce_tag_value__wheelchair" id="wheelchair_no" value="no" {% if commerce_overpass.tags_converted.wheelchair is defined and commerce_overpass.tags_converted.wheelchair == 'no' %}checked{% endif %}>
|
||||
<label class="form-check-label" for="wheelchair_no">
|
||||
{{'display.values.wheelchair.no'|trans}}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -9,29 +9,28 @@
|
|||
|
||||
{% block body %}
|
||||
<div class="container">
|
||||
<h1>Hello {{ commerce.tags_converted.name }}!</h1>
|
||||
<h1>Modification du lieu {{ commerce.tags_converted.name }}!</h1>
|
||||
|
||||
<h2>Modification du commerce</h2>
|
||||
{% if status == "Les tags ont été mis à jour avec succès" %}
|
||||
<span class="badge bg-success p-4">{{status}}</span>
|
||||
{% if status == "Les tags ont été mis à jour avec succès" %}
|
||||
<span class="badge bg-success p-4">{{status}}</span>
|
||||
|
||||
<p class="p-4">
|
||||
Merci d'avoir contribué à l'amélioration de la base de données OSM, votre contribution sera visible sur de nombreux sites web.
|
||||
<p class="p-4">
|
||||
Merci d'avoir contribué à l'amélioration de la base de données OSM, votre contribution sera visible sur de nombreux sites web.
|
||||
|
||||
<br>
|
||||
Modifer votre commerce?
|
||||
Réutilisez le lien secret que vous avez reçu par email.
|
||||
|
||||
<br>
|
||||
|
||||
Envie de contribuer ailleurs ?
|
||||
Créez votre propre compte OpenStreetMap sur <a href="https://osm.org" >osm.org</a>, et venez discuter avec les autres contributeurs sur le forum de la communauté OSM sur <a href="https://forum.openstreetmap.fr" target="_blank">forum.openstreetmap.fr</a>.
|
||||
</p>
|
||||
{% else %}
|
||||
<span class="badge bg-danger p-4">{{status}}</span>
|
||||
{% endif %}
|
||||
<br>
|
||||
Modifer votre commerce?
|
||||
Réutilisez le lien secret que vous avez reçu par email.
|
||||
|
||||
<br>
|
||||
|
||||
Envie de contribuer ailleurs ?
|
||||
Créez votre propre compte OpenStreetMap sur <a href="https://osm.org" >osm.org</a>, et venez discuter avec les autres contributeurs sur le forum de la communauté OSM sur <a href="https://forum.openstreetmap.fr" target="_blank">forum.openstreetmap.fr</a>.
|
||||
</p>
|
||||
{% else %}
|
||||
<span class="badge bg-danger p-4">{{status}}</span>
|
||||
{% endif %}
|
||||
<br>
|
||||
<a href="{{ path('app_public_index') }}">Retour à la page d'accueil</a>
|
||||
<a href="{{ path('app_public_index') }}">Retour à la page d'accueil</a>
|
||||
</div>
|
||||
{# <h2>Tags</h2> #}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue