fix: ensure mandatory services are preselected in edit mode

This commit is contained in:
Björn Fromme
2026-07-10 14:33:09 +02:00
parent 4e26b8acc0
commit 99b6876ce2
4 changed files with 158 additions and 1 deletions
@@ -12,6 +12,7 @@ use App\Form\Model\BookingDto;
use App\Htmx\HxTrait;
use App\Model\BookingEditSubmissionResult;
use App\Service\BookingChangeTracker;
use App\Service\BookingConfigurator;
use App\Service\BookingEditContextFactory;
use App\Service\BookingEditDataLoader;
use App\Service\BookingEditDraftManager;
@@ -42,6 +43,7 @@ class IndexController extends AbstractController
private readonly BookingEditDraftManager $draftService,
private readonly BookingSessionManager $bookingSessionService,
private readonly BookingChangeTracker $fingerprintService,
private readonly BookingConfigurator $bookingConfigurator,
private readonly BookingEditContextFactory $editContextFactory,
private readonly BookingEditPreFlightChecker $preFlightChecker,
private readonly BookingEditSubmitter $formSubmitter,
@@ -92,6 +94,9 @@ class IndexController extends AbstractController
return $this->redirectToRoute('app_bookings');
}
$this->bookingConfigurator->preselectDefaultServices($bookingDto);
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_EDIT);
// Show flash message if draft was restored
if (true === $this->dataLoader->isDraftRestored()) {
$this->addFlash('info', 'Dein zuvor gespeicherter Entwurf wurde wiederhergestellt.');
@@ -13,6 +13,7 @@ use App\Htmx\HxTrait;
use App\Service\BookingEditContextFactory;
use App\Service\BookingEditDataLoader;
use App\Service\BookingEditDraftManager;
use App\Service\BookingConfigurator;
use App\Service\ParticipantDataPrefiller;
use App\Service\BookingSessionManager;
use App\Service\ParticipantFormSupport;
@@ -34,6 +35,7 @@ class ParticipantController extends AbstractController
private readonly BookingEditDataLoader $dataLoader,
private readonly BookingEditDraftManager $draftService,
private readonly BookingEditContextFactory $editContextFactory,
private readonly BookingConfigurator $bookingConfigurator,
private readonly BookingSessionManager $bookingSessionService,
private readonly ParticipantDataPrefiller $prepopulationService,
private readonly ParticipantFormSupport $participantFormSupportService,
@@ -148,6 +150,15 @@ class ParticipantController extends AbstractController
$form->handleRequest($request);
$this->bookingConfigurator->preselectDefaultServices($bookingDto);
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_EDIT);
$form = $this->createForm(
BookingParticipantType::class,
$this->participantFormSupportService->createParticipantEditDto($bookingDto, $index),
$this->participantFormSupportService->getParticipantFormOptions($bookingDto, true)
);
$notifications = $this->participantFormSupportService->collectAndClearNotifications($bookingDto);
$context = $this->editContextFactory->createParticipantContext(
$bookingDto,