feat: surcharges and discounts per participant and in summary
This commit is contained in:
1 parent
cc8500d0f4
commit
cb38beb32c
3 files changed
+85
-1
No files matched your search
@@ -120,6 +120,31 @@ class ParticipantCardDataService
|
||||
*/
|
||||
private function getFormattedPrice(BookingDto $bookingDto, int $index): string
|
||||
{
|
||||
// Check if canceled (only possible in edit mode when booking property is set)
|
||||
$isCanceled = ($bookingDto->booking?->participantsStatus[$index] ?? null) === 'S';
|
||||
|
||||
if (true === $isCanceled) {
|
||||
// Calculate surcharge total for canceled participant
|
||||
if (null === $bookingDto->booking) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
$surcharges = $bookingDto->booking->getSurchargesForParticipant($index);
|
||||
$surchargeTotal = 0.0;
|
||||
|
||||
foreach ($surcharges as $surcharge) {
|
||||
$surchargeTotal += $surcharge->individualPrice[$index] ?? 0.0;
|
||||
}
|
||||
|
||||
// Show nothing if no surcharges, otherwise show "x,xx € Stornokosten"
|
||||
if (0.0 === $surchargeTotal) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return number_format($surchargeTotal, 2, ',', '.').' € Stornokosten';
|
||||
}
|
||||
|
||||
// For active participants: existing price calculation logic
|
||||
$prices = $this->priceCalculator->calculateAllParticipantIndividualPrices($bookingDto);
|
||||
|
||||
$price = $prices[$index] ?? 0.0;
|
||||
|
||||
Reference in new issue
Block a user