feat: selectable drop-offs for inbound bus travel

This commit is contained in:
Björn Fromme
2026-03-16 12:03:00 +01:00
parent f8a56b7de2
commit f795a3ea21
31 changed files with 701 additions and 200 deletions
@@ -22,6 +22,7 @@ class ParticipantValidator extends ConstraintValidator
$participant = $value;
$this->assertPickupSelected($participant);
$this->assertDropOffSelected($participant);
$this->assertBodyDimensionsWhenRentalsSelected($participant);
}
@@ -42,6 +43,29 @@ class ParticipantValidator extends ConstraintValidator
}
}
public function assertDropOffSelected(ParticipantDto $participant): void
{
$hasOutboundBus = null !== $participant->transportationOutbound
&& 'BUS' === $participant->transportationOutbound->subType;
$hasInboundBus = null !== $participant->transportationInbound
&& 'BUS' === $participant->transportationInbound->subType;
if (false === $hasInboundBus) {
return;
}
// BUS+BUS: drop-off required only when differentDropOff checkbox is checked
// PKW+BUS: drop-off always required (no checkbox, field shown directly)
$requireDropOff = $hasOutboundBus ? $participant->differentDropOff : true;
if ($requireDropOff && null === $participant->dropOff) {
$this->context->buildViolation('Bitte auswählen')
->atPath('dropOff')
->addViolation()
;
}
}
public function assertBodyDimensionsWhenRentalsSelected(ParticipantDto $participant): void
{
// Check if any rental services are selected