diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php new file mode 100644 index 000000000..afe416f9f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorAggregator.php @@ -0,0 +1,69 @@ +add(); + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + + }; + } + + public function getQueryKeys($data): array + { + return []; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php new file mode 100644 index 000000000..ea53c4f80 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorJobAggregator.php @@ -0,0 +1,69 @@ +add(); + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + + }; + } + + public function getQueryKeys($data): array + { + return []; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator_job.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php new file mode 100644 index 000000000..e8eab62d4 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/CreatorScopeAggregator.php @@ -0,0 +1,69 @@ +add(); + } + + public function getFormDefaultData(): array + { + return []; + } + + public function getLabels($key, array $values, mixed $data) + { + return function ($value): string { + + }; + } + + public function getQueryKeys($data): array + { + return []; + } + + public function getTitle(): string + { + return 'export.aggregator.course_work.by_creator_scope.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php new file mode 100644 index 000000000..791b521af --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorFilter.php @@ -0,0 +1,85 @@ +join('acpw.createdBy', "{$p}_creator") + ->andWhere($qb->expr()->in("{$p}_creator", ":{$p}_creators")) + ->setParameter("{$p}_creators", $data['creators']) + //->setParameter("{$p}_calc_date", $this->rollingDateConverter->convert( + // $data['creator_at'] ?? new RollingDate(RollingDate::T_TODAY) + //)) + ; + + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('creators', PickUserDynamicType::class, [ + 'multiple' => true, + 'label' => 'export.filter.work.by_creator.Creators', + ]) + //->add('creator_at', PickRollingDateType::class, [ + // 'label' => 'export.filter.work.by_creator.Calc date', + // 'help' => 'export.filter.work.by_creator.calc_date_help', + //]) + ; + } + + public function describeAction($data, $format = 'string'): array + { + return []; + } + + public function getFormDefaultData(): array + { + return [ + 'creators' => [], + //'creator_at' => new RollingDate(RollingDate::T_TODAY), + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php new file mode 100644 index 000000000..28d31920d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorJobFilter.php @@ -0,0 +1,91 @@ +setParameter("{$p}_jobs", $data['jobs']) + ; + + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('jobs', EntityType::class, [ + 'class' => UserJob::class, + 'choices' => $this->userJobRepository->findAllActive(), + 'multiple' => true, + 'expanded' => true, + 'choice_label' => fn (UserJob $job) => $this->translatableStringHelper->localize($job->getLabel()), + 'label' => 'Job', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $creatorJobs = []; + + foreach ($data['jobs'] as $j) { + $creatorJobs[] = $this->translatableStringHelper->localize( + $j->getLabel() + ); + } + + return ['export.filter.work.by_creator_job.Filtered by creator job: only %jobs%', [ + '%jobs%' => implode(', ', $creatorJobs), + ]]; + } + + public function getFormDefaultData(): array + { + return [ + 'jobs' => [], + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator_job.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php new file mode 100644 index 000000000..f21bf320e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/CreatorScopeFilter.php @@ -0,0 +1,91 @@ +setParameter("{$p}_scopes", $data['scopes']) + ; + + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('scopes', EntityType::class, [ + 'class' => Scope::class, + 'choices' => $this->scopeRepository->findAllActive(), + 'choice_label' => fn (Scope $s) => $this->translatableStringHelper->localize($s->getName()), + 'multiple' => true, + 'expanded' => true, + 'label' => 'Scope', + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $creatorScopes = []; + + foreach ($data['scopes'] as $s) { + $creatorScopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['export.filter.work.by_creator_scope.Filtered by creator scope: only %scopes%', [ + '%scopes%' => implode(', ', $creatorScopes), + ]]; + } + + public function getFormDefaultData(): array + { + return [ + 'scopes' => [], + ]; + } + + public function getTitle(): string + { + return 'export.filter.work.by_creator_scope.title'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 3e6f12fe1..7bdf0345b 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -63,6 +63,19 @@ services: tags: - { name: chill.export_filter, alias: social_work_actions_end_btw_dates_filter } + Chill\PersonBundle\Export\Filter\SocialWorkFilters\CreatorFilter: + tags: + - { name: chill.export_filter, alias: social_work_actions_creator_filter } + + Chill\PersonBundle\Export\Filter\SocialWorkFilters\CreatorJobFilter: + tags: + - { name: chill.export_filter, alias: social_work_actions_creator_job_filter } + + Chill\PersonBundle\Export\Filter\SocialWorkFilters\CreatorScopeFilter: + tags: + - { name: chill.export_filter, alias: social_work_actions_creator_scope_filter } + + ## AGGREGATORS chill.person.export.aggregator_action_type: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator @@ -105,6 +118,18 @@ services: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\HandlingThirdPartyAggregator: tags: - { name: chill.export_aggregator, alias: accompanyingcourse_handling3party_aggregator } +# +# Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CreatorAggregator: +# tags: +# - { name: chill.export_aggregator, alias: social_work_actions_creator_aggregator } +# +# Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CreatorJobAggregator: +# tags: +# - { name: chill.export_aggregator, alias: social_work_actions_creator_job_aggregator } +# +# Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\CreatorScopeAggregator: +# tags: +# - { name: chill.export_aggregator, alias: social_work_actions_creator_scope_aggregator } Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\HandlingThirdPartyFilter: tags: diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 71b428920..6ee525f8b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -1094,6 +1094,12 @@ export: by_handling_third_party: title: Grouper les actions par tiers traitant header: Tiers traitant + by_creator: + title: Grouper les actions par créateur + by_creator_job: + title: Grouper les actions par métier du créateur + by_creator_scope: + title: Grouper les actions par service du créateur eval: by_end_date: @@ -1214,6 +1220,17 @@ export: title: Filtrer les actions par tiers traitant Only 3 parties %3parties%: "Seulement les actions d'accompagnement qui ont pour tiers traitant: %3parties%" pick_3parties: Tiers traitants des actions + by_creator: + title: Filtrer les actions par créateur + Creators: Créateur de l'action + #Calc date: Date à laquelle le créateur ... + #calc_date_help: Il s'agit de la date à laquelle le créateur ... + by_creator_job: + title: Filtrer les actions par métier du créateur + "Filtered by creator job: only %jobs%'": "Filtré par métier du créateur: uniquement %jobs%" + by_creator_scope: + title: Filtrer les actions par service du créateur + "Filtered by creator scope: only %scopes%'": "Filtré par service du créateur: uniquement %scopes%" list: person_with_acp: