feat: implement hx-boost for reliable loading indication
This commit is contained in:
@@ -94,7 +94,7 @@ class Step2Controller extends AbstractController
|
||||
$this->bookingService->saveBookingDto($request, $bookingCreateDto, BookingDto::MODE_CREATE);
|
||||
|
||||
// Proceed to Step 3
|
||||
return $this->hxRedirect($request, $this->generateUrl('app_booking_create_step_3'));
|
||||
return $this->redirectToRoute('app_booking_create_step_3');
|
||||
}
|
||||
|
||||
// Generate cards data with validation state if form was submitted and failed
|
||||
@@ -112,17 +112,6 @@ class Step2Controller extends AbstractController
|
||||
'summaryData' => $summaryData,
|
||||
];
|
||||
|
||||
// HTMX request: render blocks only
|
||||
if ($this->isHxRequest($request)) {
|
||||
return $this->htmxOobResponse(
|
||||
'booking/create/step_2.html.twig',
|
||||
['participant_cards', 'booking_summary'],
|
||||
$templateData,
|
||||
$this->generateUrl('app_booking_create_step_2')
|
||||
);
|
||||
}
|
||||
|
||||
// Regular request: render full template
|
||||
return $this->render('booking/create/step_2.html.twig', $templateData);
|
||||
}
|
||||
|
||||
@@ -162,7 +151,7 @@ class Step2Controller extends AbstractController
|
||||
$this->addNotificationsAsFlashMessages($notifications);
|
||||
|
||||
// HTMX redirect to cards view
|
||||
return $this->hxRedirect($request, $this->generateUrl('app_booking_create_step_2'));
|
||||
return $this->redirectToRoute('app_booking_create_step_2');
|
||||
}
|
||||
|
||||
// Get complete summary data (pricing, rooms, CMS data)
|
||||
@@ -174,29 +163,8 @@ class Step2Controller extends AbstractController
|
||||
'bookingDto' => $bookingDto,
|
||||
'summaryData' => $summaryData,
|
||||
'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)) {
|
||||
$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
|
||||
return $this->render('booking/create/step_2_participant.html.twig', $templateData);
|
||||
}
|
||||
|
||||
@@ -226,8 +194,7 @@ class Step2Controller extends AbstractController
|
||||
$request,
|
||||
$bookingDto,
|
||||
$index,
|
||||
'app_booking_create_step_2_participant_refresh',
|
||||
'app_booking_create_step_2_participant'
|
||||
'app_booking_create_step_2_participant_refresh'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user