49 lines
1.8 KiB
PHP
49 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Controller\Admin\ApplicationFormSubmission;
|
|
|
|
use App\Email\ApplicationFormSubmissionMailer;
|
|
use App\Entity\ApplicationFormSubmission;
|
|
use App\Htmx\HxRedirectResponse;
|
|
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
|
|
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(
|
|
#[MapEntity(mapping: ['uuid' => 'uuid'])]
|
|
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,
|
|
]);
|
|
}
|
|
}
|