feat: improved dynamic validation
This commit is contained in:
@@ -103,9 +103,7 @@ class IndexController extends AbstractController
|
||||
$mutableData = $this->travelDataService->getMutabilityData($bookingData->dateId);
|
||||
|
||||
// Create validation form (same pattern as CreateStep2Controller)
|
||||
$form = $this->createForm(BookingEditType::class, $bookingDto, [
|
||||
'validation_groups' => ['booking_edit'],
|
||||
]);
|
||||
$form = $this->createForm(BookingEditType::class, $bookingDto);
|
||||
$form->handleRequest($request);
|
||||
|
||||
// Handle form submission (clicking "Buchung aktualisieren")
|
||||
@@ -155,8 +153,10 @@ class IndexController extends AbstractController
|
||||
return $this->hxRedirect($request, $this->generateUrl('app_booking_edit', ['id' => $id]));
|
||||
}
|
||||
|
||||
// Generate card data for all participants
|
||||
$cardsData = $this->participantCardService->getAllCardsData($bookingDto);
|
||||
// Generate card data for all participants with validation state if form was submitted and failed
|
||||
$cardsData = (true === $form->isSubmitted() && false === $form->isValid())
|
||||
? $this->participantCardService->getAllCardsDataWithValidation($bookingDto)
|
||||
: $this->participantCardService->getAllCardsData($bookingDto);
|
||||
|
||||
// Calculate summary data for sidebar
|
||||
$summary = $this->bookingService->getRoomSummaryAndParticipantCount($bookingDto);
|
||||
@@ -255,7 +255,6 @@ class IndexController extends AbstractController
|
||||
// Create form for participant with booking context
|
||||
$form = $this->createForm(BookingParticipantType::class, $wrapper, [
|
||||
'booking_context' => $bookingDto,
|
||||
'validation_groups' => ['booking_edit'],
|
||||
]);
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
Reference in New Issue
Block a user