wip: group inquiries and bookings
This commit is contained in:
1 parent
41424de151
commit
1a653726b4
115 files changed
+8107
-424
No files matched your search
@@ -0,0 +1,429 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Groups;
|
||||
|
||||
use App\Entity\BlameableEntity;
|
||||
use App\Entity\BlameableEntityInterface;
|
||||
use App\Entity\TimestampableEntity;
|
||||
use App\Entity\TimestampableEntityInterface;
|
||||
use App\Enum\Groups\AdditionalServiceType;
|
||||
use App\Repository\Groups\AccommodationBookingRepository;
|
||||
use Symfony\Component\Uid\Uuid;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
#[ORM\Entity(repositoryClass: AccommodationBookingRepository::class)]
|
||||
class AccommodationBooking implements BlameableEntityInterface, TimestampableEntityInterface
|
||||
{
|
||||
use BlameableEntity;
|
||||
use TimestampableEntity;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 36, unique: true)]
|
||||
private string $uuid;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Accommodation $accommodation = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||
private ?\DateTimeImmutable $dateFrom = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_IMMUTABLE)]
|
||||
private ?\DateTimeImmutable $dateTo = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private int $paxCount = 0;
|
||||
|
||||
#[ORM\Column]
|
||||
private int $minorsCount = 0;
|
||||
|
||||
#[ORM\Column]
|
||||
private int $childrenCount = 0;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $boardServiceLabel = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $boardServicePrice = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $boardServiceOriginalId = null;
|
||||
|
||||
#[ORM\Column(type: Types::JSON)]
|
||||
private array $additionalServices = [];
|
||||
|
||||
#[ORM\Column]
|
||||
private bool $isInquiry = false;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
private ?\DateTimeImmutable $accessLinkIssuedAt = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)]
|
||||
private ?\DateTimeImmutable $acceptedAt = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $groupName = null;
|
||||
|
||||
#[ORM\Column(length: 10, nullable: true)]
|
||||
private ?string $salutation = null;
|
||||
|
||||
#[ORM\Column(length: 100)]
|
||||
private ?string $firstName = null;
|
||||
|
||||
#[ORM\Column(length: 100)]
|
||||
private ?string $lastName = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $email = null;
|
||||
|
||||
#[ORM\Column(length: 50, nullable: true)]
|
||||
private ?string $phone = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $street = null;
|
||||
|
||||
#[ORM\Column(length: 20, nullable: true)]
|
||||
private ?string $zip = null;
|
||||
|
||||
#[ORM\Column(length: 100, nullable: true)]
|
||||
private ?string $city = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT, nullable: true)]
|
||||
private ?string $remarks = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
#[Assert\Positive(message: 'invalid')]
|
||||
private ?int $discount = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->uuid = Uuid::v4()->toRfc4122();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUuid(): string
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getAccommodation(): ?Accommodation
|
||||
{
|
||||
return $this->accommodation;
|
||||
}
|
||||
|
||||
public function setAccommodation(?Accommodation $accommodation): self
|
||||
{
|
||||
$this->accommodation = $accommodation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateFrom(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateFrom;
|
||||
}
|
||||
|
||||
public function setDateFrom(\DateTimeImmutable $dateFrom): self
|
||||
{
|
||||
$this->dateFrom = $dateFrom;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateTo(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->dateTo;
|
||||
}
|
||||
|
||||
public function setDateTo(\DateTimeImmutable $dateTo): self
|
||||
{
|
||||
$this->dateTo = $dateTo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNights(): int
|
||||
{
|
||||
if (null === $this->dateFrom || null === $this->dateTo) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->dateFrom->diff($this->dateTo)->days;
|
||||
}
|
||||
|
||||
public function getPaxCount(): int
|
||||
{
|
||||
return $this->paxCount;
|
||||
}
|
||||
|
||||
public function setPaxCount(int $paxCount): self
|
||||
{
|
||||
$this->paxCount = $paxCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMinorsCount(): int
|
||||
{
|
||||
return $this->minorsCount;
|
||||
}
|
||||
|
||||
public function setMinorsCount(int $minorsCount): self
|
||||
{
|
||||
$this->minorsCount = $minorsCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getChildrenCount(): int
|
||||
{
|
||||
return $this->childrenCount;
|
||||
}
|
||||
|
||||
public function setChildrenCount(int $childrenCount): self
|
||||
{
|
||||
$this->childrenCount = $childrenCount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBoardServiceLabel(): ?string
|
||||
{
|
||||
return $this->boardServiceLabel;
|
||||
}
|
||||
|
||||
public function setBoardServiceLabel(?string $boardServiceLabel): self
|
||||
{
|
||||
$this->boardServiceLabel = $boardServiceLabel;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBoardServicePrice(): ?int
|
||||
{
|
||||
return $this->boardServicePrice;
|
||||
}
|
||||
|
||||
public function setBoardServicePrice(?int $boardServicePrice): self
|
||||
{
|
||||
$this->boardServicePrice = $boardServicePrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBoardServiceOriginalId(): ?int
|
||||
{
|
||||
return $this->boardServiceOriginalId;
|
||||
}
|
||||
|
||||
public function setBoardServiceOriginalId(?int $boardServiceOriginalId): self
|
||||
{
|
||||
$this->boardServiceOriginalId = $boardServiceOriginalId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAdditionalServices(): array
|
||||
{
|
||||
return $this->additionalServices;
|
||||
}
|
||||
|
||||
public function setAdditionalServices(array $additionalServices): self
|
||||
{
|
||||
$this->additionalServices = $additionalServices;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addAdditionalServiceSnapshot(string $label, int $price, AdditionalServiceType|string $type, ?int $originalServiceId): self
|
||||
{
|
||||
$this->additionalServices[] = [
|
||||
'label' => $label,
|
||||
'price' => $price,
|
||||
'type' => $type instanceof AdditionalServiceType ? $type->value : $type,
|
||||
'originalServiceId' => $originalServiceId,
|
||||
];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isInquiry(): bool
|
||||
{
|
||||
return $this->isInquiry;
|
||||
}
|
||||
|
||||
public function setIsInquiry(bool $isInquiry): self
|
||||
{
|
||||
$this->isInquiry = $isInquiry;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAccessLinkIssuedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->accessLinkIssuedAt;
|
||||
}
|
||||
|
||||
public function setAccessLinkIssuedAt(?\DateTimeImmutable $accessLinkIssuedAt): self
|
||||
{
|
||||
$this->accessLinkIssuedAt = $accessLinkIssuedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAcceptedAt(): ?\DateTimeImmutable
|
||||
{
|
||||
return $this->acceptedAt;
|
||||
}
|
||||
|
||||
public function setAcceptedAt(?\DateTimeImmutable $acceptedAt): self
|
||||
{
|
||||
$this->acceptedAt = $acceptedAt;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getGroupName(): ?string
|
||||
{
|
||||
return $this->groupName;
|
||||
}
|
||||
|
||||
public function setGroupName(string $groupName): self
|
||||
{
|
||||
$this->groupName = $groupName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSalutation(): ?string
|
||||
{
|
||||
return $this->salutation;
|
||||
}
|
||||
|
||||
public function setSalutation(?string $salutation): self
|
||||
{
|
||||
$this->salutation = $salutation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFirstName(): ?string
|
||||
{
|
||||
return $this->firstName;
|
||||
}
|
||||
|
||||
public function setFirstName(string $firstName): self
|
||||
{
|
||||
$this->firstName = $firstName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLastName(): ?string
|
||||
{
|
||||
return $this->lastName;
|
||||
}
|
||||
|
||||
public function setLastName(string $lastName): self
|
||||
{
|
||||
$this->lastName = $lastName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEmail(): ?string
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
public function setEmail(string $email): self
|
||||
{
|
||||
$this->email = $email;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPhone(): ?string
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
public function setPhone(?string $phone): self
|
||||
{
|
||||
$this->phone = $phone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStreet(): ?string
|
||||
{
|
||||
return $this->street;
|
||||
}
|
||||
|
||||
public function setStreet(?string $street): self
|
||||
{
|
||||
$this->street = $street;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getZip(): ?string
|
||||
{
|
||||
return $this->zip;
|
||||
}
|
||||
|
||||
public function setZip(?string $zip): self
|
||||
{
|
||||
$this->zip = $zip;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCity(): ?string
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
public function setCity(?string $city): self
|
||||
{
|
||||
$this->city = $city;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRemarks(): ?string
|
||||
{
|
||||
return $this->remarks;
|
||||
}
|
||||
|
||||
public function setRemarks(?string $remarks): self
|
||||
{
|
||||
$this->remarks = $remarks;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDiscount(): ?int
|
||||
{
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
public function setDiscount(?int $discount): self
|
||||
{
|
||||
$this->discount = $discount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user