fix: allow updating room assignments in edit mode

This commit is contained in:
Björn Fromme
2026-03-16 12:02:59 +01:00
parent 380b1ed329
commit f46cc59041
11 changed files with 191 additions and 21 deletions
+2 -2
View File
@@ -237,8 +237,8 @@ class ParticipantCardDataService
} else {
$groups[] = 'booking_edit';
// In edit mode, add strict_required only if applicant is immutable
if (false === ($bookingDto->participants[0]?->mutable ?? true)) {
// Strict validation in edit mode except for internal agency bookings
if (false === $bookingDto->isInternalAgencyBooking()) {
$groups[] = 'strict_required';
}
}
+9 -1
View File
@@ -135,6 +135,10 @@ class RoomPricingCalculator
}
}
// Count current participant assignments from the DTO (reflects live state
// including new assignments not yet in the booking entity)
$assignmentCounts = $bookingDto->getRoomAssignmentCounts();
// Build pricing array
foreach ($roomGroups as $roomId => $data) {
$room = $data['room'];
@@ -144,10 +148,14 @@ class RoomPricingCalculator
// Calculate average unit price (price per person)
$unitPrice = $participantCount > 0 ? $totalPrice / $participantCount : 0.0;
// Use live assignment count for quantity display so the sidebar reflects
// new room assignments that haven't been persisted to the booking entity yet
$quantity = $assignmentCounts[$roomId] ?? $room->totalCount;
$roomPricing[] = [
'roomId' => $room->id,
'label' => $room->label,
'quantity' => $room->totalCount,
'quantity' => $quantity,
'participantCount' => $participantCount,
'unitPrice' => $unitPrice,
'totalPrice' => $totalPrice,