feat: implement screendesign
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Exception\HotelNotFoundException;
|
||||
use App\Exception\HotelNotInTravelException;
|
||||
use App\Exception\NoRoomsAvailableException;
|
||||
use App\Exception\TravelNotFoundException;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Service\BookingService;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -24,6 +25,8 @@ use Symfony\Component\Routing\Attribute\Route;
|
||||
*/
|
||||
class IndexController extends AbstractController
|
||||
{
|
||||
use HxTrait;
|
||||
|
||||
public function __construct(
|
||||
private readonly BookingService $bookingService,
|
||||
private readonly AgencyLoader $agencyLoader,
|
||||
@@ -113,18 +116,22 @@ class IndexController extends AbstractController
|
||||
#[Route('/bookings/cancel', name: 'app_booking_cancel')]
|
||||
public function cancel(Request $request): Response
|
||||
{
|
||||
// Clear the booking session
|
||||
$this->bookingService->clearBookingSession($request);
|
||||
if (Request::METHOD_POST === $request->getMethod()) {
|
||||
// Clear the booking session
|
||||
$this->bookingService->clearBookingSession($request);
|
||||
|
||||
// Clear the security target path to prevent redirect loop after login
|
||||
// Without this, logging in after cancel would redirect back to a stale booking URL
|
||||
$request->getSession()->remove('_security.main.target_path');
|
||||
// Clear the security target path to prevent redirect loop after login
|
||||
// Without this, logging in after cancel would redirect back to a stale booking URL
|
||||
$request->getSession()->remove('_security.main.target_path');
|
||||
|
||||
// Add a flash message to inform the user
|
||||
$this->addFlash('info', 'Buchung abgebrochen.');
|
||||
// Add a flash message to inform the user
|
||||
$this->addFlash('info', 'Buchung abgebrochen.');
|
||||
|
||||
// Redirect to login page
|
||||
return $this->redirectToRoute('app_login');
|
||||
// Redirect to login page
|
||||
return $this->hxRedirect($request, $this->generateUrl('app_login'));
|
||||
}
|
||||
|
||||
return $this->render('booking/modal_cancel.html.twig');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user