fix: resolve stale dependent selections after booking family insurance
This commit is contained in:
@@ -7,6 +7,7 @@ namespace App\Controller\Booking\Create;
|
||||
use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\ApplicantInsuranceCascade;
|
||||
use App\Service\BookingConfigurator;
|
||||
use App\Service\BookingCreateContextFactory;
|
||||
use App\Service\BookingSessionManager;
|
||||
@@ -34,6 +35,7 @@ class Step2ParticipantController extends AbstractController
|
||||
private readonly TravelDataProvider $travelDataService,
|
||||
private readonly ParticipantDataPrefiller $prepopulationService,
|
||||
private readonly ParticipantFormSupport $participantFormSupportService,
|
||||
private readonly ApplicantInsuranceCascade $applicantInsuranceCascade,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -70,6 +72,7 @@ class Step2ParticipantController extends AbstractController
|
||||
$this->prepopulationService->fillDummyParticipant($bookingDto->participants[$index], $index);
|
||||
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
$this->applicantInsuranceCascade->apply($bookingDto);
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
|
||||
@@ -80,6 +83,7 @@ class Step2ParticipantController extends AbstractController
|
||||
|
||||
if (true === $isSubmitted) {
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
$this->applicantInsuranceCascade->apply($bookingDto);
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
}
|
||||
|
||||
@@ -195,6 +199,7 @@ class Step2ParticipantController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
$this->bookingService->preselectDefaultServices($bookingDto);
|
||||
$this->applicantInsuranceCascade->apply($bookingDto);
|
||||
if (BookingDto::MODE_CREATE === $bookingDto->getMode()) {
|
||||
$this->bookingService->applyCreateBookingStatusRules($bookingDto);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,13 @@ use App\Entity\User;
|
||||
use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\ApplicantInsuranceCascade;
|
||||
use App\Service\BookingConfigurator;
|
||||
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\ParticipantDataPrefiller;
|
||||
use App\Service\ParticipantFormSupport;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
@@ -40,6 +41,7 @@ class ParticipantController extends AbstractController
|
||||
private readonly BookingSessionManager $bookingSessionService,
|
||||
private readonly ParticipantDataPrefiller $prepopulationService,
|
||||
private readonly ParticipantFormSupport $participantFormSupportService,
|
||||
private readonly ApplicantInsuranceCascade $applicantInsuranceCascade,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
@@ -85,6 +87,7 @@ class ParticipantController extends AbstractController
|
||||
}
|
||||
|
||||
$this->editContextFactory->prepareBookingDto($bookingDto);
|
||||
$this->applicantInsuranceCascade->apply($bookingDto);
|
||||
|
||||
$form = $this->createParticipantForm($bookingDto, $index);
|
||||
|
||||
@@ -156,6 +159,7 @@ class ParticipantController extends AbstractController
|
||||
$form->handleRequest($request);
|
||||
|
||||
$this->bookingConfigurator->preselectDefaultServices($bookingDto);
|
||||
$this->applicantInsuranceCascade->apply($bookingDto);
|
||||
$this->bookingSessionService->saveBookingDto($request, $bookingDto, BookingDto::MODE_EDIT);
|
||||
|
||||
$form = $this->createForm(
|
||||
@@ -221,7 +225,6 @@ class ParticipantController extends AbstractController
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Booking|null $bookingData
|
||||
* @param FormInterface<mixed> $form
|
||||
*/
|
||||
private function renderParticipantForm(
|
||||
@@ -230,8 +233,7 @@ class ParticipantController extends AbstractController
|
||||
BookingDto $bookingDto,
|
||||
int $bookingId,
|
||||
?Booking $bookingData,
|
||||
): Response
|
||||
{
|
||||
): Response {
|
||||
$context = $this->editContextFactory->createParticipantContext($bookingDto, $bookingData);
|
||||
|
||||
return $this->render('booking/edit/participant.html.twig', [
|
||||
|
||||
Reference in New Issue
Block a user