feat: consistent display of included services and prices

This commit is contained in:
Björn Fromme
2025-12-11 11:17:03 +01:00
parent e42ef2d3c9
commit b4c03160ca
11 changed files with 54 additions and 27 deletions
+10 -2
View File
@@ -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, ',', '.'));