feat: inform user about automatic reassignments or reset selections
This commit is contained in:
@@ -151,6 +151,13 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
$bookingDto
|
||||
);
|
||||
$participant->insurance = $reassignedInsurance;
|
||||
|
||||
if (null !== $reassignedInsurance) {
|
||||
$participant->addNotification(
|
||||
'info',
|
||||
sprintf('Versicherung automatisch angepasst: %s', $reassignedInsurance->label)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Insurance not found - clear selection
|
||||
@@ -174,6 +181,14 @@ class ParticipantInsuranceFieldHandler extends AbstractParticipantFieldHandler
|
||||
$participant,
|
||||
$bookingDto
|
||||
);
|
||||
|
||||
if (null !== $reassignedInsurance && $reassignedInsurance->id !== $currentInsurance->id) {
|
||||
$participant->addNotification(
|
||||
'info',
|
||||
sprintf('Versicherung automatisch angepasst an neuen Preis: %s', $reassignedInsurance->label)
|
||||
);
|
||||
}
|
||||
|
||||
$participant->insurance = $reassignedInsurance; // null if no suitable match found
|
||||
}
|
||||
|
||||
|
||||
@@ -64,9 +64,18 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
|
||||
return;
|
||||
}
|
||||
|
||||
// Store previous rental state BEFORE checking skipass
|
||||
$previousRentals = $participant->rentals;
|
||||
|
||||
// Check if rentals should be available based on skipass selection
|
||||
if (null === $participant->skiPass) {
|
||||
// No skipass selected = clear all rental selections
|
||||
if ([] !== $previousRentals) {
|
||||
$participant->addNotification(
|
||||
'warning',
|
||||
'Ausrüstung wurde entfernt (kein Skipass ausgewählt)'
|
||||
);
|
||||
}
|
||||
$participant->rentals = [];
|
||||
|
||||
return;
|
||||
@@ -85,6 +94,14 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
|
||||
$participantIndex
|
||||
);
|
||||
|
||||
// Notify if rentals were cleared due to skipass duration change
|
||||
if ([] !== $previousRentals && [] === $validSelections) {
|
||||
$participant->addNotification(
|
||||
'warning',
|
||||
'Ausrüstung wurde entfernt (andere Skipass-Dauer ausgewählt)'
|
||||
);
|
||||
}
|
||||
|
||||
$participant->rentals = $validSelections;
|
||||
}
|
||||
|
||||
@@ -168,7 +185,7 @@ class ParticipantRentalsFieldHandler extends AbstractParticipantFieldHandler
|
||||
* - rental.dateFrom === skipass.dateFrom
|
||||
* - rental.dateTo === skipass.dateTo
|
||||
*
|
||||
* @param array $rentals All available rental services
|
||||
* @param array $rentals All available rental services
|
||||
* @param \App\Form\Model\ParticipantDto $participant The participant with skipass selection
|
||||
*
|
||||
* @return array Filtered rentals matching the skipass duration
|
||||
|
||||
Reference in New Issue
Block a user