mirror of
https://forge.chapril.org/tykayn/osm-commerces
synced 2025-06-20 01:44:42 +02:00
action close commerce et listing
This commit is contained in:
parent
14f28ef405
commit
268ac799e4
6 changed files with 97 additions and 2 deletions
|
@ -49,6 +49,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
const btnClosedCommerce = document.querySelector('#closedCommerce');
|
||||||
|
if (btnClosedCommerce) {
|
||||||
|
btnClosedCommerce.addEventListener('click', () => {
|
||||||
|
|
||||||
|
if (!confirm('Êtes-vous sûr de vouloir signaler ce commerce comme fermé ?')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.location.href = '/closed_commerce/' + document.getElementById('app_public_closed_commerce').value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -347,4 +347,34 @@ class PublicController extends AbstractController
|
||||||
'commerce_id' => $osm_object_id,
|
'commerce_id' => $osm_object_id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#route pour signaler que le commerce est fermé
|
||||||
|
#[Route('/closed_commerce/{osm_object_id}', name: 'app_public_closed_commerce')]
|
||||||
|
public function closed_commerce($osm_object_id): Response
|
||||||
|
{
|
||||||
|
$place = $this->entityManager->getRepository(Place::class)->findOneBy(['osm_id' => $osm_object_id]);
|
||||||
|
if (!$place) {
|
||||||
|
$this->addFlash('warning', 'Ce commerce n\'existe pas.');
|
||||||
|
return $this->redirectToRoute('app_public_index');
|
||||||
|
}
|
||||||
|
|
||||||
|
$place->setClosed(true);
|
||||||
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return $this->render('public/closed_commerce.html.twig', [
|
||||||
|
'controller_name' => 'PublicController',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Route('/closed_commerces', name: 'app_public_closed_commerces')]
|
||||||
|
public function closedCommerces(): Response
|
||||||
|
{
|
||||||
|
// Récupérer tous les commerces marqués comme fermés
|
||||||
|
$closedPlaces = $this->entityManager->getRepository(Place::class)->findBy(['dead' => true]);
|
||||||
|
|
||||||
|
return $this->render('public/closed_commerces.html.twig', [
|
||||||
|
'controller_name' => 'PublicController',
|
||||||
|
'closed_places' => $closedPlaces
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
48
templates/public/closed_commerces.html.twig
Normal file
48
templates/public/closed_commerces.html.twig
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
|
||||||
|
{% extends 'base.html.twig' %}
|
||||||
|
|
||||||
|
{% block title %}{{ 'display.title'|trans }} - accueil{% endblock %}
|
||||||
|
|
||||||
|
{% block stylesheets %}
|
||||||
|
{{ parent() }}
|
||||||
|
<link href='https://api.mapbox.com/mapbox-gl-js/v2.15.0/mapbox-gl.css' rel='stylesheet' />
|
||||||
|
<style>
|
||||||
|
.hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="container mt-4">
|
||||||
|
<h1>Commerces fermés</h1>
|
||||||
|
<p>Voici la liste des commerces fermés :</p>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Nom du commerce</th>
|
||||||
|
<th>Code postal</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for place in closed_places %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
|
||||||
|
{{ place.name }}
|
||||||
|
|
||||||
|
</td>
|
||||||
|
<td>{{ place.zipCode }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% if closed_places|length == 0 %}
|
||||||
|
<p>Aucun commerce fermé trouvé.</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -184,7 +184,7 @@
|
||||||
container: 'map',
|
container: 'map',
|
||||||
style: 'https://api.maptiler.com/maps/basic-v2/style.json?key={{ maptiler_token }}',
|
style: 'https://api.maptiler.com/maps/basic-v2/style.json?key={{ maptiler_token }}',
|
||||||
center: [{{ commerce_overpass['@attributes'].lon }}, {{ commerce_overpass['@attributes'].lat }}],
|
center: [{{ commerce_overpass['@attributes'].lon }}, {{ commerce_overpass['@attributes'].lat }}],
|
||||||
zoom: 14
|
zoom: 17
|
||||||
});
|
});
|
||||||
|
|
||||||
new mapboxgl.Marker()
|
new mapboxgl.Marker()
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
<i class="bi bi-envelope-fill"></i>
|
<i class="bi bi-envelope-fill"></i>
|
||||||
{{ 'display.contact_humans'|trans }}</a>
|
{{ 'display.contact_humans'|trans }}</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ path('app_public_closed_commerces') }}">
|
||||||
|
<i class="bi bi-x-circle-fill"></i>
|
||||||
|
{{ 'display.closed_commerces'|trans }}</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -24,6 +24,8 @@ display:
|
||||||
opening_hours_description: "De bons horaires d'ouverture sont importants pour que les clients puissent vous trouver."
|
opening_hours_description: "De bons horaires d'ouverture sont importants pour que les clients puissent vous trouver."
|
||||||
ask_angela_yes: "Oui"
|
ask_angela_yes: "Oui"
|
||||||
ask_angela_no: "Non"
|
ask_angela_no: "Non"
|
||||||
|
closed_commerces: "Commerces fermés"
|
||||||
|
|
||||||
values:
|
values:
|
||||||
wheelchair:
|
wheelchair:
|
||||||
yes: "le lieu est totalement praticable en fauteuil roulant"
|
yes: "le lieu est totalement praticable en fauteuil roulant"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue