Compare commits

...

25 Commits

Author SHA1 Message Date
26a5de9958 Merge branch 'issue178_169_export_calendars' of gitlab.com:Chill-Projet/chill-bundles into issue178_169_export_calendars 2023-11-16 12:03:43 +01:00
4e35bcbd93 Format yaml file back to they way it was before 2023-11-16 12:03:35 +01:00
7587472785 fix export.yaml file: remove quotes 2023-11-16 12:03:35 +01:00
9ba33f3df4 style fixes for tests 2023-11-16 12:03:35 +01:00
e0de10b7a8 Add tests for new exports calendar 2023-11-16 12:03:35 +01:00
33235d3541 php cs fixes 2023-11-16 12:03:35 +01:00
817ca7e148 add missing variables to two exports 2023-11-16 12:03:35 +01:00
382f275719 add translations 2023-11-16 12:03:35 +01:00
f78c1c0512 adjust logic for calendar exports linked to person 2023-11-16 12:03:35 +01:00
c3ced7fb6e add center filter to calendar exports linked to acp 2023-11-16 12:03:35 +01:00
96a9be39c3 reorganize exports calendar/ refactor config yaml 2023-11-16 12:03:35 +01:00
792ad394c8 Format yaml file back to they way it was before 2023-11-16 11:14:38 +01:00
ff344dbb0c Release 2.12.1 2023-11-16 11:07:34 +01:00
8719b4dedd Merge branch '208-export-fix-loading-by-type-goal-result' into 'master'
Resolve "Export: le chargement de l'app vue de "filtrer les actions par type, objectif et résultat" ne se charge pas sur certains exports"

Closes #208

See merge request Chill-Projet/chill-bundles!615
2023-11-16 10:05:56 +00:00
d8fa743bc9 Export: fix loading of form for "filter action by type, goal and result" 2023-11-16 10:57:59 +01:00
eaa40d6725 DX: remove some unnecessary console.log 2023-11-16 10:57:32 +01:00
a7141ef771 fix export.yaml file: remove quotes 2023-11-16 10:43:47 +01:00
bc638e5eb9 style fixes for tests 2023-11-15 16:38:57 +01:00
b0171e3093 Add tests for new exports calendar 2023-11-15 16:34:08 +01:00
b317daf779 php cs fixes 2023-11-15 16:20:10 +01:00
27bf2893d0 add missing variables to two exports 2023-11-15 16:19:43 +01:00
e2a12968ce add translations 2023-11-15 16:15:24 +01:00
fe9ce1a356 adjust logic for calendar exports linked to person 2023-11-15 15:58:41 +01:00
9c04212c45 add center filter to calendar exports linked to acp 2023-11-15 15:40:36 +01:00
85504d72c2 reorganize exports calendar/ refactor config yaml 2023-11-15 15:31:18 +01:00
17 changed files with 846 additions and 166 deletions

View File

