feat: groups price calculator admin crud, booking/offer flow and api

This commit is contained in:
Björn Fromme committed 2026-08-03 15:25:10 +02:00
1 parent eabed8295a
commit 9d2aa11fdb
258 files changed
+16231 -582

No files matched your search

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace App\Controller\Groups;
use App\Exception\AccommodationSessionNotFoundException;
use App\Form\Model\AccommodationBookingDto;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
abstract class AbstractAccommodationController extends AbstractController
{
protected function validateStepAccess(AccommodationBookingDto $dto, int $expectedStep): ?RedirectResponse
{
if ($expectedStep > $dto->currentStep) {
$this->addFlash('error', 'Bitte erst die vorherigen Schritte abschließen.');
return $this->redirectToCurrentStep($dto);
}
return null;
}
protected function createFailureResponse(\Throwable $exception, bool $htmx): Response
{
if ($htmx) {
return new Response('', 400);
}
$message = $exception instanceof AccommodationSessionNotFoundException
? 'Deine Sitzung ist abgelaufen. Bitte starte die Anfrage erneut.'
: 'Die Anfrage konnte nicht geladen werden.';
$this->addFlash('error', $message);
return $this->redirectToRoute('app_groups_booking_error');
}
private function redirectToCurrentStep(AccommodationBookingDto $dto): RedirectResponse
{
$route = match ($dto->currentStep) {
2 => 'app_groups_booking_step_2',
3 => 'app_groups_booking_step_3',
4 => 'app_groups_booking_step_4',
default => 'app_groups_booking_step_1',
};
return $this->redirectToRoute($route);
}
}