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
|
@ -347,4 +347,34 @@ class PublicController extends AbstractController
|
|||
'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
|
||||
]);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue