feat: implement screendesign

This commit is contained in:
Björn Fromme
2025-12-06 15:02:33 +01:00
parent b206c3990b
commit bfb1a04ea0
84 changed files with 2807 additions and 2603 deletions
+30 -4
View File
@@ -69,10 +69,14 @@ class BookingSummaryDataService
// Calculate participant count from room capacity (source of truth)
$participantCount = $this->calculateParticipantCountFromRooms($bookingDto);
// Calculate payable amount after voucher deductions
$payableAmount = $this->calculatePayableAmount($bookingDto, $pricingData['grandTotal'], $participantPrices);
return new BookingSummaryDto(
selectedRooms: $selectedRooms,
participantCount: $participantCount,
totalPrice: number_format($totalPrice, 2, ',', '.').' €',
totalPrice: $pricingData['grandTotal'],
payableAmount: $payableAmount,
groupedSelectedRooms: $groupedSelectedRooms,
assignmentCounts: $roomCounts,
pricingData: $pricingData,
@@ -81,13 +85,35 @@ class BookingSummaryDataService
}
/**
* Calculates participant count from room selections.
* Calculates the payable amount after voucher deductions.
*
* This is the source of truth for participant count, calculated by
* multiplying each selected room's quantity by its maximum capacity (maxPax).
* @param array<int, float> $participantPrices Prices per participant for percentage voucher calculation
*/
private function calculatePayableAmount(BookingDto $bookingDto, float $grandTotal, array $participantPrices): float
{
$acceptedVouchers = $bookingDto->getAcceptedVouchers($participantPrices);
if (null === $acceptedVouchers) {
return $grandTotal;
}
return max(0.0, $grandTotal - $acceptedVouchers->getTotalDiscount());
}
/**
* Calculates participant count.
*
* In edit mode, counts actual participants. In create mode, calculates
* from room selections by multiplying quantity by maximum capacity (maxPax).
*/
private function calculateParticipantCountFromRooms(BookingDto $bookingDto): int
{
// In edit mode, use actual participant count
if (BookingDto::MODE_EDIT === $bookingDto->getMode()) {
return count($bookingDto->participants);
}
// In create mode, calculate from room selections
$totalCapacity = 0;
$availableRooms = $bookingDto->travel->getAvailableRooms();