annuler sortie admin
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Entity\Participant;
|
||||
use App\Entity\PasswordResetToken;
|
||||
use App\Entity\Site;
|
||||
use App\Entity\Ville;
|
||||
use App\Repository\EtatRepository;
|
||||
use App\Repository\ParticipantRepository;
|
||||
use App\Repository\SiteRepository;
|
||||
use App\Repository\SortieRepository;
|
||||
@@ -400,4 +401,17 @@ class AdminController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/admin/sortie/annuler/{id}', name: 'app_adminSortieAnnuler')]
|
||||
public function sortieAnuler(String $id, EntityManagerInterface $entityManager,
|
||||
SortieRepository $sortieRepository, EtatRepository $etatRepository): Response
|
||||
{
|
||||
$etat = $etatRepository->findOneBy(["libelle" => "Annulée"]);
|
||||
$sortie = $sortieRepository->find($id);
|
||||
$sortie->setEtat($etat);
|
||||
$entityManager->persist($sortie);
|
||||
$entityManager->flush();
|
||||
$this->addFlash('success', "La sortie a bien été annuler");
|
||||
return $this->redirectToRoute('app_adminSortie');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,17 +40,11 @@
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.site.nom }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.lieu.nom }}</td>
|
||||
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.etat.libelle }}</td>
|
||||
<td class="flex flex-row px-6 py-4 whitespace-nowrap items-center font-medium">
|
||||
{# {% if not sortie.etat %}
|
||||
|
||||
{% endif %}
|
||||
<a href="{{ path('app_adminUserDisable', {'id': participant.idParticipant}) }}" class="items-centerp pr-4">
|
||||
<img src="{{ participant.actif ? asset('img/user-able.svg') : asset('img/user-disable.svg') }}" alt="Logo" height="32px" width="32px">
|
||||
</a>
|
||||
<a href="{{ path('app_adminUserDelete', {'id': participant.idParticipant}) }}" class="items-center">
|
||||
<img src="{{ asset('img/user-delete.svg') }}" alt="Logo" height="32px" width="32px">
|
||||
</a> #}
|
||||
{% if sortie.etat.libelle != 'Annulée' and sortie.etat.libelle != 'Terminée' %}
|
||||
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
||||
<a href="{{ path('app_adminSortieAnnuler', {'id': sortie.idSortie}) }}" class="text-red-600 hover:text-red-900 ml-4">Annuler</a>
|
||||
</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
|
||||
Reference in New Issue
Block a user