From 49eb1c61ced983e6c4236132146919cedfed5969 Mon Sep 17 00:00:00 2001 From: Raphael Date: Wed, 7 May 2025 23:59:48 +0200 Subject: [PATCH 1/5] feature/move-inscription-page-to-sf : WIP --- app/config/config.yml | 3 + app/config/routing/admin_event.yml | 4 + .../Admin/Event/Inscription/ListAction.php | 153 ++++++++++ .../Model/Repository/TicketRepository.php | 59 ++++ templates/event/inscription/list.html.twig | 287 ++++++++++++++++++ 5 files changed, 506 insertions(+) create mode 100644 sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php create mode 100644 templates/event/inscription/list.html.twig diff --git a/app/config/config.yml b/app/config/config.yml index f8aa39499..d461c82dd 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -128,6 +128,9 @@ parameters: forum_inscriptions: nom: 'Inscriptions' niveau: 'ROLE_FORUM' + url: '/admin/event/inscription' + extra_routes: + - admin_event_inscription_list forum_pending_bankwires: nom: 'Virements en attente' niveau: 'ROLE_ADMIN' diff --git a/app/config/routing/admin_event.yml b/app/config/routing/admin_event.yml index 3591d2186..84d1787a7 100644 --- a/app/config/routing/admin_event.yml +++ b/app/config/routing/admin_event.yml @@ -109,3 +109,7 @@ admin_event_restore: admin_event_votes: path: /votes defaults: {_controller: AppBundle\Controller\Admin\Event\VotesListeAction} + +admin_event_inscription_list: + path: /inscription + defaults: { _controller: AppBundle\Controller\Admin\Event\Inscription\ListAction} diff --git a/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php b/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php new file mode 100644 index 000000000..8050a757f --- /dev/null +++ b/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php @@ -0,0 +1,153 @@ +query->get('id'); + $direction = $request->query->get('direction'); + $sort = $request->query->get('sort'); + $filter = $request->query->get('filter'); + + $event = $id ? $eventActionHelper->getEventById($id) : $eventRepository->getLastEvent(); + + $membersTicket = []; + + $restantes = $this->updateGlobalsForTarif($eventRepository, $ticketEventTypeRepository, $ticketTypeAvailability, $event->getId(), $membersTicket)['restantes']; + + $stats = $eventStatsRepository->getStats($event->getId()); + + return $this->render('event/inscription/list.html.twig', [ + 'filter' => $filter, + 'direction' => $direction, + 'sort' => $sort, + 'forumTarifsMembers' => $membersTicket, + 'now' => new DateTime(), + 'inscriptions' => $ticketRepository->getTicketsForList($event, $filter, $sort, $direction), + 'restantes' => $restantes, + 'statistiques' => [ + 'premier_jour' => [ + 'inscrits' => $stats->firstDay->registered, + 'confirmes' => $stats->firstDay->confirmed, + 'en_attente_de_reglement' => $stats->firstDay->pending, + ], + 'second_jour' => [ + 'inscrits' => $stats->secondDay->registered, + 'confirmes' => $stats->secondDay->confirmed, + 'en_attente_de_reglement' => $stats->secondDay->pending, + ], + 'types_inscriptions' => [ + 'confirmes' => $stats->ticketType->confirmed, + 'inscrits' => $stats->ticketType->registered, + 'payants' => $stats->ticketType->paying, + ], + ], + 'forumTarifsLib' => [ + AFUP_FORUM_INVITATION => 'Invitation', + AFUP_FORUM_ORGANISATION => 'Organisation', + AFUP_FORUM_PROJET => 'Projet PHP', + AFUP_FORUM_SPONSOR => 'Sponsor', + AFUP_FORUM_PRESSE => 'Presse', + AFUP_FORUM_PROF => 'Enseignement supérieur', + AFUP_FORUM_CONFERENCIER => 'Conferencier', + AFUP_FORUM_PREMIERE_JOURNEE => 'Jour 1 ', + AFUP_FORUM_DEUXIEME_JOURNEE => 'Jour 2', + AFUP_FORUM_2_JOURNEES => '2 Jours', + AFUP_FORUM_2_JOURNEES_AFUP => '2 Jours AFUP', + AFUP_FORUM_PREMIERE_JOURNEE_AFUP => 'Jour 1 AFUP', + AFUP_FORUM_DEUXIEME_JOURNEE_AFUP => 'Jour 2 AFUP', + AFUP_FORUM_2_JOURNEES_ETUDIANT => '2 Jours Etudiant', + AFUP_FORUM_PREMIERE_JOURNEE_ETUDIANT => 'Jour 1 Etudiant', + AFUP_FORUM_DEUXIEME_JOURNEE_ETUDIANT => 'Jour 2 Etudiant', + AFUP_FORUM_2_JOURNEES_PREVENTE => '2 Jours prévente', + AFUP_FORUM_2_JOURNEES_AFUP_PREVENTE => '2 Jours AFUP prévente', + AFUP_FORUM_2_JOURNEES_PREVENTE_ADHESION => '2 Jours prévente + adhésion', + AFUP_FORUM_2_JOURNEES_ETUDIANT_PREVENTE => '2 Jours Etudiant prévente', + AFUP_FORUM_2_JOURNEES_COUPON => '2 Jours avec coupon de réduction', + AFUP_FORUM_2_JOURNEES_SPONSOR => '2 Jours par Sponsor', + AFUP_FORUM_PREMIERE_JOURNEE_ETUDIANT_PREVENTE => '', + AFUP_FORUM_DEUXIEME_JOURNEE_ETUDIANT_PREVENTE => '', + AFUP_FORUM_SPECIAL_PRICE => 'Tarif Spécial', + ], + 'forumTarifs' => [ + AFUP_FORUM_INVITATION => 0, + AFUP_FORUM_ORGANISATION => 0, + AFUP_FORUM_SPONSOR => 0, + AFUP_FORUM_PRESSE => 0, + AFUP_FORUM_CONFERENCIER => 0, + AFUP_FORUM_PROJET => 0, + AFUP_FORUM_PROF => 0, + AFUP_FORUM_PREMIERE_JOURNEE => 150, + AFUP_FORUM_DEUXIEME_JOURNEE => 150, + AFUP_FORUM_2_JOURNEES => 250, + AFUP_FORUM_2_JOURNEES_AFUP => 150, + AFUP_FORUM_PREMIERE_JOURNEE_AFUP => 100, + AFUP_FORUM_DEUXIEME_JOURNEE_AFUP => 100, + AFUP_FORUM_2_JOURNEES_ETUDIANT => 150, + AFUP_FORUM_PREMIERE_JOURNEE_ETUDIANT => 100, + AFUP_FORUM_DEUXIEME_JOURNEE_ETUDIANT => 100, + AFUP_FORUM_2_JOURNEES_PREVENTE => 150, + AFUP_FORUM_2_JOURNEES_AFUP_PREVENTE => 150, + AFUP_FORUM_2_JOURNEES_PREVENTE_ADHESION => 150, + AFUP_FORUM_PREMIERE_JOURNEE_ETUDIANT_PREVENTE => 100, + AFUP_FORUM_DEUXIEME_JOURNEE_ETUDIANT_PREVENTE => 100, + AFUP_FORUM_2_JOURNEES_ETUDIANT_PREVENTE => 150, + AFUP_FORUM_2_JOURNEES_COUPON => 200, + AFUP_FORUM_2_JOURNEES_SPONSOR => 200, + AFUP_FORUM_SPECIAL_PRICE => 0, + ], + 'event' => $event, + 'event_select_form' => $this->createForm(EventSelectType::class, $event)->createView(), + ]); + } + + private function updateGlobalsForTarif( + EventRepository $eventRepository, + TicketEventTypeRepository $ticketEventTypeRepository, + TicketTypeAvailability $ticketTypeAvailability, + $forumId, + &$membersTickets = [] + ): array { + global $AFUP_Tarifs_Forum, $AFUP_Tarifs_Forum_Lib; + $event = $eventRepository->get($forumId); + $ticketTypes = $ticketEventTypeRepository->getTicketsByEvent($event, false); + $AFUP_Tarifs_Forum_Restantes = []; + + foreach ($ticketTypes as $ticketType) { + /** + * @var $ticketType \AppBundle\Event\Model\TicketEventType + */ + $AFUP_Tarifs_Forum[$ticketType->getTicketTypeId()] = $ticketType->getPrice(); + $AFUP_Tarifs_Forum_Lib[$ticketType->getTicketTypeId()] = $ticketType->getTicketType()->getPrettyName(); + $AFUP_Tarifs_Forum_Restantes[$ticketType->getTicketTypeId()] = $ticketTypeAvailability->getStock($ticketType, $event); + + if ($ticketType->getTicketType()->getIsRestrictedToMembers()) { + $membersTickets[] = $ticketType->getTicketTypeId(); + } + } + + return ['restantes' => $AFUP_Tarifs_Forum_Restantes]; + } +} diff --git a/sources/AppBundle/Event/Model/Repository/TicketRepository.php b/sources/AppBundle/Event/Model/Repository/TicketRepository.php index db70f0b25..a85a37e5f 100644 --- a/sources/AppBundle/Event/Model/Repository/TicketRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TicketRepository.php @@ -214,6 +214,65 @@ public function getAllTicketsForExport() ->query($this->getCollection(new HydratorSingleObject())); } + public function getTicketsForList(Event $event, ?string $filter, ?string $sort, ?string $direction): CollectionInterface + { + $availableSorts = [ + 'date' => 'i.date', + 'name' => 'i.nom', + 'societe' => 'f.societe', + 'type' => 'i.type_inscription', + 'etat' => 'i.etat', + ]; + + $params = [ + 'eventId' => $event->getId() + ]; + + $sql = <<getPreparedQuery($sql) + ->setParams($params) + ->query($this->getCollection(new HydratorArray())) + ; + } + /** * @inheritDoc */ diff --git a/templates/event/inscription/list.html.twig b/templates/event/inscription/list.html.twig new file mode 100644 index 000000000..16eb207b4 --- /dev/null +++ b/templates/event/inscription/list.html.twig @@ -0,0 +1,287 @@ +{% extends 'admin/base_with_header.html.twig' %} + +{% block content %} +

