bookingRepository->findOneBy(['uuid' => $uuid]); if (null === $booking || false === $this->linkSigner->isValidLinkRequest($request, $booking)) { return $this->render('groups/booking/offer_unavailable.html.twig'); } $this->linkSigner->authorizeSession($request, $booking); return new RedirectResponse($this->generateUrl('app_groups_booking_offer_view', ['uuid' => $uuid])); } #[Route(path: '/groups/booking/offer/{uuid}/view', name: 'app_groups_booking_offer_view', methods: ['GET'])] public function view(string $uuid, Request $request): Response { $booking = $this->bookingRepository->findOneBy(['uuid' => $uuid]); if (null === $booking || false === $this->linkSigner->isSessionAuthorized($request, $booking)) { return $this->render('groups/booking/offer_unavailable.html.twig'); } $accommodation = $booking->getAccommodation() ?? throw $this->createNotFoundException('Booking has no accommodation.'); $priceBreakdown = $this->breakdownCalculator->compute($booking); $ctx = new AccommodationBookingContext( accommodation: $accommodation, hotelCmsData: $this->bookingService->loadHotelCmsData($accommodation), priceBreakdown: $priceBreakdown, ); $session = $request->getSession(); $justAccepted = $session instanceof FlashBagAwareSessionInterface && [] !== $session->getFlashBag()->get('accommodation_offer_accepted'); return $this->render('groups/booking/offer.html.twig', [ 'booking' => $booking, 'priceBreakdown' => $priceBreakdown, 'ctx' => $ctx, 'justAccepted' => $justAccepted, ]); } #[Route(path: '/groups/booking/offer/{uuid}/confirm', name: 'app_groups_booking_offer_confirm', methods: ['GET', 'POST'])] public function confirm(string $uuid, Request $request): Response { $booking = $this->bookingRepository->findOneBy(['uuid' => $uuid]); if (null === $booking || false === $this->linkSigner->isSessionAuthorized($request, $booking)) { return $this->redirectToOfferPage($request, $uuid); } if (!$booking->isInquiry()) { return $this->redirectToOfferPage($request, $uuid); } $confirmationForm = $this->createForm(OfferAcceptConfirmationType::class, null, [ 'terms_url' => $this->getParameter('terms_and_conditions_url'), ]); $confirmationForm->handleRequest($request); if ($confirmationForm->isSubmitted() && $confirmationForm->isValid()) { $this->bookingService->acceptBooking($booking); $this->addFlash('accommodation_offer_accepted', true); return $this->redirectToOfferPage($request, $uuid); } return $this->render('groups/booking/_offer_accept_confirmation_modal.html.twig', [ 'booking' => $booking, 'confirmationForm' => $confirmationForm, ]); } /** * Sends the browser to a full reload of the (non-modal) offer page — this is * triggered from an htmx-loaded modal, so a plain render/redirect here would * get appended as an inert HTML fragment instead of actually navigating. */ private function redirectToOfferPage(Request $request, string $uuid): Response { $url = $this->generateUrl('app_groups_booking_offer_view', ['uuid' => $uuid]); return $this->htmxRedirect($request, $url); } }