feat: all-season assignments

This commit is contained in:
Björn Fromme authored and Björn Fromme committed 2026-09-26 12:13:16 +02:00
1 parent 675cec1b69
commit cf876ed224
119 files changed
+6194 -294

No files matched your search

@@ -57,7 +57,7 @@ class MailingController extends AbstractController
));
}
$filterDto = $this->filterHandler->getFilterSettings();
$filterDto = $this->filterHandler->setScope($request->query->get('scope'))->getFilterSettings();
// No redirect after the preview mail, the composed mail has to survive it. The
// preview pane is rendered here so the page arrives complete; from then on the
@@ -69,7 +69,8 @@ class MailingController extends AbstractController
'recipients' => $this->mailingService->resolveRecipients($filterDto),
'placeholders' => TeamerMailingService::PLACEHOLDERS,
'hasDraft' => $this->draftHandler->hasDraft(),
'returnUrl' => $this->getReturnUrl($request, 'app_administrative_teamer_index'),
'returnUrl' => $this->getReturnUrl($request, $this->getListRoute($request)),
'scope' => $request->query->get('scope'),
]);
}
@@ -94,11 +95,13 @@ class MailingController extends AbstractController
#[Route('/admin/teamer/mailing/discard', name: 'app_admin_teamer_mailing_discard')]
#[IsGranted('ROLE_TEAM_ADMIN')]
public function discard(): Response
public function discard(Request $request): Response
{
$this->draftHandler->resetDraft();
return $this->redirectToRoute('app_admin_teamer_mailing');
return $this->redirectToRoute('app_admin_teamer_mailing', [
'scope' => $request->query->get('scope'),
]);
}
#[Route('/admin/teamer/mailing/confirm', name: 'app_admin_teamer_mailing_confirm', methods: ['POST'])]
@@ -106,7 +109,7 @@ class MailingController extends AbstractController
public function confirm(Request $request): Response
{
$form = $this->createMailingForm($request);
$filterDto = $this->filterHandler->getFilterSettings();
$filterDto = $this->filterHandler->setScope($request->query->get('scope'))->getFilterSettings();
// the composed mail is carried on in hidden fields so no half written mailing has
// to be parked in the session between the confirmation and the send
@@ -115,6 +118,7 @@ class MailingController extends AbstractController
'mailingDto' => $form->getData(),
'valid' => $form->isSubmitted() && $form->isValid(),
'recipients' => $this->mailingService->resolveRecipients($filterDto),
'scope' => $request->query->get('scope'),
]);
}
@@ -127,10 +131,14 @@ class MailingController extends AbstractController
if (false === $form->isSubmitted() || false === $form->isValid()) {
$this->addFlash('error', 'Die Mail konnte nicht gesendet werden, Betreff oder Nachricht fehlen');
return new HxRedirectResponse($this->generateUrl('app_admin_teamer_mailing'));
return new HxRedirectResponse($this->generateUrl('app_admin_teamer_mailing', [
'scope' => $request->query->get('scope'),
]));
}
$recipients = $this->mailingService->resolveRecipients($this->filterHandler->getFilterSettings());
$recipients = $this->mailingService->resolveRecipients(
$this->filterHandler->setScope($request->query->get('scope'))->getFilterSettings()
);
$mailingDto = $form->getData();
// the recipients travel with the message, so the mailing reaches exactly the
@@ -151,7 +159,18 @@ class MailingController extends AbstractController
$recipients->getEligibleCount()
));
return new HxRedirectResponse($this->generateUrl('app_administrative_teamer_index'));
return new HxRedirectResponse($this->generateUrl($this->getListRoute($request)));
}
/**
* The list this mailing was started from, so a send returns to it and an unscoped
* mailing never falls back to the wrong one.
*/
private function getListRoute(Request $request): string
{
return TeamerFilterHandler::SCOPE_ALL_SEASON === $request->query->get('scope')
? 'app_administrative_season_teamer_index'
: 'app_administrative_teamer_index';
}
/**