wip: refactor to cards with individual participant forms
This commit is contained in:
@@ -76,27 +76,34 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
/**
|
||||
* Determines if this handler should process the field based on submitted data.
|
||||
*
|
||||
* For insurance selection fields, we always need to process to handle cases
|
||||
* where the selection is cleared (field not present in data). This ensures
|
||||
* the participant DTO is updated with null when no insurance is selected.
|
||||
* Insurance handler should NOT process in edit mode because the BPN API does not
|
||||
* return insurance data. In edit mode, insurance data must be preserved as-is
|
||||
* and passed through to the update endpoint unchanged.
|
||||
*
|
||||
* However, when bulk insurance booking is active for a dependent participant,
|
||||
* we skip processing to prevent overwriting the insurance assigned by the
|
||||
* bulk insurance handler.
|
||||
* In create mode, we always need to process to handle cases where the selection
|
||||
* is cleared (field not present in data). However, when bulk insurance booking
|
||||
* is active for a dependent participant, we skip processing to prevent overwriting
|
||||
* the insurance assigned by the bulk insurance handler.
|
||||
*
|
||||
* @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 processing should occur, false if bulk insurance handles it
|
||||
* @return bool True if processing should occur, false otherwise
|
||||
*/
|
||||
public function shouldProcess(array $submittedData, int $participantIndex): bool
|
||||
public function shouldProcess(array $submittedData, string $mode, int $participantIndex): bool
|
||||
{
|
||||
// In edit mode, insurance data is not available from API - skip processing entirely
|
||||
if ($mode === BookingDto::MODE_EDIT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Skip processing for dependent participants when bulk insurance booking is active
|
||||
if ($participantIndex > 0 && $this->isBulkInsuranceBookingActive($submittedData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true; // Always process to handle deselection cases
|
||||
return true; // Always process in create mode to handle deselection cases
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user