feat: improved promotional and purchase vouchers
This commit is contained in:
@@ -150,10 +150,20 @@ class Step2Controller extends AbstractController
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
// Collect notifications from field handlers (run during PRE_SUBMIT)
|
||||
$notifications = $this->collectAndClearNotifications($bookingDto);
|
||||
|
||||
if (true === $form->isSubmitted() && true === $form->isValid()) {
|
||||
// Save BookingDto to session
|
||||
$this->bookingService->saveBookingDto($request, $bookingDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Add notifications as flash messages (redirects destroy HTMX-triggered toasts)
|
||||
if (false === empty($notifications)) {
|
||||
foreach ($notifications as $notification) {
|
||||
$this->addFlash($notification['type'], $notification['message']);
|
||||
}
|
||||
}
|
||||
|
||||
// HTMX redirect to cards view
|
||||
return $this->hxRedirect($request, $this->generateUrl('app_booking_create_step_2'));
|
||||
}
|
||||
@@ -174,12 +184,21 @@ class Step2Controller extends AbstractController
|
||||
|
||||
// HTMX request: render blocks only with OOB swap
|
||||
if ($this->isHxRequest($request)) {
|
||||
return $this->htmxOobResponse(
|
||||
$response = $this->htmxOobResponse(
|
||||
'booking/_participant_form.html.twig',
|
||||
['participant_form', 'booking_summary'],
|
||||
$templateData,
|
||||
$this->generateUrl('app_booking_create_step_2_participant', ['index' => $index])
|
||||
);
|
||||
|
||||
// Add notifications to render response if present
|
||||
if (false === empty($notifications)) {
|
||||
$response->headers->set('HX-Trigger', json_encode([
|
||||
'showNotifications' => $notifications,
|
||||
]));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Regular request: render full template
|
||||
|
||||
Reference in New Issue
Block a user