initial commit
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\ClientsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ClientsRepository::class)]
|
||||
class Clients
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $strName = null;
|
||||
|
||||
#[ORM\Column(type: Types::BIGINT)]
|
||||
private ?int $intNIP = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $strAddress = null;
|
||||
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $strEmail = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateLegitimacy = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateProclamation = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Schedule>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Schedule::class, mappedBy: 'client')]
|
||||
private Collection $schedules;
|
||||
|
||||
#[ORM\Column(options: ["default" => "0"])]
|
||||
private bool $isDeleted = false;
|
||||
|
||||
#[ORM\Column(options: ["default" => "0"])]
|
||||
private bool $isComplete = false;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $intPhone = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->schedules = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getStrName(): ?string
|
||||
{
|
||||
return $this->strName;
|
||||
}
|
||||
|
||||
public function setStrName(string $strName): static
|
||||
{
|
||||
$this->strName = $strName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIntNIP(): ?int
|
||||
{
|
||||
return $this->intNIP;
|
||||
}
|
||||
|
||||
public function setIntNIP(int $intNIP): static
|
||||
{
|
||||
$this->intNIP = $intNIP;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStrAddress(): ?string
|
||||
{
|
||||
return $this->strAddress;
|
||||
}
|
||||
|
||||
public function setStrAddress(string $strAddress): static
|
||||
{
|
||||
$this->strAddress = $strAddress;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStrEmail(): ?string
|
||||
{
|
||||
return $this->strEmail;
|
||||
}
|
||||
|
||||
public function setStrEmail(string $strEmail): static
|
||||
{
|
||||
$this->strEmail = $strEmail;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/** Data prawomocności */
|
||||
public function getDateLegitimacy(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateLegitimacy;
|
||||
}
|
||||
/** Data prawomocności */
|
||||
|
||||
public function setDateLegitimacy(\DateTimeInterface $dateLegitimacy): static
|
||||
{
|
||||
$this->dateLegitimacy = $dateLegitimacy;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/** Data obwieszczenia */
|
||||
public function getDateProclamation(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateProclamation;
|
||||
}
|
||||
/** Data obwieszczenia */
|
||||
public function setDateProclamation(\DateTimeInterface $dateProclamation): static
|
||||
{
|
||||
$this->dateProclamation = $dateProclamation;
|
||||
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @return Collection<int, Schedule>
|
||||
*/
|
||||
public function getSchedules(): Collection
|
||||
{
|
||||
return $this->schedules;
|
||||
}
|
||||
|
||||
public function addSchedule(Schedule $schedule): static
|
||||
{
|
||||
if (!$this->schedules->contains($schedule)) {
|
||||
$this->schedules->add($schedule);
|
||||
$schedule->setClient($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeSchedule(Schedule $schedule): static
|
||||
{
|
||||
if ($this->schedules->removeElement($schedule)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($schedule->getClient() === $this) {
|
||||
$schedule->setClient(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDeleted(): bool
|
||||
{
|
||||
return $this->isDeleted;
|
||||
}
|
||||
|
||||
public function setDeleted(bool $isDeleted): static
|
||||
{
|
||||
$this->isDeleted = $isDeleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isComplete(): ?bool
|
||||
{
|
||||
return $this->isComplete;
|
||||
}
|
||||
|
||||
public function setComplete(bool $isComplete): static
|
||||
{
|
||||
$this->isComplete = $isComplete;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getIntPhone(): ?int
|
||||
{
|
||||
return $this->intPhone;
|
||||
}
|
||||
|
||||
public function setIntPhone(?int $intPhone): static
|
||||
{
|
||||
$this->intPhone = $intPhone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\NotesRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: NotesRepository::class)]
|
||||
class Notes
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $clientId = null;
|
||||
|
||||
#[ORM\Column(type: Types::TEXT)]
|
||||
private ?string $description = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClientId(): ?int
|
||||
{
|
||||
return $this->clientId;
|
||||
}
|
||||
|
||||
public function setClientId(?int $clientId): void
|
||||
{
|
||||
$this->clientId = $clientId;
|
||||
}
|
||||
|
||||
|
||||
public function getDescription(): ?string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setDescription(string $description): static
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enum\ReportStatus;
|
||||
use App\Enum\ReportTodoEnum;
|
||||
use App\Repository\ReportsRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReportsRepository::class)]
|
||||
class Reports
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(referencedColumnName: "id", nullable: false)]
|
||||
private ?Clients $client = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateStart = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, ReportsTodo>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: ReportsTodo::class, mappedBy: 'report', orphanRemoval: true)]
|
||||
|
||||
private Collection $reportsTodos;
|
||||
|
||||
#[ORM\Column(options: ["default" => "0"])]
|
||||
private bool $isDelete = false;
|
||||
|
||||
private int $numberOfReport = 0;
|
||||
|
||||
#[ORM\Column(options: ["default" => "0"])]
|
||||
private bool $isDone = false;
|
||||
|
||||
#[ORM\Column]
|
||||
private ?int $number = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->reportsTodos = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getDateStart(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateStart;
|
||||
}
|
||||
|
||||
public function setDateStart(\DateTimeInterface $dateStart): static
|
||||
{
|
||||
$this->dateStart = $dateStart;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getClient(): ?Clients
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?Clients $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ReportsTodo>
|
||||
*/
|
||||
public function getReportsTodos(): Collection
|
||||
{
|
||||
return $this->reportsTodos;
|
||||
}
|
||||
|
||||
public function addReportsTodo(ReportsTodo $reportsTodo): static
|
||||
{
|
||||
if (!$this->reportsTodos->contains($reportsTodo)) {
|
||||
$this->reportsTodos->add($reportsTodo);
|
||||
$reportsTodo->setReport($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeReportsTodo(ReportsTodo $reportsTodo): static
|
||||
{
|
||||
if ($this->reportsTodos->removeElement($reportsTodo)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($reportsTodo->getReport() === $this) {
|
||||
$reportsTodo->setReport(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isReportsTodo(ReportTodoEnum $enum): bool
|
||||
{
|
||||
$return = false;
|
||||
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||
if ($reportsTodo->getName() === $enum) {
|
||||
$return = !$reportsTodo->isDeleted();
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function countTodoReports(): int
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||
if (!$reportsTodo->isDeleted()) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
public function takeStatusTodo(): ReportStatus
|
||||
{
|
||||
if ($this->countTodoReports() === 0) {
|
||||
return ReportStatus::INSERT;
|
||||
}
|
||||
$status = ReportStatus::WORKING;
|
||||
foreach ($this->getReportsTodos() as $reportsTodo) {
|
||||
if ($reportsTodo->isDeleted()) {
|
||||
continue;
|
||||
}
|
||||
if ($reportsTodo->getName() === ReportTodoEnum::COMPLETE) {
|
||||
$status = ReportStatus::COMPLETE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $status;
|
||||
}
|
||||
|
||||
public function isDelete(): ?bool
|
||||
{
|
||||
return $this->isDelete;
|
||||
}
|
||||
|
||||
public function setDelete(bool $isDelete): static
|
||||
{
|
||||
$this->isDelete = $isDelete;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNumberOfReport(): int
|
||||
{
|
||||
return $this->numberOfReport;
|
||||
}
|
||||
|
||||
public function setNumberOfReport(int $numberOfReport): void
|
||||
{
|
||||
$this->numberOfReport = $numberOfReport;
|
||||
}
|
||||
|
||||
public function isDone(): bool
|
||||
{
|
||||
return $this->isDone;
|
||||
}
|
||||
|
||||
public function setDone(bool $isDone): static
|
||||
{
|
||||
$this->isDone = $isDone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNumber(): ?int
|
||||
{
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
public function setNumber(int $number): static
|
||||
{
|
||||
$this->number = $number;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enum\ReportStatus;
|
||||
use App\Enum\ReportTodoEnum;
|
||||
use App\Repository\ReportsTodoRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ReportsTodoRepository::class)]
|
||||
class ReportsTodo
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(type: Types::SMALLINT, enumType: ReportTodoEnum::class)]
|
||||
private ?ReportTodoEnum $name = null;
|
||||
|
||||
#[ORM\ManyToOne]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'id', nullable: false)]
|
||||
private ?Reports $report = null;
|
||||
|
||||
#[ORM\Column(options: ["default" => false])]
|
||||
private ?bool $deleted = false;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getName(): ReportTodoEnum
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setName(ReportTodoEnum $name): static
|
||||
{
|
||||
$this->name = $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReport(): ?Reports
|
||||
{
|
||||
return $this->report;
|
||||
}
|
||||
|
||||
public function setReport(?Reports $report): static
|
||||
{
|
||||
$this->report = $report;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDeleted(): ?bool
|
||||
{
|
||||
return $this->deleted;
|
||||
}
|
||||
|
||||
public function setDeleted(bool $deleted): static
|
||||
{
|
||||
$this->deleted = $deleted;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Enum\ScheduleStatus;
|
||||
use App\Repository\ScheduleRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: ScheduleRepository::class)]
|
||||
class Schedule
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\ManyToOne(inversedBy: 'schedules')]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
private ?Clients $client = null;
|
||||
|
||||
#[ORM\Column(type: Types::DATE_MUTABLE)]
|
||||
private ?\DateTimeInterface $dateEnd = null;
|
||||
|
||||
#[ORM\Column(options: ["default" => "0"])]
|
||||
private bool $isDone = false;
|
||||
|
||||
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
|
||||
private ?\DateTimeInterface $dateDone = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getClient(): ?Clients
|
||||
{
|
||||
return $this->client;
|
||||
}
|
||||
|
||||
public function setClient(?Clients $client): static
|
||||
{
|
||||
$this->client = $client;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDateEnd(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateEnd;
|
||||
}
|
||||
|
||||
public function setDateEnd(\DateTimeInterface $dateEnd): static
|
||||
{
|
||||
$this->dateEnd = $dateEnd;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function isDone(): bool
|
||||
{
|
||||
return $this->isDone;
|
||||
}
|
||||
|
||||
public function setDone(bool $isDone): static
|
||||
{
|
||||
$this->isDone = $isDone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeLeft(): int
|
||||
{
|
||||
$today = new \DateTime();
|
||||
$diff = $today->diff($this->getDateEnd());
|
||||
// $diff = $this->getDateEnd()->diff($today);
|
||||
return $diff->format("%r%a");
|
||||
}
|
||||
|
||||
public function getDateDone(): ?\DateTimeInterface
|
||||
{
|
||||
return $this->dateDone;
|
||||
}
|
||||
|
||||
public function setDateDone(?\DateTimeInterface $dateDone): static
|
||||
{
|
||||
$this->dateDone = $dateDone;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): ScheduleStatus
|
||||
{
|
||||
$enum = ScheduleStatus::TODO;
|
||||
if ($this->getTimeLeft() < 7){
|
||||
$enum = ScheduleStatus::INCOMING;
|
||||
}
|
||||
if ($this->getTimeLeft() < 2){
|
||||
$enum = ScheduleStatus::OVERDUE;
|
||||
}
|
||||
if ($this->isDone()){
|
||||
$enum = ScheduleStatus::COMPLETED;
|
||||
}
|
||||
|
||||
return $enum;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
use Symfony\Component\Security\Core\User\UserInterface;
|
||||
|
||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||
#[ORM\UniqueConstraint(name: 'UNIQ_IDENTIFIER_USERNAME', fields: ['username'])]
|
||||
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\GeneratedValue]
|
||||
#[ORM\Column]
|
||||
private ?int $id = null;
|
||||
|
||||
#[ORM\Column(length: 180)]
|
||||
private ?string $username = null;
|
||||
|
||||
/**
|
||||
* @var list<string> The user roles
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private array $roles = [];
|
||||
|
||||
/**
|
||||
* @var string The hashed password
|
||||
*/
|
||||
#[ORM\Column]
|
||||
private ?string $password = null;
|
||||
|
||||
public function getId(): ?int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function getUsername(): ?string
|
||||
{
|
||||
return $this->username;
|
||||
}
|
||||
|
||||
public function setUsername(string $username): static
|
||||
{
|
||||
$this->username = $username;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A visual identifier that represents this user.
|
||||
*
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function getUserIdentifier(): string
|
||||
{
|
||||
return (string) $this->username;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*
|
||||
* @return list<string>
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
$roles = $this->roles;
|
||||
// guarantee every user at least has ROLE_USER
|
||||
$roles[] = 'ROLE_USER';
|
||||
|
||||
return array_unique($roles);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param list<string> $roles
|
||||
*/
|
||||
public function setRoles(array $roles): static
|
||||
{
|
||||
$this->roles = $roles;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PasswordAuthenticatedUserInterface
|
||||
*/
|
||||
public function getPassword(): string
|
||||
{
|
||||
return $this->password;
|
||||
}
|
||||
|
||||
public function setPassword(string $password): static
|
||||
{
|
||||
$this->password = $password;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UserInterface
|
||||
*/
|
||||
public function eraseCredentials(): void
|
||||
{
|
||||
// If you store any temporary, sensitive data on the user, clear it here
|
||||
// $this->plainPassword = null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user