wip: modernized edit flow, fix insurance tier calculation
This commit is contained in:
1 parent
cba0f747cd
commit
67c642bc2f
31 files changed
+272
-536
No files matched your search
@@ -6,7 +6,7 @@ namespace App\Controller\Booking;
|
||||
|
||||
use App\Controller\Traits\HtmxControllerTrait;
|
||||
use App\Form\BookingCreateStep2Type;
|
||||
use App\Form\Model\BookingCreateDto;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantDto;
|
||||
use App\Service\BookingPriceCalculatorService;
|
||||
use App\Service\BookingService;
|
||||
@@ -67,7 +67,7 @@ class CreateStep2Controller extends AbstractController
|
||||
// Pre-select mandatory services for participants with birth dates
|
||||
$this->bookingService->preselectMandatoryServices($bookingCreateDto);
|
||||
|
||||
$this->bookingService->saveBookingCreateDto($request, $bookingCreateDto);
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
$form = $this->createForm(BookingCreateStep2Type::class, $bookingCreateDto, [
|
||||
'attr' => ['novalidate' => 'novalidate'],
|
||||
@@ -78,7 +78,7 @@ class CreateStep2Controller extends AbstractController
|
||||
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$bookingCreateDto->currentStep = 3;
|
||||
$this->bookingService->saveBookingCreateDto($request, $bookingCreateDto);
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
return $this->redirectToRoute('app_booking_create_step_3');
|
||||
}
|
||||
@@ -129,7 +129,7 @@ class CreateStep2Controller extends AbstractController
|
||||
// Pre-select mandatory services after form processing but before pricing calculation
|
||||
$this->bookingService->preselectMandatoryServices($bookingCreateDto);
|
||||
|
||||
$this->bookingService->saveBookingCreateDto($request, $bookingCreateDto);
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Collect notifications from all participants
|
||||
$notifications = $this->collectParticipantNotifications($bookingCreateDto);
|
||||
@@ -173,9 +173,9 @@ class CreateStep2Controller extends AbstractController
|
||||
* based on room selections. Preserves existing participant data when possible
|
||||
* and assigns proper index values.
|
||||
*
|
||||
* @param BookingCreateDto $bookingCreateDto The booking DTO to update
|
||||
* @param BookingDto $bookingCreateDto The booking DTO to update
|
||||
*/
|
||||
private function ensureCorrectNumberOfParticipants(BookingCreateDto $bookingCreateDto): void
|
||||
private function ensureCorrectNumberOfParticipants(BookingDto $bookingCreateDto): void
|
||||
{
|
||||
$participantsCount = $this->getParticipantsCount($bookingCreateDto);
|
||||
|
||||
@@ -195,13 +195,13 @@ class CreateStep2Controller extends AbstractController
|
||||
* to ensure service availability is reasonably up-to-date while reducing API calls.
|
||||
* This is essential for accurate pricing and service selection during the booking process.
|
||||
*
|
||||
* @param BookingCreateDto $bookingCreateDto The booking DTO containing travel data to enrich
|
||||
* @param BookingDto $bookingCreateDto The booking DTO containing travel data to enrich
|
||||
*/
|
||||
private function enrichWithFreshAvailabilities(BookingCreateDto $bookingCreateDto): void
|
||||
private function enrichWithFreshAvailabilities(BookingDto $bookingCreateDto): void
|
||||
{
|
||||
$dateId = $bookingCreateDto->travel->id;
|
||||
|
||||
$availabilities = $this->travelDataService->getAvailabilityDataCached($dateId);
|
||||
$availabilities = $this->travelDataService->getAvailabilityData($dateId, true);
|
||||
|
||||
if (null !== $availabilities) {
|
||||
$this->travelDataService->patchAvailabilities($bookingCreateDto->travel, $availabilities);
|
||||
@@ -214,9 +214,9 @@ class CreateStep2Controller extends AbstractController
|
||||
* This is called when entering Step 2 to ensure all participants have room assignments
|
||||
* based on the selected rooms from Step 1. Only assigns if participants are unassigned.
|
||||
*
|
||||
* @param BookingCreateDto $bookingCreateDto The booking DTO with participants and room selections
|
||||
* @param BookingDto $bookingCreateDto The booking DTO with participants and room selections
|
||||
*/
|
||||
private function autoAssignRoomsIfNeeded(BookingCreateDto $bookingCreateDto): void
|
||||
private function autoAssignRoomsIfNeeded(BookingDto $bookingCreateDto): void
|
||||
{
|
||||
// Check if any participants need room assignment
|
||||
$needsAssignment = false;
|
||||
@@ -235,11 +235,11 @@ class CreateStep2Controller extends AbstractController
|
||||
/**
|
||||
* Collects all notifications from participants and clears them.
|
||||
*
|
||||
* @param BookingCreateDto $bookingCreateDto The booking DTO containing participants
|
||||
* @param BookingDto $bookingCreateDto The booking DTO containing participants
|
||||
*
|
||||
* @return array<array{type: string, message: string}> Array of notification messages
|
||||
*/
|
||||
private function collectParticipantNotifications(BookingCreateDto $bookingCreateDto): array
|
||||
private function collectParticipantNotifications(BookingDto $bookingCreateDto): array
|
||||
{
|
||||
$notifications = [];
|
||||
|
||||
|
||||
Reference in new issue
Block a user