wip: booking summary for step 1

This commit is contained in:
Björn Fromme
2025-07-24 11:59:27 +02:00
parent 3f94c51bc8
commit 7b1f2e7468
4 changed files with 72 additions and 10 deletions
@@ -33,7 +33,7 @@ class CreateStep1Controller extends AbstractController
public function index(Request $request): Response
{
$bookingCreateDto = $this->bookingService->getOrCreateBookingCreateDto($request);
$participantsCount = $this->bookingService->getParticipantsCount($bookingCreateDto->roomSelections, $bookingCreateDto->travel);
$summary = $this->bookingService->getRoomSummaryAndParticipantCount($bookingCreateDto);
// Validate step access - allow step 1 or redirect to current step
$this->validateStepAccess($bookingCreateDto, 1);
@@ -53,8 +53,33 @@ class CreateStep1Controller extends AbstractController
return $this->render('booking/create_step_1.html.twig', [
'bookingCreateDto' => $bookingCreateDto,
'participantsCount' => $participantsCount,
'roomSummary' => $summary['selectedRooms'],
'participantCount' => $summary['participantCount'],
'form' => $form->createView(),
]);
}
/**
* HTMX endpoint for live summary updates in step 1.
*/
#[Route('/bookings/create/room-summary', name: 'app_booking_create_step_1_room_summary', methods: ['POST'])]
public function roomSummary(Request $request): Response
{
$bookingCreateDto = $this->bookingService->getOrCreateBookingCreateDto($request);
// Process the form to update the DTO with the latest room selection
$form = $this->createForm(BookingCreateStep1Type::class, $bookingCreateDto, [
'validation_groups' => false,
]);
$form->handleRequest($request);
$this->bookingService->saveBookingCreateDto($request, $bookingCreateDto);
$summary = $this->bookingService->getRoomSummaryAndParticipantCount($bookingCreateDto);
return $this->render('booking/_room_summary.html.twig', [
'roomSummary' => $summary['selectedRooms'],
'participantCount' => $summary['participantCount'],
]);
}
}