feat: implement screendesign
This commit is contained in:
@@ -167,7 +167,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$participantIndex
|
||||
),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => fn (?Service $service) => $this->formatServiceLabelWithPrice($service),
|
||||
'choice_label' => fn (?Service $service) => $service?->label,
|
||||
'choice_attr' => function (?Service $service) use ($bookingDto, $participantIndex) {
|
||||
if (null === $service) {
|
||||
return [];
|
||||
@@ -205,7 +205,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$participantIndex
|
||||
),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => fn (?Service $service) => $this->formatServiceLabelWithPrice($service),
|
||||
'choice_label' => fn (?Service $service) => $service?->label,
|
||||
'choice_attr' => function (?Service $service) use ($bookingDto, $participantIndex) {
|
||||
if (null === $service) {
|
||||
return [];
|
||||
@@ -251,7 +251,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$participantIndex
|
||||
),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => fn (?Service $service) => $this->formatServiceLabelWithPrice($service),
|
||||
'choice_label' => fn (?Service $service) => $service?->label,
|
||||
'choice_attr' => function (?Service $service) use ($bookingDto, $participantIndex) {
|
||||
if (null === $service) {
|
||||
return [];
|
||||
@@ -294,7 +294,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$participantIndex
|
||||
),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => fn (?Service $service) => $this->formatServiceLabelWithPrice($service),
|
||||
'choice_label' => fn (?Service $service) => $service?->label,
|
||||
'choice_attr' => function (?Service $service) use ($bookingDto, $participantIndex) {
|
||||
if (null === $service) {
|
||||
return [];
|
||||
@@ -353,7 +353,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$participantIndex
|
||||
),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => fn (?Service $service) => $this->formatServiceLabelWithPrice($service),
|
||||
'choice_label' => fn (?Service $service) => $service?->label,
|
||||
'choice_attr' => function (?Service $service) use ($bookingDto, $participantIndex) {
|
||||
if (null === $service) {
|
||||
return [];
|
||||
@@ -396,7 +396,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$bookingDto,
|
||||
$participantIndex
|
||||
),
|
||||
'choice_label' => fn (Service $service) => $this->formatTransportationServiceLabel($service),
|
||||
'choice_label' => fn (Service $service) => $service?->label,
|
||||
'choice_value' => 'id',
|
||||
'expanded' => true,
|
||||
'multiple' => false,
|
||||
@@ -427,7 +427,7 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
$this->fieldOptionProviders['transportationInbound'] = fn (BookingDto $bookingDto, int $participantIndex, array $options = []) => [
|
||||
'label' => 'Rückfahrt',
|
||||
'choices' => $bookingDto->travel->getTransportationServicesByDirection(DirectionMapper::INBOUND_TRAVEL),
|
||||
'choice_label' => fn (Service $service) => $this->formatTransportationServiceLabel($service),
|
||||
'choice_label' => fn (Service $service) => $service?->label,
|
||||
'choice_value' => 'id',
|
||||
'expanded' => true,
|
||||
'multiple' => false,
|
||||
@@ -653,41 +653,6 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
return sprintf('%s (€%s)', $service->label, number_format($service->price, 2, ',', '.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Format transportation service labels with type indicator and pricing.
|
||||
*
|
||||
* Creates user-friendly labels for transportation services that include:
|
||||
* - Transportation type icon (🚌 for bus, 🚗 for car)
|
||||
* - Service name
|
||||
* - Pricing (with discount indication for negative prices)
|
||||
* - Availability warning for limited services
|
||||
*
|
||||
* @param Service $service The transportation service to format
|
||||
*
|
||||
* @return string The formatted transportation service label
|
||||
*/
|
||||
private function formatTransportationServiceLabel(Service $service): string
|
||||
{
|
||||
$label = $service->label;
|
||||
|
||||
if (null === $service->price || 0.0 === $service->price) {
|
||||
return $service->label;
|
||||
}
|
||||
|
||||
if ($service->price > 0) {
|
||||
$label .= sprintf(' (€%s)', number_format($service->price, 2, ',', '.'));
|
||||
} else {
|
||||
$label .= sprintf(' (-%s€ Rabatt)', number_format(abs($service->price), 2, ',', '.'));
|
||||
}
|
||||
|
||||
// Add availability warning if limited
|
||||
if (null !== $service->available && $service->available <= 5) {
|
||||
$label .= sprintf(' (nur %d verfügbar)', $service->available);
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
private function formatPickupLabelWithPrice(?Pickup $pickup): string
|
||||
{
|
||||
if (null === $pickup) {
|
||||
@@ -935,11 +900,6 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
*/
|
||||
private function filterTransportationChoices(array $services, BookingDto $bookingDto, int $participantIndex): array
|
||||
{
|
||||
// Only apply filtering in create mode
|
||||
if (BookingDto::MODE_CREATE !== $bookingDto->getMode()) {
|
||||
return $services;
|
||||
}
|
||||
|
||||
// Separate PKW/CAR from other services (BUS, etc.)
|
||||
$pkwServices = [];
|
||||
$otherServices = [];
|
||||
|
||||
Reference in New Issue
Block a user