change data filter on project month report (#2911)

This commit is contained in:
Kevin Papst
2021-11-05 09:45:12 +01:00
committed by GitHub
parent 042c119058
commit c8854b0775
15 changed files with 199 additions and 36 deletions

View File

@@ -13,6 +13,7 @@ use App\Form\Type\CustomerType;
use App\Form\Type\MonthPickerType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -45,9 +46,20 @@ class ProjectDateRangeForm extends AbstractType
'model_timezone' => $options['timezone'],
]);
$builder->add('includeNoBudget', CheckboxType::class, [
$builder->add('includeNoWork', CheckboxType::class, [
'required' => false,
'label' => 'label.includeNoBudget',
'label' => 'label.includeNoWork',
]);
$builder->add('budgetType', ChoiceType::class, [
'required' => true,
'multiple' => false,
'expanded' => true,
'choices' => [
'label.includeNoBudget' => 'none',
'label.includeBudgetType_full' => 'full',
'label.includeBudgetType_month' => 'month',
],
]);
}

View File

@@ -27,8 +27,8 @@ final class ProjectDateRangeQuery
*/
private $customer;
private $includeNoBudget = false;
private $onlyWithRecords = false;
private $includeNoWork = true;
private $budgetType = 'month';
public function __construct(\DateTime $month, User $user)
{
@@ -38,22 +38,17 @@ final class ProjectDateRangeQuery
public function isIncludeNoBudget(): bool
{
return $this->includeNoBudget;
return $this->budgetType === 'none';
}
public function setIncludeNoBudget(bool $includeNoBudget): void
public function isIncludeNoWork(): bool
{
$this->includeNoBudget = $includeNoBudget;
return $this->includeNoWork;
}
public function isOnlyWithRecords(): bool
public function setIncludeNoWork(bool $includeNoWork): void
{
return $this->onlyWithRecords;
}
public function setOnlyWithRecords(bool $onlyWithRecords): void
{
$this->onlyWithRecords = $onlyWithRecords;
$this->includeNoWork = $includeNoWork;
}
public function getUser(): ?User
@@ -61,12 +56,12 @@ final class ProjectDateRangeQuery
return $this->user;
}
public function getMonth(): \DateTime
public function getMonth(): ?\DateTime
{
return $this->month;
}
public function setMonth(\DateTime $month): void
public function setMonth(?\DateTime $month): void
{
$this->month = $month;
}
@@ -80,4 +75,19 @@ final class ProjectDateRangeQuery
{
$this->customer = $customer;
}
public function isBudgetTypeMonthly(): bool
{
return $this->budgetType === 'month';
}
public function getBudgetType(): ?string
{
return $this->budgetType;
}
public function setBudgetType(?string $budgetType): void
{
$this->budgetType = $budgetType;
}
}