feat: consistent display of included services and prices
This commit is contained in:
@@ -102,10 +102,14 @@ class BookingEditParticipantType extends AbstractType
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => function (?Service $service) use ($participantIndex) {
|
||||
$price = $service->individualPrice[$participantIndex] ?? $service->price;
|
||||
if (null === $price || 0.0 === $price) {
|
||||
if (null === $price) {
|
||||
return $service->label;
|
||||
}
|
||||
|
||||
if (0.0 === $price) {
|
||||
return sprintf('%s (inkl.)', $service->label);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'%s (%s €)',
|
||||
$service->label,
|
||||
@@ -256,10 +260,14 @@ class BookingEditParticipantType extends AbstractType
|
||||
|
||||
$price = $pickup->price;
|
||||
|
||||
if (null === $price || 0.0 === $price) {
|
||||
if (null === $price) {
|
||||
return $pickupLabel;
|
||||
}
|
||||
|
||||
if (0.0 === $price) {
|
||||
return sprintf('%s (inkl.)', $pickupLabel);
|
||||
}
|
||||
|
||||
return sprintf(
|
||||
'%s %s€',
|
||||
$pickupLabel,
|
||||
|
||||
@@ -605,10 +605,14 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
return '';
|
||||
}
|
||||
|
||||
if (null === $service->price || 0.0 === $service->price) {
|
||||
if (null === $service->price) {
|
||||
return $service->label;
|
||||
}
|
||||
|
||||
if (0.0 === $service->price) {
|
||||
return sprintf('%s (inkl.)', $service->label);
|
||||
}
|
||||
|
||||
if ($service->price < 0) {
|
||||
// Negative prices are discounts
|
||||
return sprintf('%s (-%s€ Rabatt)', $service->label, number_format(abs($service->price), 2, ',', '.'));
|
||||
|
||||
Reference in New Issue
Block a user