feat: improved promotional and purchase vouchers
This commit is contained in:
1 parent
aaa7e9f4c3
commit
9d28d2f102
15 files changed
+357
-137
No files matched your search
@@ -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
|
||||
|
||||
@@ -76,17 +76,22 @@ class Step3Controller extends AbstractController
|
||||
return $this->handleApiError(
|
||||
'Booking inquiry failed',
|
||||
['message' => $inquiryResponse->message],
|
||||
'Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.',
|
||||
$inquiryResponse->message ?? 'Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.',
|
||||
$bookingCreateDto,
|
||||
$form
|
||||
);
|
||||
}
|
||||
|
||||
if (false === $inquiryResponse->isInquiryValid()) {
|
||||
$errorMessage = 'Buchung konnte nicht validiert werden.';
|
||||
if (null !== $inquiryResponse->message && '' !== trim($inquiryResponse->message)) {
|
||||
$errorMessage .= ' '.$inquiryResponse->message;
|
||||
}
|
||||
|
||||
return $this->handleApiError(
|
||||
'Booking inquiry validation failed',
|
||||
['status' => $inquiryResponse->status],
|
||||
'Buchung konnte nicht validiert werden.',
|
||||
['status' => $inquiryResponse->status, 'message' => $inquiryResponse->message],
|
||||
$errorMessage,
|
||||
$bookingCreateDto,
|
||||
$form
|
||||
);
|
||||
|
||||
@@ -76,17 +76,22 @@ class Step4Controller extends AbstractController
|
||||
return $this->handleApiError(
|
||||
'Booking creation failed - API notification',
|
||||
['message' => $bookingResponse->message],
|
||||
$bookingResponse->message,
|
||||
$bookingResponse->message ?? 'Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.',
|
||||
$bookingCreateDto,
|
||||
$form
|
||||
);
|
||||
}
|
||||
|
||||
if (false === $bookingResponse->isBookingSuccessful()) {
|
||||
$errorMessage = 'Buchung konnte nicht erstellt werden.';
|
||||
if (null !== $bookingResponse->message && '' !== trim($bookingResponse->message)) {
|
||||
$errorMessage .= ' '.$bookingResponse->message;
|
||||
}
|
||||
|
||||
return $this->handleApiError(
|
||||
'Booking creation unsuccessful',
|
||||
['status' => $bookingResponse->status],
|
||||
'Buchung konnte nicht erstellt werden.',
|
||||
['status' => $bookingResponse->status, 'message' => $bookingResponse->message],
|
||||
$errorMessage,
|
||||
$bookingCreateDto,
|
||||
$form
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user