wip: insurance booking phase 4

This commit is contained in:
Björn Fromme
2026-03-16 11:59:10 +01:00
parent 6c9da6537e
commit c67fa18ad3
2 changed files with 116 additions and 0 deletions
+34
View File
@@ -2,6 +2,7 @@
namespace App\Form\Model;
use App\BusProNet\Model\Insurance;
use App\BusProNet\Model\PersonalData;
use App\BusProNet\Model\Pickup;
use App\BusProNet\Model\Service;
@@ -70,6 +71,9 @@ class ParticipantDto
// License plate for participants with parking (optional, visible only when parking is selected)
public ?string $licensePlate = null;
// Selected insurance for this participant (individual insurance selection per participant)
public ?Insurance $insurance = null;
public static function fromPersonalData(PersonalData $personalData): static
{
$instance = new static();
@@ -127,4 +131,34 @@ class ParticipantDto
return $this->dateOfBirth->diff($referenceDate)->y;
}
/**
* Checks if the participant has selected an insurance.
*
* @return bool True if an insurance is selected
*/
public function hasInsurance(): bool
{
return null !== $this->insurance;
}
/**
* Gets the insurance label for display purposes.
*
* @return string|null The insurance label or null if no insurance selected
*/
public function getInsuranceLabel(): ?string
{
return $this->insurance?->label;
}
/**
* Gets the insurance price for pricing calculations.
*
* @return float The insurance price (0.0 if no insurance selected)
*/
public function getInsurancePrice(): float
{
return $this->insurance?->price ?? 0.0;
}
}