<?php
namespace App\Entity\Ajustes;
use App\Repository\Ajustes\DireccionRepository;
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=DireccionRepository::class)
*/
class Direccion
{
public const BASEDIR = '/pages/privado/ajustes/direcciones';
public const ICON_CLASS = 'fas fa-users-cog';
public const ICON = '<i class="'.self::ICON_CLASS.'"></i>';
public const ESTADOS = [
'Activo' => 1,
'Inactivo' => 0,
];
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"Simple"})
*/
private $id;
/**
* @Groups({"Simple"})
*/
private $text;
/**
* @ORM\ManyToOne(targetEntity=Usuario::class, inversedBy="direcciones")
* @ORM\JoinColumn(nullable=false)
*/
private $DirUser;
/**
* @ORM\Column(type="string", length=255)
*/
private $DirAddress;
/**
* @ORM\Column(type="string", length=255)
*/
private $DirCity;
/**
* @ORM\Column(type="string", length=255)
*/
private $DirProvincia;
/**
* @ORM\Column(type="string", length=255)
*/
private $DirPais;
/**
* @ORM\Column(type="string", length=255)
*/
private $DirCodPostal;
/**
* @ORM\Column(type="boolean")
*/
private $DirEnabled;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $DirTextoString;
public function __construct()
{
$this->DirEnabled = true;
}
public function __toString(): string
{
return (string) $this->DirAddress.'-'.$this->DirCodPostal.' '.$this->DirCity.' ('.$this->DirProvincia.')'.' '.$this->DirPais;
}
public function getId(): ?int
{
return $this->id;
}
public function getText(): string
{
return (string) $this->__toString();
}
public function getDirUser(): ?Usuario
{
return $this->DirUser;
}
public function setDirUser(?Usuario $DirUser): self
{
$this->DirUser = $DirUser;
return $this;
}
public function getDirAddress(): ?string
{
return $this->DirAddress;
}
public function setDirAddress(string $DirAddress): self
{
$this->DirAddress = $DirAddress;
return $this;
}
public function getDirCity(): ?string
{
return $this->DirCity;
}
public function setDirCity(string $DirCity): self
{
$this->DirCity = $DirCity;
return $this;
}
public function getDirProvincia(): ?string
{
return $this->DirProvincia;
}
public function setDirProvincia(string $DirProvincia): self
{
$this->DirProvincia = $DirProvincia;
return $this;
}
public function getDirPais(): ?string
{
return $this->DirPais;
}
public function setDirPais(string $DirPais): self
{
$this->DirPais = $DirPais;
return $this;
}
public function getDirCodPostal(): ?string
{
return $this->DirCodPostal;
}
public function setDirCodPostal(string $DirCodPostal): self
{
$this->DirCodPostal = $DirCodPostal;
return $this;
}
public function getDirEnabled(): ?bool
{
return $this->DirEnabled;
}
public function getDirEnabledTag(): string
{
return $this->DirEnabled ?
'<div class="badge badge-light-success">Activo</div>' :
'<div class="badge badge-light-danger">Inactivo</div>'
;
}
public function setDirEnabled(bool $DirEnabled): self
{
$this->DirEnabled = $DirEnabled;
return $this;
}
public function getDirTextoString(): ?string
{
return $this->DirTextoString;
}
public function setDirTextoString(?string $DirTextoString): self
{
$this->DirTextoString = $DirTextoString;
return $this;
}
}