Next major version 2 with PHP 8.1, Symfony 6, Tabler UI, 2FA ... (#2902)
This commit is contained in:
@@ -12,45 +12,36 @@ namespace App\Reporting\ProjectView;
|
||||
use App\Form\Type\CustomerType;
|
||||
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;
|
||||
|
||||
class ProjectViewForm extends AbstractType
|
||||
final class ProjectViewForm extends AbstractType
|
||||
{
|
||||
/**
|
||||
* Simplify cross linking between pages by removing the block prefix.
|
||||
*
|
||||
* @return null|string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('customer', CustomerType::class, [
|
||||
'required' => false,
|
||||
'label' => false,
|
||||
'width' => false,
|
||||
]);
|
||||
$builder->add('includeNoBudget', CheckboxType::class, [
|
||||
$builder->add('budgetType', ChoiceType::class, [
|
||||
'label' => false,
|
||||
'required' => false,
|
||||
'label' => 'label.includeNoBudget',
|
||||
'placeholder' => null,
|
||||
'expanded' => true,
|
||||
'choices' => [
|
||||
'all' => null,
|
||||
'includeWithBudget' => true,
|
||||
'includeNoBudget' => false
|
||||
]
|
||||
]);
|
||||
$builder->add('includeNoWork', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label' => 'label.includeNoWork',
|
||||
'label' => 'includeNoWork',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefaults([
|
||||
'data_class' => ProjectViewQuery::class,
|
||||
|
||||
@@ -15,31 +15,23 @@ use DateTime;
|
||||
|
||||
final class ProjectViewModel
|
||||
{
|
||||
private $project;
|
||||
private $timesheetCounter = 0;
|
||||
private $durationDay = 0;
|
||||
private $durationWeek = 0;
|
||||
private $durationMonth = 0;
|
||||
private $durationTotal = 0;
|
||||
private $rateTotal = 0.00;
|
||||
private $notExportedDuration = 0;
|
||||
private $notExportedRate = 0.00;
|
||||
private $notBilledDuration = 0;
|
||||
private $notBilledRate = 0.00;
|
||||
private $billableDuration = 0;
|
||||
private $billableRate = 0.00;
|
||||
/**
|
||||
* @var \DateTime|null
|
||||
*/
|
||||
private $lastRecord;
|
||||
/**
|
||||
* @var BudgetStatisticModelInterface
|
||||
*/
|
||||
private $budgetStatisticModel;
|
||||
private int $timesheetCounter = 0;
|
||||
private int $durationDay = 0;
|
||||
private int $durationWeek = 0;
|
||||
private int $durationMonth = 0;
|
||||
private int $durationTotal = 0;
|
||||
private float $rateTotal = 0.00;
|
||||
private int $notExportedDuration = 0;
|
||||
private float $notExportedRate = 0.00;
|
||||
private int $notBilledDuration = 0;
|
||||
private float $notBilledRate = 0.00;
|
||||
private int $billableDuration = 0;
|
||||
private float $billableRate = 0.00;
|
||||
private ?DateTime $lastRecord = null;
|
||||
private ?BudgetStatisticModelInterface $budgetStatisticModel = null;
|
||||
|
||||
public function __construct(Project $project)
|
||||
public function __construct(private Project $project)
|
||||
{
|
||||
$this->project = $project;
|
||||
}
|
||||
|
||||
public function getProject(): Project
|
||||
|
||||
@@ -15,31 +15,12 @@ use DateTime;
|
||||
|
||||
final class ProjectViewQuery
|
||||
{
|
||||
/**
|
||||
* @var Customer|null
|
||||
*/
|
||||
private $customer;
|
||||
/**
|
||||
* @var DateTime
|
||||
*/
|
||||
private $today;
|
||||
/**
|
||||
* @var User|null
|
||||
*/
|
||||
private $user;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $includeNoBudget = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $includeNoWork = false;
|
||||
private ?Customer $customer = null;
|
||||
private bool $includeNoWork = false;
|
||||
private ?bool $budgetType = true;
|
||||
|
||||
public function __construct(DateTime $today, User $user)
|
||||
public function __construct(private DateTime $today, private User $user)
|
||||
{
|
||||
$this->today = $today;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
public function getUser(): ?User
|
||||
@@ -47,14 +28,27 @@ final class ProjectViewQuery
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
public function isIncludeNoBudget(): bool
|
||||
public function getBudgetType(): ?bool
|
||||
{
|
||||
return $this->includeNoBudget;
|
||||
return $this->budgetType;
|
||||
}
|
||||
|
||||
public function setIncludeNoBudget(bool $includeNoBudget): void
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function setBudgetType(?bool $budgetType): void
|
||||
{
|
||||
$this->includeNoBudget = $includeNoBudget;
|
||||
$this->budgetType = $budgetType;
|
||||
}
|
||||
|
||||
public function isIncludeWithoutBudget(): bool
|
||||
{
|
||||
return $this->budgetType === false;
|
||||
}
|
||||
|
||||
public function isIncludeWithBudget(): bool
|
||||
{
|
||||
return $this->budgetType === true;
|
||||
}
|
||||
|
||||
public function isIncludeNoWork(): bool
|
||||
|
||||
Reference in New Issue
Block a user