mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
ByEndDateFilter evaluation
This commit is contained in:
@@ -12,9 +12,12 @@ declare(strict_types=1);
|
||||
namespace Chill\PersonBundle\Export\Filter\EvaluationFilters;
|
||||
|
||||
use Chill\MainBundle\Export\FilterInterface;
|
||||
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||
use Chill\PersonBundle\Export\Declarations;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use DateTime;
|
||||
|
||||
class ByEndDateFilter implements FilterInterface
|
||||
{
|
||||
@@ -26,10 +29,9 @@ class ByEndDateFilter implements FilterInterface
|
||||
public function alterQuery(QueryBuilder $qb, $data)
|
||||
{
|
||||
$qb
|
||||
->andWhere(
|
||||
$qb->expr()->in('', ':')
|
||||
)
|
||||
->setParameter('', $data[]);
|
||||
->andWhere('workeval.endDate IS BETWEEN :start_date and :end_date')
|
||||
->setParameter('start_date', $data['start_date'], Types::DATE_IMMUTABLE)
|
||||
->setParameter('end_date', $data['end_date'], Types::DATE_IMMUTABLE);
|
||||
}
|
||||
|
||||
public function applyOn(): string
|
||||
@@ -39,12 +41,22 @@ class ByEndDateFilter implements FilterInterface
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add();
|
||||
$builder
|
||||
->add('start_date', ChillDateType::class, [
|
||||
'label' => 'start period date',
|
||||
'data' => new DateTime(),
|
||||
])
|
||||
->add('end_date', ChillDateType::class, [
|
||||
'label' => 'end period date',
|
||||
'data' => new DateTime(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function describeAction($data, $format = 'string'): array
|
||||
{
|
||||
return ['', [
|
||||
return ['Filtered by end date: between %start_date% and %end_date%', [
|
||||
'%start_date%' => $data['start_date']->format('d-m-Y'),
|
||||
'%end_date%' => $data['end_date']->format('d-m-Y'),
|
||||
]];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user