@@ -15,7 +15,7 @@
* Export: fix typo in filter "filter accompanying period work on end date"
* ([#189](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/189)) Export: Fix failure in export linked to household
* ([#205](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/205)) Fix loading of accompanying period work referrers
### Traduction francophone des différents changements
### Traduction francophone des principaux changements
* export: ajout d'un regroupement "grouper les échanges par présence de l'usager";
* export: ajout d'un filtre "filtre les échanges par présence de l'usager";
* export: ajout d'un regroupement "regrouper les échanges par personne" (seulement pour les échanges enregistrés dans le contexte de l'usager);

3
.changes/v2.12.1.md Normal file
View File

@@ -0,0 +1,3 @@
## v2.12.1 - 2023-11-16
### Fixed
* ([#208](https://gitlab.com/Chill-Projet/chill-bundles/-/issues/208)) Export: fix loading of form for "filter action by type, goal and result"

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export;
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
@@ -17,17 +17,25 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Exception\LogicException;
class CountCalendars implements ExportInterface, GroupedExportInterface
{
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
) {}
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
@@ -46,12 +54,12 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
public function getDescription(): string
{
return 'Count calendars by various parameters.';
return 'export.export.count_calendar_linked_to_acp.description';
}
public function getGroup(): string
{
return 'Exports of calendar';
return 'export.export.calendar_linked_to_acp.group';
}
public function getLabels($key, array $values, $data)
@@ -78,7 +86,7 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
public function getTitle(): string
{
return 'Count calendars';
return 'export.export.count_calendar_linked_to_acp.title';
}
public function getType(): string
@@ -98,6 +106,19 @@ class CountCalendars implements ExportInterface, GroupedExportInterface
$qb->select('COUNT(cal.id) AS export_result');
$qb->leftJoin('cal.accompanyingPeriod', 'acp');
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
'
)
)
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export;
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
@@ -17,14 +17,24 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private readonly CalendarRepository $calendarRepository) {}
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
@@ -43,12 +53,12 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
public function getDescription(): string
{
return 'Get the average of calendar duration according to various filters';
return 'export.export.avg_duration_calendar_linked_to_acp.description';
}
public function getGroup(): string
{
return 'Exports of calendar';
return 'export.export.calendar_linked_to_acp.group';
}
public function getLabels($key, array $values, $data)
@@ -75,7 +85,7 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
public function getTitle(): string
{
return 'Average calendar duration';
return 'export.export.avg_duration_calendar_linked_to_acp.title';
}
public function getType(): string
@@ -85,11 +95,26 @@ class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.accompanyingPeriod', 'acp');
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
'
)
)
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;

View File

@@ -9,7 +9,7 @@ declare(strict_types=1);
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export;
namespace Chill\CalendarBundle\Export\Export\LinkedToAcp;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
@@ -17,14 +17,24 @@ use Chill\MainBundle\Export\AccompanyingCourseExportHelper;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Chill\PersonBundle\Entity\Person\PersonCenterHistory;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
public function __construct(private readonly CalendarRepository $calendarRepository) {}
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
@@ -43,12 +53,12 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
public function getDescription(): string
{
return 'Get the sum of calendar durations according to various filters';
return 'export.export.sum_duration_calendar_linked_to_acp.description';
}
public function getGroup(): string
{
return 'Exports of calendar';
return 'export.export.calendar_linked_to_acp.group';
}
public function getLabels($key, array $values, $data)
@@ -75,7 +85,7 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
public function getTitle(): string
{
return 'Sum of calendar durations';
return 'export.export.sum_duration_calendar_linked_to_acp.description';
}
public function getType(): string
@@ -85,11 +95,26 @@ class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.accompanyingPeriod', 'acp');
if ($this->filterStatsByCenters) {
$qb
->andWhere(
$qb->expr()->exists(
'SELECT 1 FROM '.AccompanyingPeriodParticipation::class.' acl_count_part
JOIN '.PersonCenterHistory::class.' acl_count_person_history WITH IDENTITY(acl_count_person_history.person) = IDENTITY(acl_count_part.person)
WHERE acl_count_part.accompanyingPeriod = acp.id AND acl_count_person_history.center IN (:authorized_centers)
'
)
)
->setParameter('authorized_centers', $centers);
}
AccompanyingCourseExportHelper::addClosingMotiveExclusionClause($qb);
return $qb;

View File

@@ -0,0 +1,137 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export\LinkedToPerson;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use Doctrine\ORM\AbstractQuery;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Exception\LogicException;
class CountCalendars implements ExportInterface, GroupedExportInterface
{
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder)
{
// No form necessary
}
public function getFormDefaultData(): array
{
return [];
}
public function getAllowedFormattersTypes(): array
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription(): string
{
return 'export.export.count_calendar_linked_to_person.description';
}
public function getGroup(): string
{
return 'export.export.calendar_linked_to_person.group';
}
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
{
return ['export_result'];
}
public function getResult($query, $data)
{
return $query->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR);
}
public function getTitle(): string
{
return 'export.export.count_calendar_linked_to_person.title';
}
public function getType(): string
{
return Declarations::CALENDAR_TYPE;
}
/**
* Initiate the query.
*/
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('COUNT(cal.id) AS export_result');
$qb->leftJoin('cal.person', 'person');
if ($this->filterStatsByCenters) {
$qb
->join('person.centerHistory', 'centerHistory')
->where(
$qb->expr()->andX(
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull('centerHistory.endDate'),
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
)
)
)
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
->setParameter('centers', $centers);
}
return $qb;
}
public function requiredRole(): string
{
// which role should we give here?
return PersonVoter::STATS;
}
public function supportsModifiers(): array
{
return [
Declarations::CALENDAR_TYPE,
];
}
}

