wip: insurance booking in edit flow

This commit is contained in:
Björn Fromme
2025-10-07 18:09:16 +02:00
parent 7304fb50c6
commit c3008d7f7a
10 changed files with 1215 additions and 0 deletions
+19
View File
@@ -42,6 +42,7 @@ class Booking
public array $pickupsOutbound = [];
public array $pickupsInbound = [];
public array $surcharges = [];
public array $insurances = [];
public ?int $invoiceNumber = null;
public ?float $totalPrice = null;
public ?string $travelInfoUrl = null;
@@ -150,6 +151,24 @@ class Booking
return null;
}
/**
* Gets the insurance assigned to a specific participant.
*
* @param int $participantIndex The participant index (0-based)
*
* @return Insurance|null The assigned insurance or null if none assigned
*/
public function getInsuranceForParticipant(int $participantIndex): ?Insurance
{
foreach ($this->insurances as $insurance) {
if (in_array($participantIndex, $insurance->mapping ?? [], true)) {
return $insurance;
}
}
return null;
}
/**
* Retrieves ski pass for a specific participant.
*
+10
View File
@@ -95,6 +95,16 @@ class Insurance
#[Groups(['api:single', 'api:list'])]
public array $containedInsuranceIds = [];
/**
* @var array<int> Participant indices assigned to this insurance (booking data only)
*/
public array $mapping = [];
/**
* @var array<int, float> Individual prices per participant index (booking data only)
*/
public array $individualPrice = [];
public function __toString(): string
{
return (string) $this->id;