feat: answer received form submissions by mail

This commit is contained in:
fromme committed 2026-09-24 16:35:31 +02:00
1 parent 19364df2db
commit aa728ddc99
22 files changed
+974 -9

No files matched your search

@@ -0,0 +1,44 @@
<?php
namespace App\Controller\Admin\ApplicationFormSubmission;
use App\Email\ApplicationFormSubmissionMailer;
use App\Entity\ApplicationFormSubmission;
use App\Htmx\HxRedirectResponse;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Security\Http\Attribute\IsGranted;
/**
* Sends the receipt again by hand. The endpoint sends it by itself when a submission arrives, so
* this is for the cases where that did not work: an address that was missing or wrong, or wording
* that was fixed afterwards.
*/
class SendReceiptMailController extends AbstractController
{
public function __construct(private readonly ApplicationFormSubmissionMailer $mailer)
{
}
#[Route('/admin/application-form-submission/send-receipt/{uuid}', name: 'app_admin_application_form_submission_send_receipt')]
#[IsGranted('ROLE_TEAM_ADMIN')]
public function index(ApplicationFormSubmission $submission, Request $request): Response
{
if (true === $request->isMethod(Request::METHOD_POST)) {
$this->mailer->sendReceipt($submission);
$this->addFlash('success', 'Die Eingangsbestätigung wurde erneut versendet');
return new HxRedirectResponse($this->generateUrl('app_admin_application_form_submission_detail', [
'uuid' => $submission->getUuid(),
'r' => $request->query->get('r'),
]));
}
return $this->render('admin/application_form_submission/modal_send_receipt.html.twig', [
'submission' => $submission,
]);
}
}