View File

@@ -0,0 +1,132 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export\LinkedToPerson;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarAvgDuration implements ExportInterface, GroupedExportInterface
{
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
// no form needed
}
public function getFormDefaultData(): array
{
return [];
}
public function getAllowedFormattersTypes(): array
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription(): string
{
return 'export.export.stat_calendar_avg_duration_linked_to_person.description';
}
public function getGroup(): string
{
return 'export.export.calendar_linked_to_person.group';
}
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new \LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
{
return ['export_result'];
}
public function getResult($query, $data)
{
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle(): string
{
return 'export.export.stat_calendar_avg_duration_linked_to_person.title';
}
public function getType(): string
{
return Declarations::CALENDAR_TYPE;
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('AVG(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.person', 'person');
if ($this->filterStatsByCenters) {
$qb
->join('person.centerHistory', 'centerHistory')
->where(
$qb->expr()->andX(
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull('centerHistory.endDate'),
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
)
)
)
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
->setParameter('centers', $centers);
}
return $qb;
}
public function requiredRole(): string
{
return AccompanyingPeriodVoter::STATS;
}
public function supportsModifiers(): array
{
return [
Declarations::CALENDAR_TYPE,
];
}
}

View File

@@ -0,0 +1,132 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Export\Export\LinkedToPerson;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Export\ExportInterface;
use Chill\MainBundle\Export\FormatterInterface;
use Chill\MainBundle\Export\GroupedExportInterface;
use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
class StatCalendarSumDuration implements ExportInterface, GroupedExportInterface
{
private readonly bool $filterStatsByCenters;
public function __construct(
private readonly CalendarRepository $calendarRepository,
ParameterBagInterface $parameterBag,
) {
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
public function buildForm(FormBuilderInterface $builder): void
{
// no form needed
}
public function getFormDefaultData(): array
{
return [];
}
public function getAllowedFormattersTypes(): array
{
return [FormatterInterface::TYPE_TABULAR];
}
public function getDescription(): string
{
return 'export.export.stat_calendar_sum_duration_linked_to_person.description';
}
public function getGroup(): string
{
return 'export.export.calendar_linked_to_person.group';
}
public function getLabels($key, array $values, $data)
{
if ('export_result' !== $key) {
throw new \LogicException("the key {$key} is not used by this export");
}
$labels = array_combine($values, $values);
$labels['_header'] = $this->getTitle();
return static fn ($value) => $labels[$value];
}
public function getQueryKeys($data): array
{
return ['export_result'];
}
public function getResult($query, $data)
{
return $query->getQuery()->getResult(Query::HYDRATE_SCALAR);
}
public function getTitle(): string
{
return 'export.export.stat_calendar_sum_duration_linked_to_person.title';
}
public function getType(): string
{
return Declarations::CALENDAR_TYPE;
}
public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder
{
$centers = array_map(static fn ($el) => $el['center'], $acl);
$qb = $this->calendarRepository->createQueryBuilder('cal');
$qb->select('SUM(cal.endDate - cal.startDate) AS export_result');
$qb->join('cal.person', 'person');
if ($this->filterStatsByCenters) {
$qb
->join('person.centerHistory', 'centerHistory')
->where(
$qb->expr()->andX(
$qb->expr()->lte('centerHistory.startDate', 'cal.startDate'),
$qb->expr()->orX(
$qb->expr()->isNull('centerHistory.endDate'),
$qb->expr()->gt('centerHistory.endDate', 'cal.endDate')
)
)
)
->andWhere($qb->expr()->in('centerHistory.center', ':centers'))
->setParameter('centers', $centers);
}
return $qb;
}
public function requiredRole(): string
{
return AccompanyingPeriodVoter::STATS;
}
public function supportsModifiers(): array
{
return [
Declarations::CALENDAR_TYPE,
];
}
}

View File

@@ -1,118 +1,139 @@
services:
## Indicators
chill.calendar.export.count_calendars:
class: Chill\CalendarBundle\Export\Export\CountCalendars
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: count_calendars }
## Indicators
chill.calendar.export.count_calendars_linked_to_acp:
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\CountCalendars
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: count_calendars_linked_to_acp }
chill.calendar.export.average_duration_calendars:
class: Chill\CalendarBundle\Export\Export\StatCalendarAvgDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: average_duration_calendars }
chill.calendar.export.average_duration_calendars_linked_to_acp:
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarAvgDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: average_duration_calendars_linked_to_acp }
chill.calendar.export.sum_duration_calendars:
class: Chill\CalendarBundle\Export\Export\StatCalendarSumDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: sum_duration_calendars }
chill.calendar.export.sum_duration_calendars_linked_to_acp:
class: Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarSumDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: sum_duration_calendars_linked_to_acp }
## Filters
chill.calendar.export.count_calendars_linked_to_person:
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\CountCalendars
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: count_calendars_linked_to_person }
chill.calendar.export.agent_filter:
class: Chill\CalendarBundle\Export\Filter\AgentFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: agent_filter }
chill.calendar.export.average_duration_calendars_linked_to_person:
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarAvgDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: average_duration_calendars_linked_to_person }
chill.calendar.export.job_filter:
class: Chill\CalendarBundle\Export\Filter\JobFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: job_filter }
chill.calendar.export.sum_duration_calendars_linked_to_person:
class: Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarSumDuration
autowire: true
autoconfigure: true
tags:
- { name: chill.export, alias: sum_duration_calendars_linked_to_person }
chill.calendar.export.scope_filter:
class: Chill\CalendarBundle\Export\Filter\ScopeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: scope_filter }
## Filters
chill.calendar.export.between_dates_filter:
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: between_dates_filter }
chill.calendar.export.agent_filter:
class: Chill\CalendarBundle\Export\Filter\AgentFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: agent_filter }
chill.calendar.export.calendar_range_filter:
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: calendar_range_filter }
chill.calendar.export.job_filter:
class: Chill\CalendarBundle\Export\Filter\JobFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: job_filter }
## Aggregator
chill.calendar.export.scope_filter:
class: Chill\CalendarBundle\Export\Filter\ScopeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: scope_filter }
chill.calendar.export.agent_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: agent_aggregator }
chill.calendar.export.between_dates_filter:
class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: between_dates_filter }
chill.calendar.export.job_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: job_aggregator }
chill.calendar.export.calendar_range_filter:
class: Chill\CalendarBundle\Export\Filter\CalendarRangeFilter
autowire: true
autoconfigure: true
tags:
- { name: chill.export_filter, alias: calendar_range_filter }
chill.calendar.export.scope_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: scope_aggregator }
## Aggregator
chill.calendar.export.location_type_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: location_type_aggregator }
chill.calendar.export.agent_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\AgentAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: agent_aggregator }
chill.calendar.export.location_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: location_aggregator }
chill.calendar.export.job_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\JobAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: job_aggregator }
chill.calendar.export.cancel_reason_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: cancel_reason_aggregator }
chill.calendar.export.scope_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\ScopeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: scope_aggregator }
chill.calendar.export.month_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: month_aggregator }
chill.calendar.export.location_type_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\LocationTypeAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: location_type_aggregator }
chill.calendar.export.urgency_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\UrgencyAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: urgency_aggregator }
chill.calendar.export.location_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: location_aggregator }
chill.calendar.export.cancel_reason_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\CancelReasonAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: cancel_reason_aggregator }
chill.calendar.export.month_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: month_aggregator }
chill.calendar.export.urgency_aggregator:
class: Chill\CalendarBundle\Export\Aggregator\UrgencyAggregator
autowire: true
autoconfigure: true
tags:
- { name: chill.export_aggregator, alias: urgency_aggregator }

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Tests\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Export\Export\LinkedToAcp\CountCalendars as CountCalendarsLinkedToAcp;
use Chill\CalendarBundle\Export\Export\LinkedToPerson\CountCalendars as CountCalendarsLinkedToPerson;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
* @internal
*
* @coversNothing
*/
class CountCalendarsTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$repository = self::$container->get(CalendarRepository::class);
yield new CountCalendarsLinkedToAcp($repository, $this->getParameters(true));
yield new CountCalendarsLinkedToAcp($repository, $this->getParameters(false));
yield new CountCalendarsLinkedToPerson($repository, $this->getParameters(true));
yield new CountCalendarsLinkedToPerson($repository, $this->getParameters(false));
}
public function getFormData()
{
return [];
}
public function getModifiersCombination()
{
return [
[
Declarations::CALENDAR_TYPE,
]];
}
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Tests\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarAvgDuration as StatCalendarAvgDurationLinkedToAcp;
use Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarAvgDuration as StatCalendarAvgDurationLinkedToPerson;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
* @internal
*
* @coversNothing
*/
class StatCalendarAvgDurationTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$repository = self::$container->get(CalendarRepository::class);
yield new StatCalendarAvgDurationLinkedToAcp($repository, $this->getParameters(true));
yield new StatCalendarAvgDurationLinkedToAcp($repository, $this->getParameters(false));
yield new StatCalendarAvgDurationLinkedToPerson($repository, $this->getParameters(true));
yield new StatCalendarAvgDurationLinkedToPerson($repository, $this->getParameters(false));
}
public function getFormData()
{
return [];
}
public function getModifiersCombination()
{
return [
[
Declarations::CALENDAR_TYPE,
]];
}
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\CalendarBundle\Tests\Export\Export;
use Chill\CalendarBundle\Export\Declarations;
use Chill\CalendarBundle\Export\Export\LinkedToAcp\StatCalendarSumDuration as StatCalendarSumDurationLinkedToAcp;
use Chill\CalendarBundle\Export\Export\LinkedToPerson\StatCalendarSumDuration as StatCalendarSumDurationLinkedToPerson;
use Chill\CalendarBundle\Repository\CalendarRepository;
use Chill\MainBundle\Test\Export\AbstractExportTest;
/**
* @internal
*
* @coversNothing
*/
class StatCalendarSumDurationTest extends AbstractExportTest
{
protected function setUp(): void
{
self::bootKernel();
}
public function getExport()
{
$repository = self::$container->get(CalendarRepository::class);
yield new StatCalendarSumDurationLinkedToAcp($repository, $this->getParameters(true));
yield new StatCalendarSumDurationLinkedToAcp($repository, $this->getParameters(false));
yield new StatCalendarSumDurationLinkedToPerson($repository, $this->getParameters(true));
yield new StatCalendarSumDurationLinkedToPerson($repository, $this->getParameters(false));
}
public function getFormData()
{
return [];
}
public function getModifiersCombination()
{
return [
[
Declarations::CALENDAR_TYPE,
]];
}
}

