wip: insurance booking in edit flow
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user