This commit is contained in:
jleroy2023
2024-11-20 16:02:32 +01:00
parent 0ff9ac68b2
commit 110cca48a1
3 changed files with 11 additions and 5 deletions

View File

@@ -25,6 +25,10 @@ use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
class AdminController extends AbstractController class AdminController extends AbstractController
{ {
private ParticipantRepository $participantRepository;
public function __construct(ParticipantRepository $participantRepository){
$this->participantRepository = $participantRepository;
}
#[Route('/admin', name: 'app_admin')] #[Route('/admin', name: 'app_admin')]
public function index(TokenStorageInterface $tokenStorage): Response public function index(TokenStorageInterface $tokenStorage): Response
{ {
@@ -38,13 +42,14 @@ class AdminController extends AbstractController
//Gestion des utilisateurs //Gestion des utilisateurs
#[Route('/admin/user', name: 'app_adminUser')] #[Route('/admin/user', name: 'app_adminUser')]
public function adminUser(ParticipantRepository $participantRepository, TokenStorageInterface $tokenStorage): Response public function adminUser(TokenStorageInterface $tokenStorage): Response
{ {
$token = $tokenStorage->getToken(); $token = $tokenStorage->getToken();
$userConnect = $token?->getUser(); $userConnect = $token?->getUser();
$participants = $this->participantRepository->findAll();
return $this->render('admin/user.html.twig', [ return $this->render('admin/user.html.twig', [
'profile' => $userConnect, 'profile' => $userConnect,
'participants' => $participantRepository->getAll(), 'participants' => $participants,
'controller_name' => 'AdminController', 'controller_name' => 'AdminController',
]); ]);
} }

View File

@@ -37,8 +37,8 @@ class ParticipantRepository extends ServiceEntityRepository
public function getAll(): Paginator public function getAll(): Paginator
{ {
$qb = $this->createQueryBuilder('p') $qb = $this->createQueryBuilder('p')
->addSelect('s') ->addSelect('site')
->leftJoin('p.site', 's') ->leftJoin('p.site', 'site')
->getQuery(); ->getQuery();
return new Paginator($qb); return new Paginator($qb);
} }

View File

@@ -65,7 +65,7 @@
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.nom }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.nom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.prenom }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.prenom }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.pseudo }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.pseudo }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.site.nom }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.site ? participant.site.nom : "N/A" }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.telephone }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.telephone }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.email }}</td> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">{{ participant.email }}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900"> <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
@@ -93,6 +93,7 @@
</tbody> </tbody>
</table> </table>
</div> </div>
{# Tableau user en attente #} {# Tableau user en attente #}
<div class="overflow-x-auto bg-white rounded shadow mt-16"> <div class="overflow-x-auto bg-white rounded shadow mt-16">
<table class="min-w-full bg-white divide-y divide-gray-200"> <table class="min-w-full bg-white divide-y divide-gray-200">