wip: refactor to cards with individual participant forms

This commit is contained in:
Björn Fromme committed 2026-03-16 11:59:10 +01:00
1 parent 33e1aea80c
commit de8cbf6178
22 files changed
+866 -212

No files matched your search

@@ -36,14 +36,15 @@ abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandle
*
* Default implementation checks if the field exists in the submitted data.
* Override this method for more complex processing conditions (e.g., only
* process if certain other conditions are met).
* process if certain other conditions are met, or skip processing in edit mode).
*
* @param array<string, mixed> $submittedData The submitted participant form data
* @param string $mode The booking mode (BookingDto::MODE_CREATE or MODE_EDIT)
* @param int $participantIndex The index of the participant being processed
*
* @return bool True if the handler should process this field, false otherwise
*/
public function shouldProcess(array $submittedData, int $participantIndex): bool
public function shouldProcess(array $submittedData, string $mode, int $participantIndex): bool
{
return isset($submittedData[$this->getFieldName()]);
}
@@ -67,6 +68,35 @@ abstract class AbstractParticipantFieldHandler implements ParticipantFieldHandle
return $participants[$participantIndex] ?? null;
}
/**
* Checks if the booking flow is in edit mode.
*
* Handlers may need to behave differently in edit mode, particularly when
* dealing with data that isn't returned by the BPN API (like insurance selections).
* In edit mode, missing data doesn't mean "clear this field" - it means the API
* doesn't provide it and it should be preserved as-is.
*
* @param BookingDto $bookingDto The booking DTO to check
*
* @return bool True if in edit mode, false otherwise
*/
protected function isEditMode(BookingDto $bookingDto): bool
{
return $bookingDto->mode === BookingDto::MODE_EDIT;
}
/**
* Checks if the booking flow is in create mode.
*
* @param BookingDto $bookingDto The booking DTO to check
*
* @return bool True if in create mode, false otherwise
*/
protected function isCreateMode(BookingDto $bookingDto): bool
{
return $bookingDto->mode === BookingDto::MODE_CREATE;
}
/**
* Safely extracts a field value from submitted participant data.
*