fix: properly handle 'veg' services in booking edit flow
This commit is contained in:
@@ -96,6 +96,7 @@ class BookingChangeTracker
|
||||
'skiPass' => $participant->skiPass?->id,
|
||||
'courses' => $this->normalizeServiceArray($participant->courses),
|
||||
'board' => $this->normalizeServiceArray($participant->board),
|
||||
'veg' => $participant->veg?->id,
|
||||
'rentals' => $this->normalizeServiceArray($participant->rentals),
|
||||
'rentalInsurance' => $participant->rentalInsurance?->id,
|
||||
'additionalServices' => $this->normalizeServiceArray($participant->additionalServices),
|
||||
|
||||
@@ -209,6 +209,14 @@ class BookingEditDraftMerger
|
||||
$participant->board = $this->resolveServiceArray($data['board'], $travel->additionalServices);
|
||||
}
|
||||
|
||||
// Veg (single service) - merge strategy: only apply if resolves to valid service
|
||||
if (true === array_key_exists('veg', $data) && null !== $data['veg']) {
|
||||
$resolved = $this->resolveService($data['veg'], $travel->additionalServices);
|
||||
if (null !== $resolved) {
|
||||
$participant->veg = $resolved;
|
||||
}
|
||||
}
|
||||
|
||||
// Rentals (array) - overwrite strategy: user can deselect all
|
||||
if (true === array_key_exists('rentals', $data) && true === is_array($data['rentals'])) {
|
||||
$participant->rentals = $this->resolveServiceArray($data['rentals'], $travel->additionalServices);
|
||||
|
||||
@@ -93,6 +93,11 @@ class BookingEditSubmitGuard
|
||||
$changed = true;
|
||||
}
|
||||
|
||||
if (false === $this->isSameService($participant->veg, $baseline->veg)) {
|
||||
$participant->veg = $baseline->veg;
|
||||
$changed = true;
|
||||
}
|
||||
|
||||
if (false === $this->isSameService($participant->skiPass, $baseline->skiPass)) {
|
||||
$participant->skiPass = $baseline->skiPass;
|
||||
$changed = true;
|
||||
|
||||
Reference in New Issue
Block a user