View File

@@ -112,6 +112,31 @@ Group calendars by month and year: Grouper les rendez-vous par mois et année
Group calendars by urgency: Grouper les rendez-vous par urgent ou non
export:
export:
calendar_linked_to_person:
group: Exports des rendez-vous liés à un usager
calendar_linked_to_acp:
group: Exports des rendez-vous liés à un parcours
stat_calendar_sum_duration_linked_to_person:
title: Somme de la durée des rendez-vous
description: Additionne la durée des rendez-vous en fonction de différents paramètres.
stat_calendar_avg_duration_linked_to_person:
title: Moyenne de la durée des rendez-vous
description: Moyenne de la durée des rendez-vous en fonction de différents paramètres.
count_calendar_linked_to_person:
title: Nombre des rendez-vous
description: Compte le nombre des rendez-vous enregistrés et liés à un usager en fonction de différents paramètres.
count_calendar_linked_to_acp:
title: Nombre des rendez-vous
description: Compte le nombre des rendez-vous enregistrés et liées à un parcours en fonction de différents paramètres.
avg_duration_calendar_linked_to_acp:
title: Moyenne de la durée des rendez-vous
description: Moyenne de la durée des rendez-vous en fonction de différents paramètres.
sum_duration_calendar_linked_to_acp:
title: Somme de la durée des rendez-vous
description: Additionne la durée des rendez-vous en fonction de différents paramètres.
aggregator.calendar:
agent_job:
Group calendars by agent job: Grouper les rendez-vous par métier de l'agent

