fix: keep browser history intact when navigating between cards view and participant form
This commit is contained in:
@@ -120,7 +120,8 @@ class Step2Controller extends AbstractController
|
||||
return $this->htmxOobResponse(
|
||||
'booking/create/step_2.html.twig',
|
||||
['participant_cards', 'booking_summary'],
|
||||
$templateData
|
||||
$templateData,
|
||||
$this->generateUrl('app_booking_create_step_2')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -169,21 +170,28 @@ class Step2Controller extends AbstractController
|
||||
// Get detailed pricing data for summary sidebar
|
||||
$summary = $this->bookingService->getRoomSummaryAndParticipantCount($bookingDto);
|
||||
|
||||
// Render form and sidebar with OOB swap using htmxOobResponse
|
||||
// This ensures both initial load and refresh use the same block-based rendering
|
||||
return $this->htmxOobResponse(
|
||||
'booking/_participant_form.html.twig',
|
||||
['participant_form', 'booking_summary'],
|
||||
[
|
||||
'form' => $form->createView(),
|
||||
'participantIndex' => $index,
|
||||
'bookingDto' => $bookingDto,
|
||||
'summaryData' => $summaryData,
|
||||
'pricingData' => $summary['pricing'],
|
||||
'refreshRouteName' => 'app_booking_create_step_2_participant_refresh',
|
||||
'submitRouteName' => 'app_booking_create_step_2_participant',
|
||||
]
|
||||
);
|
||||
$templateData = [
|
||||
'form' => $form->createView(),
|
||||
'participantIndex' => $index,
|
||||
'bookingDto' => $bookingDto,
|
||||
'summaryData' => $summaryData,
|
||||
'pricingData' => $summary['pricing'],
|
||||
'refreshRouteName' => 'app_booking_create_step_2_participant_refresh',
|
||||
'submitRouteName' => 'app_booking_create_step_2_participant',
|
||||
];
|
||||
|
||||
// HTMX request: render blocks only with OOB swap
|
||||
if ($this->isHxRequest($request)) {
|
||||
return $this->htmxOobResponse(
|
||||
'booking/_participant_form.html.twig',
|
||||
['participant_form', 'booking_summary'],
|
||||
$templateData,
|
||||
$this->generateUrl('app_booking_create_step_2_participant', ['index' => $index])
|
||||
);
|
||||
}
|
||||
|
||||
// Regular request: render full template
|
||||
return $this->render('booking/create/step_2_participant.html.twig', $templateData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user