exports: activityDate filter enable to activity linked to acl

This commit is contained in:
Mathieu Jaumotte 2022-08-17 17:14:24 +02:00
parent c199bb5534
commit d04d758f27

View File

@ -13,11 +13,11 @@ namespace Chill\ActivityBundle\Export\Filter;
use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Export\Declarations;
use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Export\FilterInterface;
use Chill\MainBundle\Form\Type\ChillDateType;
use Chill\MainBundle\Form\Type\Export\FilterType; use Chill\MainBundle\Form\Type\Export\FilterType;
use DateTime; use DateTime;
use Doctrine\ORM\Query\Expr; use Doctrine\ORM\Query\Expr;
use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormError;
use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvent;
@ -60,34 +60,21 @@ class ActivityDateFilter implements FilterInterface
public function applyOn(): string public function applyOn(): string
{ {
return Declarations::ACTIVITY_PERSON; return Declarations::ACTIVITY;
} }
public function buildForm(FormBuilderInterface $builder) public function buildForm(FormBuilderInterface $builder)
{ {
$builder->add( $builder
'date_from', ->add('date_from', ChillDateType::class, [
DateType::class,
[
'label' => 'Activities after this date', 'label' => 'Activities after this date',
'data' => new DateTime(), 'data' => new DateTime(),
'attr' => ['class' => 'datepicker'], ])
'widget' => 'single_text', ->add('date_to', ChillDateType::class, [
'format' => 'dd-MM-yyyy',
]
);
$builder->add(
'date_to',
DateType::class,
[
'label' => 'Activities before this date', 'label' => 'Activities before this date',
'data' => new DateTime(), 'data' => new DateTime(),
'attr' => ['class' => 'datepicker'], ])
'widget' => 'single_text', ;
'format' => 'dd-MM-yyyy',
]
);
$builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) {
/** @var \Symfony\Component\Form\FormInterface $filterForm */ /** @var \Symfony\Component\Form\FormInterface $filterForm */