View File

@@ -1,7 +1,6 @@
import {ShowHide} from 'ChillMainAssets/lib/show_hide/index';
document.addEventListener('DOMContentLoaded', function(_e) {
console.log('pick-rolling-date');
document.querySelectorAll('div[data-rolling-date]').forEach( (picker) => {
const
roll_wrapper = picker.querySelector('div.roll-wrapper'),
@@ -11,12 +10,8 @@ document.addEventListener('DOMContentLoaded', function(_e) {
froms: [roll_wrapper],
container: [fixed_wrapper],
test: function (elems) {
console.log('testing');
console.log('elems', elems);
for (let el of elems) {
for (let select_roll of el.querySelectorAll('select[data-roll-picker]')) {
console.log('select_roll', select_roll);
console.log('value', select_roll.value);
return select_roll.value === 'fixed_date';
}
}

View File

@@ -28,9 +28,7 @@
{% block js %}
{{ encore_entry_script_tags('mod_pickentity_type') }}
{{ encore_entry_script_tags('page_export') }}
{% if export_alias == 'count_social_work_actions' %}
{{ encore_entry_script_tags('vue_export_action_goal_result') }}
{% endif %}
{{ encore_entry_script_tags('vue_export_action_goal_result') }}
{{ encore_entry_script_tags('mod_pick_rolling_date') }}
{% endblock js %}

View File

@@ -1,11 +1,11 @@
<template>
<teleport to="#export_filters_social_work_type_filter_form">
<fieldset class="mb-3" id="actionType">
<div class="row">
<legend class="col-sm-4 col-form-label">{{ $t('action.label')}}</legend>
<div class="col-sm-8">
<VueMultiselect
v-model="action"
:options="actions.options"
@@ -18,16 +18,16 @@
track-by="id"
:searchable="true"
></VueMultiselect>
</div>
</div>
</fieldset>
<fieldset class="mb-3" id="goal">
<div class="row">
<legend class="col-sm-4 col-form-label">{{ $t('goal.label')}}</legend>
<div class="col-sm-8">
<VueMultiselect
v-model="goal"
:options="goals.options"
@@ -41,16 +41,16 @@
track-by="id"
:searchable="true"
></VueMultiselect>
</div>
</div>
</fieldset>
<fieldset class="mb-3" id="result">
<div class="row">
<legend class="col-sm-4 col-form-label">{{ $t('result.label')}}</legend>
<div class="col-sm-8">
<VueMultiselect
v-model="result"
:options="results.options"
@@ -64,11 +64,11 @@
track-by="id"
:searchable="true"
></VueMultiselect>
</div>
</div>
</fieldset>
</teleport>
</template>
@@ -152,18 +152,18 @@ export default {
},
mounted() {
this.getSocialActionsList();
this.actions.hiddenField.value = '';
this.goals.hiddenField.value = '';
this.results.hiddenField.value = '';
//console.log(this.actions.hiddenField, this.goals.hiddenField, this.results.hiddenField);
},
methods: {
async getSocialActionsList() {
this.actions.options = await getSocialActions();
},
/**
* Select/unselect in Action Multiselect
* @param value
@@ -172,7 +172,7 @@ export default {
//console.log('----'); console.log('select action', value.id);
let children = this.getChildrensFromParent(value);
this.addSelectedElement('actions', children);
let parentAndChildren = [...[value], ...children];
parentAndChildren.forEach(elem => {
getGoalByAction(elem.id).then(response => new Promise((resolve, reject) => {
@@ -185,7 +185,7 @@ export default {
})).catch;
});
},
unselectAction(value) {
//console.log('----'); console.log('unselect action', value.id);
getGoalByAction(value.id).then(response => new Promise((resolve, reject) => {
@@ -197,7 +197,7 @@ export default {
resolve();
})).catch;
},
/**
* Select/unselect in Goal Multiselect
* @param value
@@ -209,7 +209,7 @@ export default {
resolve();
})).catch;
},
unselectGoal(value) {
//console.log('----'); console.log('unselect goal', value.id);
getResultByGoal(value.id).then(response => new Promise((resolve, reject) => {
@@ -217,7 +217,7 @@ export default {
resolve();
})).catch;
},
/**
* Select/unselect in Result Multiselect
* @param value
@@ -225,11 +225,11 @@ export default {
selectResult(value) {
//console.log('----'); console.log('select result', value.id);
},
unselectResult(value) {
//console.log('----'); console.log('unselect result', value.id);
},
/**
* Choose parent action will involve retaining the "children" actions.
* @param value
@@ -244,7 +244,7 @@ export default {
}
return [];
},
/**
* Add response elements in data target
* @param target string -> 'actions', 'goals' or 'results'
@@ -264,7 +264,7 @@ export default {
//console.log('push ' + dump.length + ' elems in', target, dump);
}
},
/**
* Remove response elements from data target
* @param target string -> 'actions', 'goals' or 'results'
@@ -279,7 +279,7 @@ export default {
if (found) {
data.options = data.options.filter(e => e.id !== elem.id);
dump.push(elem.id);
this.removeSelectedElement(target, elem);
}
})
@@ -288,7 +288,7 @@ export default {
}
return [ data.options, data.value ];
},
/**
*
* @param target
@@ -300,10 +300,10 @@ export default {
elements.forEach(elem => {
let selected = data.value.some(e => e.id === elem.id);
if (!selected) {
data.value.push(elem);
dump.push(elem.id);
// add in hiddenField
this.rebuildHiddenFieldValues(target);
}
@@ -312,7 +312,7 @@ export default {
//console.log('add ' + dump.length + ' selected elems in', target, dump);
}
},
/**
* Remove element from selected and from hiddenField
* @param target
@@ -322,19 +322,19 @@ export default {
let data = this[target];
let selected = data.value.some(e => e.id === elem.id);
if (selected) {
// remove from selected
data.value = data.value.filter(e => e.id !== elem.id);
//console.log('remove ' + elem.id + ' from selected ' + target);
// remove from hiddenField
this.rebuildHiddenFieldValues(target);
// in any cases, remove should be recursive
this.unselectToNextField(target, elem);
}
},
/**
* When unselect Action, it could remove elements in goals multiselect.
* In that case, we have to unselect Goal to remove elements in results too.
@@ -348,7 +348,7 @@ export default {
//console.log('!!!! done');
}
},
/**
* Rebuild values serie (string) in target HiddenField
* @param target
@@ -362,14 +362,14 @@ export default {
})
//console.log(data.hiddenField);
},
addIdToValue(string, id) {
let array = string ? string.split(',') : [];
array.push(id.toString());
let str = array.join();
return str;
},
transTitle ({ title }) {
return title.fr //TODO multilang
},
@@ -378,4 +378,4 @@ export default {
</script>
<style scoped>
</style>
</style>

View File

@@ -2,12 +2,13 @@ import { createApp } from "vue";
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
import App from './App.vue';
const i18n = _createI18n({});
if (null !== document.getElementById('export_filters_social_work_type_filter_enabled')) {
const i18n = _createI18n({});
const app = createApp({
template: `<app></app>`,
})
.use(i18n)
.component('app', App)
.mount('#export_export')
;
const app = createApp({
template: `<app></app>`,
})
.use(i18n)
.component('app', App)
.mount('#export_export');
}