Add resend invitation button for non-accepted invitations
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -506,4 +506,45 @@ class AdminController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
#[Route('/organisateurs/invitation/{id}/renvoyer', name: 'app_admin_resend_invitation', methods: ['POST'])]
|
||||
public function resendInvitation(int $id, EntityManagerInterface $em, MailerService $mailerService): Response
|
||||
{
|
||||
$invitation = $em->getRepository(OrganizerInvitation::class)->find($id);
|
||||
if (!$invitation) {
|
||||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
$acceptUrl = $this->generateUrl('app_invitation_respond', [
|
||||
'token' => $invitation->getToken(),
|
||||
'action' => 'accept',
|
||||
], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
$refuseUrl = $this->generateUrl('app_invitation_respond', [
|
||||
'token' => $invitation->getToken(),
|
||||
'action' => 'refuse',
|
||||
], UrlGeneratorInterface::ABSOLUTE_URL);
|
||||
|
||||
$html = $this->renderView('email/organizer_invitation.html.twig', [
|
||||
'invitation' => $invitation,
|
||||
'acceptUrl' => $acceptUrl,
|
||||
'refuseUrl' => $refuseUrl,
|
||||
]);
|
||||
|
||||
$mailerService->sendEmail(
|
||||
$invitation->getEmail(),
|
||||
'Invitation organisateur - E-Ticket',
|
||||
$html,
|
||||
'E-Ticket <contact@e-cosplay.fr>',
|
||||
null,
|
||||
false,
|
||||
);
|
||||
|
||||
$invitation->setStatus(OrganizerInvitation::STATUS_SENT);
|
||||
$invitation->setRespondedAt(null);
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', 'Invitation renvoyee a '.$invitation->getEmail().'.');
|
||||
|
||||
return $this->redirectToRoute('app_admin_invite_organizer');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
{% if inv.respondedAt %}
|
||||
<span class="text-[10px] text-gray-400 ml-2">{{ inv.respondedAt|date('d/m/Y') }}</span>
|
||||
{% endif %}
|
||||
{% if inv.status != 'accepted' %}
|
||||
<form method="post" action="{{ path('app_admin_resend_invitation', {id: inv.id}) }}" class="inline ml-2">
|
||||
<button type="submit" class="admin-btn-sm-white inline-block text-xs font-black uppercase tracking-widest hover:bg-indigo-600 hover:text-black transition-all">Renvoyer</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
|
||||
Reference in New Issue
Block a user