chore: code cleanup
This commit is contained in:
@@ -17,7 +17,6 @@ use App\Form\BookingParticipantType;
|
||||
use App\Form\Model\BookingDto;
|
||||
use App\Form\Model\ParticipantEditDto;
|
||||
use App\Htmx\HxTrait;
|
||||
use App\Security\Crypt;
|
||||
use App\Service\BookingEditDataLoaderService;
|
||||
use App\Service\BookingEditDraftService;
|
||||
use App\Service\BookingFingerprintService;
|
||||
@@ -56,7 +55,6 @@ class IndexController extends AbstractController
|
||||
private readonly BookingFingerprintService $fingerprintService,
|
||||
private readonly BookingSummaryDataService $summaryDataService,
|
||||
private readonly ParticipantCardDataService $participantCardService,
|
||||
private readonly Crypt $crypt,
|
||||
private readonly LoggerInterface $logger,
|
||||
) {
|
||||
}
|
||||
@@ -70,12 +68,10 @@ class IndexController extends AbstractController
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$email = $user->getEmail();
|
||||
$password = $this->crypt->decrypt($user->getPassword());
|
||||
|
||||
// Load form data from session (or API on first load)
|
||||
try {
|
||||
$bookingDto = $this->dataLoader->loadFormData($request, $id, $email, $password, $user);
|
||||
$bookingDto = $this->dataLoader->loadFormData($request, $id, $user);
|
||||
} catch (TravelNotFoundException) {
|
||||
$this->addFlash('error', 'Reisedaten sind nicht (mehr) verfügbar');
|
||||
|
||||
@@ -94,7 +90,7 @@ class IndexController extends AbstractController
|
||||
}
|
||||
|
||||
// Fetch booking data for display (surcharges, canceled status, etc.)
|
||||
$bookingData = $this->dataLoader->fetchBookingData($email, $password, $id, $user);
|
||||
$bookingData = $this->dataLoader->fetchBookingData($id, $user);
|
||||
if (null === $bookingData || $bookingData instanceof Notification) {
|
||||
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
|
||||
|
||||
@@ -110,7 +106,7 @@ class IndexController extends AbstractController
|
||||
|
||||
// Handle form submission (clicking "Buchung aktualisieren")
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
return $this->handleFormSubmission($request, $bookingDto, $id, $email, $user);
|
||||
return $this->handleFormSubmission($request, $bookingDto, $id, $user);
|
||||
}
|
||||
|
||||
// Always generate card data with validation state to show completeness
|
||||
@@ -147,8 +143,6 @@ class IndexController extends AbstractController
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$email = $user->getEmail();
|
||||
$password = $this->crypt->decrypt($user->getPassword());
|
||||
|
||||
// Load form data from session
|
||||
$bookingDto = $this->bookingService->getBookingDto($request, BookingDto::MODE_EDIT);
|
||||
@@ -166,7 +160,7 @@ class IndexController extends AbstractController
|
||||
}
|
||||
|
||||
// Fetch booking data to check for canceled status
|
||||
$bookingData = $this->dataLoader->fetchBookingData($email, $password, $id, $user);
|
||||
$bookingData = $this->dataLoader->fetchBookingData($id, $user);
|
||||
if (null === $bookingData || $bookingData instanceof Notification) {
|
||||
$this->addFlash('error', 'Buchungsdaten nicht (mehr) verfügbar');
|
||||
|
||||
@@ -255,8 +249,6 @@ class IndexController extends AbstractController
|
||||
{
|
||||
/** @var User $user */
|
||||
$user = $this->getUser();
|
||||
$email = $user->getEmail();
|
||||
$password = $this->crypt->decrypt($user->getPassword());
|
||||
|
||||
// Load form data from session
|
||||
$bookingDto = $this->bookingService->getBookingDto($request, BookingDto::MODE_EDIT);
|
||||
@@ -269,7 +261,7 @@ class IndexController extends AbstractController
|
||||
$this->travelDataService->enrichWithFreshAvailabilities($bookingDto->travel);
|
||||
|
||||
// Fetch booking data and mutable data
|
||||
$bookingData = $this->dataLoader->fetchBookingData($email, $password, $id, $user);
|
||||
$bookingData = $this->dataLoader->fetchBookingData($id, $user);
|
||||
$mutableData = null !== $bookingData && !($bookingData instanceof Notification)
|
||||
? $this->travelDataService->getMutabilityData($bookingData->dateId)
|
||||
: null;
|
||||
@@ -394,8 +386,10 @@ class IndexController extends AbstractController
|
||||
/**
|
||||
* Handles form submission for booking update.
|
||||
*/
|
||||
private function handleFormSubmission(Request $request, BookingDto $bookingDto, int $id, string $email, User $user): Response
|
||||
private function handleFormSubmission(Request $request, BookingDto $bookingDto, int $id, User $user): Response
|
||||
{
|
||||
$email = $user->getEmail();
|
||||
|
||||
$this->logger->info('Initiated booking update', [
|
||||
'email' => $email,
|
||||
'booking_id' => $id,
|
||||
|
||||
Reference in New Issue
Block a user