diff --git a/src/Controller/OrganizationController.php b/src/Controller/OrganizationController.php
index c17216e..7c8d862 100644
--- a/src/Controller/OrganizationController.php
+++ b/src/Controller/OrganizationController.php
@@ -199,4 +199,25 @@ class OrganizationController extends AbstractController
return $this->redirectToRoute('organization_index');
}
+ #[Route('/activate/{id}', name: 'activate', requirements: ['id' => '\d+'], methods: ['GET', 'POST'])]
+ public function activate(Request $request): Response
+ {
+ $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');
+ $id = $request->attributes->get('id');
+ $organization = $this->entityManager->getRepository(Organizations::class)->find($id);
+ if (!$organization) {
+ throw $this->createNotFoundException(self::NOT_FOUND);
+ }
+ if ($organization->isActive() === true) {
+ $this->addFlash('error', 'Organization is already active');
+ return $this->redirectToRoute('organization_index');
+ }
+
+ $organization->setIsActive(true);
+ $this->entityManager->persist($organization);
+ $this->entityManager->flush();
+ $this->addFlash('success', 'Organization activated successfully');
+ return $this->redirectToRoute('organization_index');
+ }
+
}
diff --git a/templates/organization/show.html.twig b/templates/organization/show.html.twig
index 920ceef..bf041c0 100644
--- a/templates/organization/show.html.twig
+++ b/templates/organization/show.html.twig
@@ -10,9 +10,15 @@
{% endif %}
{{ organization.name|title }} - Dashboard
{% if is_granted("ROLE_SUPER_ADMIN") %}
- Gérer l'organisation
- Désactiver l'organisation
+ Gérer
+ l'organisation
+ {% if organization.active %}
+ Désactiver l'organisation
+ {% else %}
+ Activer l'organisation
+ {% endif %}
{% elseif is_granted("ROLE_ADMIN") %}
Gérer mon
organisation