annuler sortie admin

This commit is contained in:
jleroy2023
2024-11-25 14:33:47 +01:00
parent 2d7e15573d
commit 3439e51948
2 changed files with 19 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ use App\Entity\Participant;
use App\Entity\PasswordResetToken; use App\Entity\PasswordResetToken;
use App\Entity\Site; use App\Entity\Site;
use App\Entity\Ville; use App\Entity\Ville;
use App\Repository\EtatRepository;
use App\Repository\ParticipantRepository; use App\Repository\ParticipantRepository;
use App\Repository\SiteRepository; use App\Repository\SiteRepository;
use App\Repository\SortieRepository; 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');
}
} }

View File

@@ -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.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.lieu.nom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ sortie.etat.libelle }}</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 sortie.etat.libelle != 'Annulée' and sortie.etat.libelle != 'Terminée' %}
{# {% if not sortie.etat %} <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>
{% endif %} </td>
<a href="{{ path('app_adminUserDisable', {'id': participant.idParticipant}) }}" class="items-centerp pr-4"> {% endif %}
<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> #}
</td>
</tr> </tr>
{% else %} {% else %}
<tr> <tr>