<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\Criteria;
#[ORM\Table(name: 'quotes')]
#[ORM\Entity]
class Quotes
{
#[ORM\Column(name: 'id', type: 'integer', nullable: false)]
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'IDENTITY')]
private $id;
#[ORM\Column(name: 'price_sum', type: 'integer', nullable: true)]
private $priceSum;
#[ORM\Column(name: 'price_sum_br', type: 'integer', nullable: true)]
private $priceSumBr;
#[ORM\Column(name: 'note', type: 'text', length: 65535, nullable: true)]
private $note;
#[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
private $created;
#[ORM\Column(name: 'price_bodyguard', type: 'integer', nullable: true)]
private $priceBodyguard;
#[ORM\Column(name: 'price_paint', type: 'integer', nullable: true)]
private $pricePaint;
#[ORM\Column(name: 'price_assembly', type: 'integer', nullable: true)]
private $priceAssembly;
#[ORM\Column(name: 'tax', type: 'string', nullable: true)]
private $tax;
#[ORM\OneToMany(targetEntity: QuoteItems::class, mappedBy: 'quote', cascade: ['persist'], orphanRemoval: true)]
public $quoteItems;
#[ORM\OneToMany(targetEntity: Attachment::class, mappedBy: 'quote', cascade: ['persist'], orphanRemoval: true)]
public $attachments;
#[ORM\Column(name: 'modified', type: 'datetime', nullable: true, options: ['comment' => 'Módosítva'])]
private $modified;
#[ORM\Column(length: 255, nullable: true)]
private ?string $CustomerName = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $CustomerMail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $CustomerPhone = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $CustomerAddress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $Title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $OriginalText = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $ShortDesc = null;
#[ORM\Column]
private ?int $status = null;
public static $statuses = [
0 => 'Új',
1 => 'Kiküldve',
2 => 'Elfogadva',
3 => 'Pontosításra vár',
4 => 'Elutasítva',
];
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $sentMail = null;
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'quotes')]
private ?self $parent = null;
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class)]
private Collection $quotes;
public function __construct()
{
$this->created = new \DateTime();
$this->quoteItems = new ArrayCollection();
$this->attachments = new ArrayCollection();
$this->status = 0;
$this->quotes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTax(): ?string
{
return $this->tax;
}
public function setTax(?string $tax): self
{
$this->tax = $tax;
return $this;
}
public function getPriceSum(): ?int
{
return $this->priceSum;
}
public function setPriceSum(?int $priceSum): self
{
$this->priceSum = $priceSum;
return $this;
}
public function getPriceSumBr(): ?int
{
return $this->priceSumBr;
}
public function setPriceSumBr(?int $priceSumBr): self
{
$this->priceSumBr = $priceSumBr;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteItems(): Collection
{
return $this->quoteItems;
}
/* public function addQuoteItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
*/
/**
* @return Collection|QuoteItems[]
*/
public function getQuotePaintItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::PAINT));
return $this->quoteItems->matching($criteria);
}
public function addQuotePaintItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::PAINT);
if($this->getPricePaint() !== null){
$quoteItem->setPriceQty($this->pricePaint);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuotePaintItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
/*if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}*/
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteAssemblyItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::ASSEMBLY));
return $this->quoteItems->matching($criteria);
}
public function addQuoteAssemblyItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::ASSEMBLY);
if($this->getPriceAssembly() !== null){
$quoteItem->setPriceQty($this->priceAssembly);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteAssemblyItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteBodyguardItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::BODYGUARD));
return $this->quoteItems->matching($criteria);
}
public function addQuoteBodyguardItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::BODYGUARD);
if($this->getPriceBodyguard() !== null){
$quoteItem->setPriceQty($this->priceBodyguard);
}
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteBodyguardItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|QuoteItems[]
*/
public function getQuoteOtherItems(): Collection
{
$criteria = Criteria::create();
$criteria->where(Criteria::expr()->eq('type', QuoteItems::OTHER));
return $this->quoteItems->matching($criteria);
}
public function addQuoteOtherItem(QuoteItems $quoteItem): self
{
if (!$this->quoteItems->contains($quoteItem)) {
$quoteItem->setType(QuoteItems::OTHER);
$quoteItem->setQuote($this);
$this->quoteItems[] = $quoteItem;
}
return $this;
}
public function removeQuoteOtherItem(QuoteItems $quoteItem): self
{
if ($this->quoteItems->removeElement($quoteItem)) {
// set the owning side to null (unless already changed)
if ($quoteItem->getQuote() === $this) {
$quoteItem->setQuote(null);
}
}
return $this;
}
/**
* @return Collection|Attachment[]
*/
public function getAttachments(): Collection
{
return $this->attachments;
}
public function addAttachment(Attachment $photo): self
{
if (!$this->attachments->contains($photo)) {
$photo->setQuote($this);
$this->attachments[] = $photo;
}
return $this;
}
public function removeAttachment(Attachment $photo): self
{
if ($this->attachments->removeElement($photo)) {
// set the owning side to null (unless already changed)
if ($photo->getQuote() === $this) {
$photo->setQuote(null);
}
}
return $this;
}
public function getPriceBodyguard(): ?int
{
return $this->priceBodyguard;
}
public function setPriceBodyguard(?int $priceBodyguard): self
{
$this->priceBodyguard = $priceBodyguard;
return $this;
}
public function getPricePaint(): ?int
{
return $this->pricePaint;
}
public function setPricePaint(?int $pricePaint): self
{
$this->pricePaint = $pricePaint;
return $this;
}
public function getPriceAssembly(): ?int
{
return $this->priceAssembly;
}
public function setPriceAssembly(?int $priceAssembly): self
{
$this->priceAssembly = $priceAssembly;
return $this;
}
public function __toString()
{
return 'Ajánlat - '. $this->getCustomerName() . " - " . $this->getTitle();
}
public function rowCss(){
return "";
}
public function getModified(): ?\DateTimeInterface
{
return $this->modified;
}
public function getCustomerName(): ?string
{
return $this->CustomerName;
}
public function setCustomerName(?string $CustomerName): static
{
$this->CustomerName = $CustomerName;
return $this;
}
public function getCustomerMail(): ?string
{
return $this->CustomerMail;
}
public function setCustomerMail(string $CustomerMail): static
{
$this->CustomerMail = $CustomerMail;
return $this;
}
public function getCustomerPhone(): ?string
{
return $this->CustomerPhone;
}
public function setCustomerPhone(?string $CustomerPhone): static
{
$this->CustomerPhone = $CustomerPhone;
return $this;
}
public function getCustomerAddress(): ?string
{
return $this->CustomerAddress;
}
public function setCustomerAddress(?string $CustomerAddress): static
{
$this->CustomerAddress = $CustomerAddress;
return $this;
}
public function getTitle(): ?string
{
return $this->Title;
}
public function setTitle(string $Title): static
{
$this->Title = $Title;
return $this;
}
public function getOriginalText(): ?string
{
return $this->OriginalText;
}
public function setOriginalText(?string $OriginalText): static
{
$this->OriginalText = $OriginalText;
return $this;
}
public function getShortDesc(): ?string
{
return $this->ShortDesc;
}
public function setShortDesc(?string $ShortDesc): static
{
$this->ShortDesc = $ShortDesc;
return $this;
}
public function getStatus(): ?int
{
return $this->status;
}
public function setStatus(int $status): static
{
$this->status = $status;
return $this;
}
public function getSentMail(): ?string
{
return $this->sentMail;
}
public function setSentMail(?string $sentMail): static
{
$this->sentMail = $sentMail;
return $this;
}
public function getParent(): ?self
{
return $this->parent;
}
public function setParent(?self $parent): static
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getQuotes(): Collection
{
return $this->quotes;
}
public function addQuote(self $quote): static
{
if (!$this->quotes->contains($quote)) {
$this->quotes->add($quote);
$quote->setParent($this);
}
return $this;
}
public function removeQuote(self $quote): static
{
if ($this->quotes->removeElement($quote)) {
// set the owning side to null (unless already changed)
if ($quote->getParent() === $this) {
$quote->setParent(null);
}
}
return $this;
}
}