110 lines
3.7 KiB
PHP
110 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Form\Model;
|
|
|
|
use App\BusProNet\Model\PersonalData;
|
|
use App\BusProNet\Model\Pickup;
|
|
use App\BusProNet\Model\Service;
|
|
use App\Validator\Constraints as AppAssert;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
#[AppAssert\Participant(groups: ['booking_edit', 'booking_create_step_2'])]
|
|
class ParticipantDto
|
|
{
|
|
public ?int $index = null;
|
|
public ?int $addressId = null;
|
|
public ?int $personId = null;
|
|
public ?string $status = null;
|
|
public bool $mutable = false;
|
|
|
|
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['booking_edit', 'booking_create_step_2'])]
|
|
public ?string $firstName = null;
|
|
|
|
#[Assert\NotBlank(message: 'Bitte angeben', groups: ['booking_edit', 'booking_create_step_2'])]
|
|
public ?string $lastName = null;
|
|
public ?string $title = null;
|
|
public ?string $gender = null;
|
|
public ?string $nationality = null;
|
|
|
|
public ?string $height = null;
|
|
public ?string $shoeSize = null;
|
|
public ?string $weight = null;
|
|
|
|
#[Assert\NotNull(message: 'Bitte angeben', groups: ['booking_edit', 'booking_create_step_2'])]
|
|
public ?\DateTimeImmutable $dateOfBirth = null;
|
|
|
|
#[Assert\Email(message: 'Bitte eine gültige E-Mail Adresse angeben', mode: 'strict', groups: ['booking_edit', 'booking_create_step_2'])]
|
|
public ?string $email = null;
|
|
|
|
public ?string $mobile = null;
|
|
|
|
#[Assert\NotNull(message: 'Bitte ein Zimmer auswählen', groups: ['booking_create_step_2'])]
|
|
public ?int $assignedRoomId = null;
|
|
|
|
public ?string $remarksRoom = null;
|
|
|
|
public array $courses = [];
|
|
public array $additionalServices = [];
|
|
public ?Service $skiPass = null;
|
|
public array $board = [];
|
|
public array $rentals = [];
|
|
public ?Service $rentalInsurance = null;
|
|
|
|
// Rental insurance checkbox state (boolean: true if rental insurance requested)
|
|
public bool $rentalInsuranceSelected = false;
|
|
|
|
// Transportation services with improved naming (outbound/inbound)
|
|
public ?Service $transportationOutbound = null;
|
|
public ?Service $transportationInbound = null;
|
|
|
|
// Pickup locations for each direction
|
|
public ?Pickup $pickupOutbound = null;
|
|
public ?Pickup $pickupInbound = null;
|
|
|
|
// Parking service for self-organized transportation (boolean: true if parking requested)
|
|
public bool $parking = false;
|
|
|
|
// Parking service object for pricing calculation (new, contains actual service with pricing)
|
|
public ?Service $parkingService = null;
|
|
|
|
// License plate for participants with parking (optional, visible only when parking is selected)
|
|
public ?string $licensePlate = null;
|
|
|
|
public static function fromPersonalData(PersonalData $personalData): static
|
|
{
|
|
$instance = new static();
|
|
|
|
$instance->status = $personalData->status;
|
|
$instance->addressId = $personalData->addressId;
|
|
$instance->personId = $personalData->personId;
|
|
$instance->mutable = $personalData->mutable;
|
|
$instance->firstName = $personalData->firstName;
|
|
$instance->lastName = $personalData->name;
|
|
$instance->gender = $personalData->gender;
|
|
$instance->nationality = $personalData->nationality;
|
|
$instance->email = $personalData->communication?->email;
|
|
$instance->mobile = $personalData->communication?->mobile;
|
|
$instance->dateOfBirth = $personalData->dateOfBirth;
|
|
$instance->height = $personalData->height;
|
|
$instance->weight = $personalData->weight;
|
|
$instance->shoeSize = $personalData->shoeSize;
|
|
|
|
return $instance;
|
|
}
|
|
|
|
public function isApplicant(): bool
|
|
{
|
|
return 0 === $this->index;
|
|
}
|
|
|
|
public function isCanceled(): bool
|
|
{
|
|
return 'S' === $this->status;
|
|
}
|
|
|
|
public function isOption(): bool
|
|
{
|
|
return 'O' === $this->status;
|
|
}
|
|
}
|