Inscriptions {{ event.title~' '~event.dateStart|date('Y') }}

+ + {% include 'admin/event/change_event.html.twig' with {form: event_select_form} only %} + + + +
+ + + + + + + + + + + + + + {% set inscritsTotal = 0 %} + {% set confirmesTotal = 0 %} + {% set payantsTotal = 0 %} + {% set montantTotal = 0 %} + + {% for forumTarifKey, forumTarif in forumTarifs %} + {% set inscrits = statistiques.types_inscriptions.inscrits[forumTarifKey]|default(0) %} + {% set confirmes = statistiques.types_inscriptions.confirmes[forumTarifKey]|default(0) %} + {% set payants = statistiques.types_inscriptions.payants[forumTarifKey]|default(0) %} + {% set montant = (statistiques.types_inscriptions.payants[forumTarifKey]|default(0)) * forumTarif %} + {% set inscritsTotal = inscritsTotal + inscrits %} + {% set confirmesTotal = confirmesTotal + confirmes %} + {% set payantsTotal = payantsTotal + payants %} + {% set montantTotal = montantTotal + montant %} + + {% if inscrits != 0 %} + + + + + + + + + + + {% endif %} + {% endfor %} + + + + + + + + + + + + + +
TypeTarifNb inscritsNb ConfirmeNb payantsMontantPlaces restantes
+ {{ forumTarifsLib[forumTarifKey] }} + {{ forumTarif}} €{{ inscrits }}{{ confirmes }}{{ payants }} {{ montant }} {{ restantes[forumTarifKey]|default('') }}
{{ inscritsTotal }}{{ confirmesTotal }}{{ payantsTotal }}{{ montantTotal }}
+ + + + + + + + + + + + + + + + + + + + + + + + +
InscritsConfirmésEn attente de règlement
Jour 1{{ statistiques.premier_jour.inscrits }}{{ statistiques.premier_jour.confirmes }} + {% if statistiques.premier_jour.en_attente_de_reglement == '' %} + 0 + {% else %} + {{ statistiques.premier_jour.en_attente_de_reglement }} + {% endif %} +
Jour 2{{ statistiques.second_jour.inscrits }}{{ statistiques.second_jour.confirmes }} + {% if statistiques.second_jour.en_attente_de_reglement == '' %} + 0 + {% else %} + {{ statistiques.second_jour.en_attente_de_reglement }} + {% endif %} +
+
+ +
+
+
+
+
+ + + +
+
+ +
+
+
+
+ + {% if inscriptions|length > 0 %} + + + + + + + + + + + + + + + {% for key, inscription in inscriptions %} + + + + + + + + {% if inscription.type_inscription in forumTarifsMembers %} + {% if inscription.lastsubscription == null %} + + {% elseif inscription.lastsubscription < now %} + + {% elseif inscription.lastsubscription < event.dateEnd %} + + {% else %} + + {% endif %} + {% else %} + + {% endif %} + + + {% endfor %} + +
DateNom PrénomSociété (facturation)TypeEtatRèg.Statut cotisation 
{% if inscription.date.timestamp is defined %}{{ inscription.date|date("d/m/Y H:m:s")}}{% endif %} + {{ inscription.prenom }} {{ inscription.nom }} + + + + + {{ inscription.societe }} + {% if inscription.societe %} + + + + {% endif %} + {{ forumTarifsLib[inscription.type_inscription] }} + {% if inscription.etat == 0 %} + Créé + {% elseif inscription.etat == 1 %} + Annulé + {% elseif inscription.etat == 2 %} + Erreur + {% elseif inscription.etat == 3 %} + Refusé + {% elseif inscription.etat == 4 %} + Reglé + {% elseif inscription.etat == 5 %} + Invité + {% elseif inscription.etat == 6 %} + Attente règlement + {% elseif inscription.etat == 7 %} + Facturé + {% endif %} + {% if inscription.type_reglement == 0 %}CB{% elseif inscription.type_reglement == 1 %}CHQ{% elseif inscription.type_reglement == 2 %}VIR{% endif %} + + Non trouvée + + + + A expiré le {{ inscription.lastsubscription|date('%d/%m/%Y') }} + + + URL Paiement + + + + Expire le {{ inscription.lastsubscription|date('%d/%m/%Y') }} + + + URL Paiement + + + OK + + n/a + + {% if inscription.type_inscription == constant('AFUP_FORUM_2_JOURNEES_PREVENTE_ADHESION') and inscription.etat != 1%} + {# TODO RAPH "cheminTemplate" #} + Générer un mail pour demander la confirmation d'adhésion à l'AFUP + Transformer en adhésion AFUP + {% endif %} + + + + + + + +
+ {% else %} +
+
+ + Aucune inscription +
+
+ {% endif %} +
+{% endblock %} From c202d23b9f67eb6f0304c6930ba087b82efbb68c Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 8 May 2025 08:37:49 +0200 Subject: [PATCH 2/5] =?UTF-8?q?feature/move-inscription-page-to-sf=20:=20F?= =?UTF-8?q?ait=20un=20peu=20de=20m=C3=A9nage=20dans=20le=20code=20rapideme?= =?UTF-8?q?nt=20+=20remplace=20les=20liens=20par=20la=20fonction=20path=20?= =?UTF-8?q?de=20twig=20+=20corrige=20un=20bug=20quand=20on=20tente=20de=20?= =?UTF-8?q?g=C3=A9n=C3=A9rer=20une=20inscription=20pour=20une=20personne?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Event/Inscription/ListAction.php | 10 +++---- .../Model/Repository/TicketRepository.php | 3 +- templates/event/inscription/list.html.twig | 28 +++++++++---------- 3 files changed, 20 insertions(+), 21 deletions(-) diff --git a/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php b/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php index 8050a757f..30cd1fbef 100644 --- a/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php +++ b/sources/AppBundle/Controller/Admin/Event/Inscription/ListAction.php @@ -35,7 +35,7 @@ public function __invoke( $membersTicket = []; - $restantes = $this->updateGlobalsForTarif($eventRepository, $ticketEventTypeRepository, $ticketTypeAvailability, $event->getId(), $membersTicket)['restantes']; + $remainingTickets = $this->updateGlobalsForTarif($eventRepository, $ticketEventTypeRepository, $ticketTypeAvailability, $event->getId(), $membersTicket); $stats = $eventStatsRepository->getStats($event->getId()); @@ -46,7 +46,7 @@ public function __invoke( 'forumTarifsMembers' => $membersTicket, 'now' => new DateTime(), 'inscriptions' => $ticketRepository->getTicketsForList($event, $filter, $sort, $direction), - 'restantes' => $restantes, + 'remainingTickets' => $remainingTickets, 'statistiques' => [ 'premier_jour' => [ 'inscrits' => $stats->firstDay->registered, @@ -133,7 +133,7 @@ private function updateGlobalsForTarif( global $AFUP_Tarifs_Forum, $AFUP_Tarifs_Forum_Lib; $event = $eventRepository->get($forumId); $ticketTypes = $ticketEventTypeRepository->getTicketsByEvent($event, false); - $AFUP_Tarifs_Forum_Restantes = []; + $remainingTickets = []; foreach ($ticketTypes as $ticketType) { /** @@ -141,13 +141,13 @@ private function updateGlobalsForTarif( */ $AFUP_Tarifs_Forum[$ticketType->getTicketTypeId()] = $ticketType->getPrice(); $AFUP_Tarifs_Forum_Lib[$ticketType->getTicketTypeId()] = $ticketType->getTicketType()->getPrettyName(); - $AFUP_Tarifs_Forum_Restantes[$ticketType->getTicketTypeId()] = $ticketTypeAvailability->getStock($ticketType, $event); + $remainingTickets[$ticketType->getTicketTypeId()] = $ticketTypeAvailability->getStock($ticketType, $event); if ($ticketType->getTicketType()->getIsRestrictedToMembers()) { $membersTickets[] = $ticketType->getTicketTypeId(); } } - return ['restantes' => $AFUP_Tarifs_Forum_Restantes]; + return $remainingTickets; } } diff --git a/sources/AppBundle/Event/Model/Repository/TicketRepository.php b/sources/AppBundle/Event/Model/Repository/TicketRepository.php index a85a37e5f..44ce9c35c 100644 --- a/sources/AppBundle/Event/Model/Repository/TicketRepository.php +++ b/sources/AppBundle/Event/Model/Repository/TicketRepository.php @@ -254,8 +254,7 @@ public function getTicketsForList(Event $event, ?string $filter, ?string $sort, FROM afup_inscription_forum i LEFT JOIN afup_facturation_forum f ON i.reference = f.reference - WHERE 1 = 1 - AND i.id_forum = :eventId + WHERE i.id_forum = :eventId SQL; if ($filter) { diff --git a/templates/event/inscription/list.html.twig b/templates/event/inscription/list.html.twig index 16eb207b4..ff8044a40 100644 --- a/templates/event/inscription/list.html.twig +++ b/templates/event/inscription/list.html.twig @@ -6,7 +6,7 @@ {% include 'admin/event/change_event.html.twig' with {form: event_select_form} only %}