refactored invoice and export screens (#1046)

This commit is contained in:
Kevin Papst
2019-08-22 18:56:21 +02:00
committed by GitHub
parent 405ea0076b
commit 46e5650882
55 changed files with 930 additions and 906 deletions

View File

@@ -50,7 +50,7 @@ class BaseQuery
/**
* @var User
*/
private $user;
private $currentUser;
/**
* @var Team[]
*/
@@ -73,7 +73,7 @@ class BaseQuery
public function getCurrentUser(): ?User
{
return $this->user;
return $this->currentUser;
}
/**
@@ -82,7 +82,7 @@ class BaseQuery
*/
public function setCurrentUser(User $user)
{
$this->user = $user;
$this->currentUser = $user;
return $this;
}

View File

@@ -15,23 +15,32 @@ class ExportQuery extends TimesheetQuery
* @var string
*/
private $type;
/**
* @return string
* @var bool
*/
private $markAsExported = false;
public function getType(): ?string
{
return $this->type;
}
/**
* @param string $type
* @return ExportQuery
*/
public function setType(string $type)
public function setType(string $type): ExportQuery
{
$this->type = $type;
return $this;
}
public function isMarkAsExported(): bool
{
return $this->markAsExported;
}
public function setMarkAsExported(bool $markAsExported): ExportQuery
{
$this->markAsExported = $markAsExported;
return $this;
}
}

View File

@@ -11,32 +11,38 @@ namespace App\Repository\Query;
use App\Entity\InvoiceTemplate;
/**
* Can be used for invoice queries.
*/
class InvoiceQuery extends TimesheetQuery
{
/**
* @var InvoiceTemplate
*/
private $template;
/**
* @return InvoiceTemplate
* @var bool
*/
public function getTemplate()
private $markAsExported = false;
public function getTemplate(): ?InvoiceTemplate
{
return $this->template;
}
/**
* @param InvoiceTemplate $template
* @return InvoiceQuery
*/
public function setTemplate($template)
public function setTemplate(InvoiceTemplate $template): InvoiceQuery
{
$this->template = $template;
return $this;
}
public function isMarkAsExported(): bool
{
return $this->markAsExported;
}
public function setMarkAsExported(bool $markAsExported): InvoiceQuery
{
$this->markAsExported = $markAsExported;
return $this;
}
}

View File

@@ -49,6 +49,10 @@ class TimesheetQuery extends ActivityQuery
* @var iterable
*/
protected $tags = [];
/**
* @var User[]
*/
private $users = [];
public function __construct()
{
@@ -58,6 +62,30 @@ class TimesheetQuery extends ActivityQuery
$this->dateRange = new DateRange();
}
public function addUser(User $user): self
{
$this->users[$user->getId()] = $user;
return $this;
}
public function removeUser(User $user): self
{
if (isset($this->users[$user->getId()])) {
unset($this->users[$user->getId()]);
}
return $this;
}
/**
* @return User[]
*/
public function getUsers(): array
{
return array_values($this->users);
}
/**
* @return User|null
*/