wip: finalize implementation
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Form\Service;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use App\BusProNet\Model\Insurance;
|
||||
use App\BusProNet\Model\Pickup;
|
||||
use App\BusProNet\Model\Service;
|
||||
use App\BusProNet\Utility\DirectionMapper;
|
||||
@@ -45,13 +46,11 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
* @param ParticipantRoomChoiceLoaderFactory $roomChoiceLoaderFactory Factory for creating room choice loaders
|
||||
* @param ServiceAvailabilityCalculator $serviceAvailabilityCalculator Service for calculating dynamic availability
|
||||
* @param InsuranceMatchingService $insuranceMatchingService Service for matching insurances to participants
|
||||
* @param UrlGeneratorInterface $urlGenerator URL generator for HTMX endpoints
|
||||
*/
|
||||
public function __construct(
|
||||
private readonly ParticipantRoomChoiceLoaderFactory $roomChoiceLoaderFactory,
|
||||
private readonly ServiceAvailabilityCalculator $serviceAvailabilityCalculator,
|
||||
private readonly InsuranceMatchingService $insuranceMatchingService,
|
||||
private readonly UrlGeneratorInterface $urlGenerator,
|
||||
) {
|
||||
parent::__construct();
|
||||
}
|
||||
@@ -435,7 +434,18 @@ class ParticipantFieldOptionsProvider extends AbstractFieldOptionsProvider
|
||||
'multiple' => false,
|
||||
'expanded' => true,
|
||||
'required' => false,
|
||||
'insurances' => $this->getEligibleInsurances($bookingDto, $participantIndex),
|
||||
'choices' => $this->getEligibleInsurances($bookingDto, $participantIndex),
|
||||
'choice_value' => 'id',
|
||||
'choice_label' => function (?Insurance $insurance) {
|
||||
$label = $insurance->label;
|
||||
|
||||
if (null !== $insurance->price && $insurance->price > 0) {
|
||||
$label .= sprintf(' (€%s)', number_format($insurance->price, 2, ',', '.'));
|
||||
}
|
||||
|
||||
return $label;
|
||||
},
|
||||
'placeholder' => 'Keine Versicherung gewünscht',
|
||||
];
|
||||
|
||||
// Future field providers would be added here, for example:
|
||||
|
||||
Reference in New Issue
Block a user