fix: show pickup select field for outbound bus travel only
This commit is contained in:
@@ -250,13 +250,10 @@ class CreateFieldStateProvider extends AbstractFieldStateProvider
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
// Show pickup only when either outbound or inbound transportation is BUS (hidden by default)
|
// Pickup field - shown only when outbound transportation is BUS (pickup is for outbound journey)
|
||||||
$this->fieldStateConditions['pickup'] = [
|
$this->fieldStateConditions['pickup'] = [
|
||||||
'hidden' => CompositeCondition::not(
|
'hidden' => CompositeCondition::not(
|
||||||
CompositeCondition::or(
|
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API)
|
||||||
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API),
|
|
||||||
ServiceSubTypeCondition::equals('transportationInbound', DirectionMapper::SUBTYPE_BUS_API)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -186,13 +186,10 @@ class EditFieldStateProvider extends AbstractFieldStateProvider
|
|||||||
'readonly' => $transportationServicesMutabilityCondition,
|
'readonly' => $transportationServicesMutabilityCondition,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Pickup field (unified) - shown only when either transportation direction is BUS, readonly if pickups not mutable
|
// Pickup field - shown only when outbound transportation is BUS (pickup is for outbound journey), readonly if pickups not mutable
|
||||||
$this->fieldStateConditions['pickup'] = [
|
$this->fieldStateConditions['pickup'] = [
|
||||||
'hidden' => CompositeCondition::not(
|
'hidden' => CompositeCondition::not(
|
||||||
CompositeCondition::or(
|
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API)
|
||||||
ServiceSubTypeCondition::equals('transportationOutbound', DirectionMapper::SUBTYPE_BUS_API),
|
|
||||||
ServiceSubTypeCondition::equals('transportationInbound', DirectionMapper::SUBTYPE_BUS_API)
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
'readonly' => $pickupsMutabilityCondition,
|
'readonly' => $pickupsMutabilityCondition,
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -9,13 +9,10 @@ use App\Form\Model\BookingDto;
|
|||||||
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
use App\Form\Service\Abstract\AbstractParticipantFieldHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles unified pickup location selection.
|
* Handles pickup location selection for the outbound bus journey.
|
||||||
*
|
*
|
||||||
* Pickup selection is only processed when either outbound or inbound
|
* Pickup is only processed when outbound transportation is bus type.
|
||||||
* transportation is bus type. Automatically clears pickup when both
|
* Automatically clears pickup when outbound changes to self-organized (PKW).
|
||||||
* transportation services change to self-organized (PKW).
|
|
||||||
*
|
|
||||||
* The pickup applies to both directions and uses the outbound pickup list.
|
|
||||||
*/
|
*/
|
||||||
class ParticipantPickupFieldHandler extends AbstractParticipantFieldHandler
|
class ParticipantPickupFieldHandler extends AbstractParticipantFieldHandler
|
||||||
{
|
{
|
||||||
@@ -41,15 +38,12 @@ class ParticipantPickupFieldHandler extends AbstractParticipantFieldHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if either outbound or inbound transportation is bus
|
// Pickup applies only to outbound bus journey - clear when outbound is not bus
|
||||||
$hasOutboundBus = null !== $participant->transportationOutbound
|
$hasOutboundBus = null !== $participant->transportationOutbound
|
||||||
&& DirectionMapper::SUBTYPE_BUS_API === $participant->transportationOutbound->subType;
|
&& DirectionMapper::SUBTYPE_BUS_API === $participant->transportationOutbound->subType;
|
||||||
$hasInboundBus = null !== $participant->transportationInbound
|
|
||||||
&& DirectionMapper::SUBTYPE_BUS_API === $participant->transportationInbound->subType;
|
|
||||||
|
|
||||||
// Only process pickup if at least one direction has bus transport
|
if (false === $hasOutboundBus) {
|
||||||
if (false === $hasOutboundBus && false === $hasInboundBus) {
|
$participant->pickup = null;
|
||||||
$participant->pickup = null; // Clear pickup for non-bus transport
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user