wip: prepare transportation services
This commit is contained in:
@@ -6,6 +6,7 @@ use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Booking;
|
||||
use App\BusProNet\Model\PersonalData;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\Utility\DirectionMapper;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
class BookingEditDto implements BookingDtoInterface
|
||||
@@ -34,24 +35,37 @@ class BookingEditDto implements BookingDtoInterface
|
||||
|
||||
$participantData->courses = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_COURSES);
|
||||
|
||||
|
||||
// Skipass is single selection - take first item from array or null
|
||||
$skipasses = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_SKI_PASS);
|
||||
$participantData->skiPass = !empty($skipasses) ? $skipasses[0] : null;
|
||||
|
||||
|
||||
$participantData->additionalServices = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_ADDITIONAL);
|
||||
$participantData->board = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_BOARD);
|
||||
$participantData->rentals = $booking
|
||||
->getAdditionalServicesForParticipantByGroup($index, Constants::TOKEN_RENTALS);
|
||||
// Different keys for direction used in booking data (H <=> HIN, R <=> RUECK)!
|
||||
$participantData->transportationServiceTo = $booking
|
||||
->getTransportationServiceForParticipantAndDirection($index, 'H');
|
||||
$participantData->transportationServiceFro = $booking
|
||||
->getTransportationServiceForParticipantAndDirection($index, 'R');
|
||||
$participantData->pickup = $booking->getPickupForParticipant($index);
|
||||
// Transportation services using improved direction mapping
|
||||
// Direction mapping handles BusProNet's inconsistent codes (H <=> HIN, R <=> RUECK)
|
||||
$outboundTransportation = $booking
|
||||
->getTransportationServiceForParticipantAndDirection($index, DirectionMapper::OUTBOUND_BOOKING);
|
||||
$inboundTransportation = $booking
|
||||
->getTransportationServiceForParticipantAndDirection($index, DirectionMapper::INBOUND_BOOKING);
|
||||
|
||||
// Set new improved property names
|
||||
$participantData->transportationOutbound = $outboundTransportation;
|
||||
$participantData->transportationInbound = $inboundTransportation;
|
||||
|
||||
// Backward compatibility: also set deprecated properties
|
||||
$participantData->transportationServiceTo = $outboundTransportation;
|
||||
$participantData->transportationServiceFro = $inboundTransportation;
|
||||
|
||||
// Pickup handling (currently only supports outbound pickup)
|
||||
$pickupOutbound = $booking->getPickupForParticipant($index);
|
||||
$participantData->pickupOutbound = $pickupOutbound;
|
||||
$participantData->pickup = $pickupOutbound; // Backward compatibility
|
||||
|
||||
$instance->participants[$index] = $participantData;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,19 @@ class ParticipantDto
|
||||
public ?Service $skiPass = null;
|
||||
public array $board = [];
|
||||
public array $rentals = [];
|
||||
|
||||
// Transportation services with improved naming (outbound/inbound)
|
||||
public ?Service $transportationOutbound = null;
|
||||
public ?Service $transportationInbound = null;
|
||||
|
||||
// Pickup locations for each direction
|
||||
public ?Pickup $pickupOutbound = null;
|
||||
public ?Pickup $pickupInbound = null;
|
||||
|
||||
// Parking service for self-organized transportation
|
||||
public ?Service $parking = null;
|
||||
|
||||
// Deprecated properties for backward compatibility - will be removed in future version
|
||||
public ?Service $transportationServiceTo = null;
|
||||
public ?Service $transportationServiceFro = null;
|
||||
public ?Pickup $pickup = null;
|
||||
|
||||
Reference in New Issue
Block a user