fix: allow updating room assignments in edit mode
This commit is contained in:
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user