From 2b5accaeac75743408c01db4edf9483aae11e734 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 5 Jul 2022 13:42:32 +0200 Subject: [PATCH 001/191] override export activity translations --- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index abfa0ea89..0dd16a9e7 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -213,7 +213,7 @@ Number of activities: Nombre d'activités #filters Filter by reason: Filtrer par sujet d'activité 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' -'Filtered by activity type: only %list%': "Filtré par type d'activity: seulement %list%" +'Filtered by activity type: only %list%': "Filtré par type d'activité: seulement %list%" Filtered by date activity: Filtrer par date d'activité Activities after this date: Activités après cette date Activities before this date: Activités avant cette date From fcac977d1311c4a33d0ecb64e3c6a00a9878ff8b Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 5 Jul 2022 15:46:43 +0200 Subject: [PATCH 002/191] existing exports, better translations --- .../ChillPersonBundle/Export/Export/ListPersonDuplicate.php | 2 +- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index bbc0dd220..2a4ca4e97 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -125,7 +125,7 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat */ public function getDescription() { - return 'Create a list of duplicate people.'; + return 'Create a list of duplicate people'; } /** diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 266970698..6627af763 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -332,6 +332,8 @@ List peoples: Liste des personnes Create a list of people according to various filters.: Crée une liste des personnes selon différents filtres. Fields to include in export: Champs à inclure dans l'export Address valid at this date: Addresse valide à cette date +List duplicates: Liste des doublons +Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. ## filters Filter by person gender: Filtrer par genre de la personne From 989c4e90e5d4e32dd33be92a7b54adcc754ced87 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 5 Jul 2022 16:39:48 +0200 Subject: [PATCH 003/191] enable show_hide on export pages --- .../ChillMainBundle/Resources/public/page/export/index.js | 5 +++++ .../ChillMainBundle/Resources/views/Export/new.html.twig | 1 + src/Bundle/ChillMainBundle/chill.webpack.config.js | 1 + 3 files changed, 7 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/page/export/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js new file mode 100644 index 000000000..30ae5bc34 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js @@ -0,0 +1,5 @@ +import { ShowHide } from 'ShowHide'; + +console.log('coucou'); + + diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index c3e188720..b5eebac5a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -21,6 +21,7 @@ {% block title %}{{ export.title|trans }}{% endblock %} {% block js %} + {{ encore_entry_script_tags('page_export') }} diff --git a/src/Bundle/ChillMainBundle/chill.webpack.config.js b/src/Bundle/ChillMainBundle/chill.webpack.config.js index 93f71dd94..628f04ba5 100644 --- a/src/Bundle/ChillMainBundle/chill.webpack.config.js +++ b/src/Bundle/ChillMainBundle/chill.webpack.config.js @@ -54,6 +54,7 @@ module.exports = function(encore, entries) encore.addEntry('page_location', __dirname + '/Resources/public/page/location/index.js'); encore.addEntry('page_workflow_show', __dirname + '/Resources/public/page/workflow-show/index.js'); encore.addEntry('page_homepage_widget', __dirname + '/Resources/public/page/homepage_widget/index.js'); + encore.addEntry('page_export', __dirname + '/Resources/public/page/export/index.js'); buildCKEditor(encore); From 7b64269bb5dfb5a70152644e7c765a9545f0dadc Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 7 Jul 2022 15:20:50 +0200 Subject: [PATCH 004/191] fix show/hide in exports filter + better styles --- .../public/chill/scss/flex_table.scss | 11 +- .../Resources/public/page/export/index.js | 9 +- .../Resources/views/Export/new.html.twig | 175 ++++++++++-------- 3 files changed, 111 insertions(+), 84 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss index 7ed607535..673d5129a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/flex_table.scss @@ -99,11 +99,14 @@ div.flex-table { div.item-bloc { flex-direction: column; - &:nth-child(even) { - background-color: $gray-200; + &:not(.no-altern) { // class to avoid even/odd - .chill-user-quote { - background-color: shade-color($gray-200, 5%) + &:nth-child(even) { + background-color: $gray-200; + + .chill-user-quote { + background-color: shade-color($gray-200, 5%) + } } } diff --git a/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js b/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js index 30ae5bc34..d540e5ae5 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/page/export/index.js @@ -1,5 +1,6 @@ -import { ShowHide } from 'ShowHide'; - -console.log('coucou'); - +// old method to show/hide filters when checking checkbox +import { chill } from 'ChillMainAssets/chill/js/chill'; +window.addEventListener("DOMContentLoaded", chill.listenerDisplayCheckbox); +// TODO should be replaced by more recent showHide library +//import { ShowHide } from 'ShowHide'; diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index b5eebac5a..53a73d480 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -16,96 +16,119 @@ * along with this program. If not, see . #} -{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %} +{% extends "@ChillMain/layout.html.twig" %} {% block title %}{{ export.title|trans }}{% endblock %} {% block js %} {{ encore_entry_script_tags('page_export') }} - {% endblock js %} -{% block layout_wvm_content %} - -

{{ export.title|trans }}

- -

{{ export.description|trans }}

+{% block content %} - {{ form_start(form) }} +
- {% if form.children.export.children.filters is defined %} - {% if form.children.export.children.filters is not empty%} -
-

{{ 'Filters'| trans }}

- {% for filter_form in form.children.export.children.filters %} -
-

- {{ form_widget(filter_form.enabled, { 'attr' : { 'style' : 'vertical-align: middle;', 'data-display-target': filter_form.vars.id } }) }} - {{ form_label(filter_form) }} -

- -
- {{ form_widget(filter_form.form) }} - {{ form_errors(filter_form) }} +

{{ export.title|trans }}

+ +

{{ export.description|trans }}

+ + {{ form_start(form) }} + + {% if form.children.export.children.filters is defined %} + {% if form.children.export.children.filters is not empty%} + +
+

{{ 'Filters'| trans }}

+ + {{ form_errors(form.children.export.children.filters) }} + +
+ {% for filter_form in form.children.export.children.filters %} +
+ + {{ form_widget(filter_form.enabled, { + 'label': filter_form.vars.label, + 'label_attr': { 'class': 'h6' }, + 'attr': { 'data-display-target': filter_form.vars.id } + }) }} + +
+ {{ form_widget(filter_form.form) }} + {{ form_errors(filter_form) }} +
+ +
+ {% endfor %}
-
- {% endfor %} - {{ form_errors(form.children.export.children.filters) }} -
- {% else %} - {# render the children, to mark the widget as 'rendered' #} - {{ form_widget(form.children.export.children.filters) }} + + + {% else %} + {# render the children, to mark the widget as 'rendered' #} + {{ form_widget(form.children.export.children.filters) }} + {% endif %} {% endif %} - {% endif %} + + {% if form.children.export.children.aggregators is defined %} + {% if form.children.export.children.aggregators is not empty %} + +
+

{{ 'Aggregators'| trans }}

- {% if form.children.export.children.aggregators is defined %} - {% if form.children.export.children.aggregators is not empty %} -
-

{{ 'Aggregators'| trans }}

- {% for aggregator_form in form.children.export.children.aggregators %} -
-

- {{ form_widget(aggregator_form.enabled, { 'attr' : { 'style' : 'vertical-align: middle;', 'data-display-target': aggregator_form.vars.id } }) }} - {{ form_label(aggregator_form) }} -

- -
- {{ form_widget(aggregator_form.form) }} - {{ form_errors(aggregator_form) }} +
+ {% for aggregator_form in form.children.export.children.aggregators %} +
+ + {{ form_widget(aggregator_form.enabled, { + 'label': aggregator_form.vars.label, + 'label_attr': { 'class': 'h6' }, + 'attr': { 'data-display-target': aggregator_form.vars.id } + }) }} + +
+ {{ form_widget(aggregator_form.form) }} + {{ form_errors(aggregator_form) }} +
+ +
+ {% endfor %}
-
- {% endfor %} -
+
+ + {% else %} + {# render the children, to mark the widget as 'rendered' #} + {{ form_widget(form.children.export.children.aggregators) }} + {% endif %} + {% endif %} + + + {% if form.children.export.children.export.children|length > 0 %} + +
+

+ {{ 'Export parameters'|trans }} +

+ {{ form_widget(form.children.export.children.export) }} +
+ {% else %} {# render the children, to mark the widget as 'rendered' #} - {{ form_widget(form.children.export.children.aggregators) }} - {% endif %} - {% endif %} - - - {% if form.children.export.children.export.children|length > 0 %} -
-

{{ 'Export parameters'|trans }}

{{ form_widget(form.children.export.children.export) }} -
- {% else %} - {# render the children, to mark the widget as 'rendered' #} - {{ form_widget(form.children.export.children.export) }} - {% endif %} - - {% if form.children.export.children.pick_formatter is defined %} -
-

{{ 'Formatter'| trans }}

- -

{{ 'Choose the formatter'|trans }}

- + {% endif %} + + {% if form.children.export.children.pick_formatter is defined %} +
+

+ {{ 'Formatter'| trans }} +

+

+ {{ 'Choose the formatter'|trans }} +

{{ form_row(form.children.export.children.pick_formatter.children.alias, { 'label' : 'Formatter' }) }} -
- {% endif %} - -

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-create' }, 'label' : 'Go to formatter options' } ) }}

- {{ form_end(form) }} - -{% endblock layout_wvm_content %} + + {% endif %} + +

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-create' }, 'label' : 'Go to formatter options' } ) }}

+ {{ form_end(form) }} + +
+{% endblock content %} From 340310be626fd2d0870687d6bd1af7fe68d34ae0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 7 Jul 2022 16:08:34 +0200 Subject: [PATCH 005/191] bootstrap styles in export section --- .../public/lib/export-list/export-list.scss | 20 ------- .../Resources/public/lib/export-list/index.js | 1 - .../Resources/views/Export/layout.html.twig | 33 ++++++----- .../Resources/views/Export/new.html.twig | 3 + .../views/Export/new_centers_step.html.twig | 58 +++++++++++-------- 5 files changed, 54 insertions(+), 61 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/export-list/export-list.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/lib/export-list/index.js diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/export-list.scss b/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/export-list.scss deleted file mode 100644 index 25b42a822..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/export-list.scss +++ /dev/null @@ -1,20 +0,0 @@ -.container-export { - margin-left: 1rem; - margin-right: 1rem; - - .export-list { - display: flex; - flex-direction: row; - flex-wrap: wrap; - - .export-list__element { - min-width: 18rem; - max-width: 20rem; - padding: 1rem; - margin: 1rem; - flex-grow: 1; - - border: 1px solid var(--chill-gray); - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/index.js b/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/index.js deleted file mode 100644 index 49e1a5b20..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/lib/export-list/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./export-list.scss'); diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig index be6307822..c9682621a 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig @@ -22,19 +22,18 @@ {% block content %} -
-

{{ 'Exports list'|trans }}

- -
+
+

{{ 'Exports list'|trans }}

+ +
{% for group, exports in grouped_exports %}{% if group != '_' %}

{{ group }}

-
+
{% for export_alias, export in exports %} -
+ {% endblock %} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index 53a73d480..6cb41bc7d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -103,6 +103,9 @@ {% if form.children.export.children.export.children|length > 0 %} +

{{ 'Export parameters'|trans }} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig index f00419c9d..9adad67df 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig @@ -16,35 +16,43 @@ * along with this program. If not, see . #} -{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %} +{% extends "@ChillMain/layout.html.twig" %} {% block title %}{{ export.title|trans }}{% endblock %} -{% block layout_wvm_content %} - -

{{ export.title|trans }}

- -

{{ export.description|trans }}

- - {{ form_start(form) }} - -

{{ 'Pick centers'|trans }}

- -

{{ 'The export will contains only data from the picked centers.'|trans }} - {{ 'This will eventually restrict your possibilities in filtering the data.'|trans }}

- - {{ form_widget(form.centers.c) }} - - {% if form.centers.children.g is defined %} +{% block content %} +
-

{{ 'Pick aggregated centers'|trans }}

+

{{ export.title|trans }}

- {% for f in form.centers.children.g.children %} - {{ form_row(f) }} - {% endfor %} - {% endif %} +

{{ export.description|trans }}

-

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}

- {{ form_end(form) }} + {{ form_start(form) }} + +
+ +

{{ 'Pick centers'|trans }}

+ +

{{ 'The export will contains only data from the picked centers.'|trans }} + {{ 'This will eventually restrict your possibilities in filtering the data.'|trans }}

+ + {{ form_widget(form.centers.c) }} + + {% if form.centers.children.g is defined %} + +

{{ 'Pick aggregated centers'|trans }}

+ + {% for f in form.centers.children.g.children %} + {{ form_row(f) }} + {% endfor %} + + {% endif %} + +
+ +

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action btn-create' }, 'label' : 'Go to export options' } ) }}

+ + {{ form_end(form) }} -{% endblock layout_wvm_content %} +
+{% endblock content %} From ef9a155cc16ef97c963dec99f392a2cd9840e62d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 11 Jul 2022 11:09:46 +0200 Subject: [PATCH 006/191] bootstrap styles in export section --- .../Resources/views/Export/download.html.twig | 24 +++++--- .../Resources/views/Export/new.html.twig | 7 +-- .../views/Export/new_formatter_step.html.twig | 61 ++++++++++--------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig index ef62dfd90..505c22ab4 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig @@ -16,7 +16,7 @@ * along with this program. If not, see . #} -{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %} +{% extends "@ChillMain/layout.html.twig" %} {% block title "Download export"|trans ~ export.title|trans %} @@ -33,11 +33,19 @@ window.addEventListener("DOMContentLoaded", function(e) { {% endblock %} -{% block layout_wvm_content %} +{% block content %} +
-

{{ export.title|trans }}

-

{{ "Download export"|trans }}

- -
{{ "Waiting for your report"|trans }}...
- -{% endblock %} \ No newline at end of file +

{{ export.title|trans }}

+

{{ "Download export"|trans }}

+ +
{{ "Waiting for your report"|trans ~ '...' }}
+ +
+{% endblock content %} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index 6cb41bc7d..4ee857f00 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -25,7 +25,6 @@ {% endblock js %} {% block content %} -

{{ export.title|trans }}

@@ -71,7 +70,7 @@ {% if form.children.export.children.aggregators is defined %} {% if form.children.export.children.aggregators is not empty %} -
+

{{ 'Aggregators'| trans }}

@@ -106,7 +105,7 @@ -
+

{{ 'Export parameters'|trans }}

@@ -119,7 +118,7 @@ {% endif %} {% if form.children.export.children.pick_formatter is defined %} -
+

{{ 'Formatter'| trans }}

diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig index 43a5f63ec..4854b1c9d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig @@ -16,39 +16,40 @@ * along with this program. If not, see . #} -{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %} +{% extends "@ChillMain/layout.html.twig" %} {% block title %}{{ export.title|trans }}{% endblock %} -{% block layout_wvm_content %} - -

{{ export.title|trans }}

- -

{{ export.description|trans }}

- - {{ form_start(form) }} -
-

{{ 'Formatter'| trans }}

+{% block content %} +
-
- {% if form.children.formatter.children|length == 0 %} -

- {{ "No options availables. Your report is fully configured."|trans }} -

- {{ form_widget(form.children.formatter) }} - {% else %} - {# we always have to render children, to mark as rendered #} - {% for input in form.children.formatter.children %} - {{ form_row(input) }} - {% endfor %} - {% endif %} +

{{ export.title|trans }}

+ +

{{ export.description|trans }}

+ + {{ form_start(form) }} +
+

{{ 'Formatter'| trans }}

+ +
+ {% if form.children.formatter.children|length == 0 %} +

+ {{ "No options availables. Your report is fully configured."|trans }} +

+ {{ form_widget(form.children.formatter) }} + {% else %} + {# we always have to render children, to mark as rendered #} + {% for input in form.children.formatter.children %} + {{ form_row(input) }} + {% endfor %} + {% endif %} +
+
+ +
+

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action' }, 'label': 'Generate the report' } ) }}

+ {{ form_end(form) }} +
- -
-

{{ form_widget(form.submit, { 'attr' : { 'class' : 'btn btn-action' }, 'label': 'Generate the report' } ) }}

-
- - {{ form_end(form) }} - -{% endblock layout_wvm_content %} +{% endblock content %} From 11d1b26efc45cecb458148893a4f4a50333a444c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Jul 2022 10:44:40 +0200 Subject: [PATCH 007/191] fixed: unable to create a course (due to method change in activity entity) --- .../ChillActivityBundle/Controller/ActivityController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index 5f7075aaf..abf242af6 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -416,7 +416,7 @@ final class ActivityController extends AbstractController $this->denyAccessUnlessGranted(ActivityVoter::CREATE, $entity); $form = $this->createForm(ActivityType::class, $entity, [ - 'center' => $entity->getCenter(), + 'center' => $entity->getCenters()[0] ?? null, 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, From 5896a77ae910d32b0a34611405cb714df361205b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Jul 2022 11:10:18 +0200 Subject: [PATCH 008/191] Fixed: use CenterResolver where cases when center is resolved differently --- .../Controller/ActivityController.php | 13 ++++++++++--- src/Bundle/ChillActivityBundle/Entity/Activity.php | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index abf242af6..ee2634884 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -21,6 +21,9 @@ use Chill\ActivityBundle\Repository\ActivityTypeRepository; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Repository\LocationRepository; +use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher; +use Chill\MainBundle\Security\Resolver\CenterResolverInterface; +use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Privacy\PrivacyEvent; @@ -70,6 +73,8 @@ final class ActivityController extends AbstractController private ThirdPartyRepository $thirdPartyRepository; + private CenterResolverManagerInterface $centerResolver; + public function __construct( ActivityACLAwareRepositoryInterface $activityACLAwareRepository, ActivityTypeRepository $activityTypeRepository, @@ -82,7 +87,8 @@ final class ActivityController extends AbstractController EntityManagerInterface $entityManager, EventDispatcherInterface $eventDispatcher, LoggerInterface $logger, - SerializerInterface $serializer + SerializerInterface $serializer, + CenterResolverManagerInterface $centerResolver ) { $this->activityACLAwareRepository = $activityACLAwareRepository; $this->activityTypeRepository = $activityTypeRepository; @@ -96,6 +102,7 @@ final class ActivityController extends AbstractController $this->eventDispatcher = $eventDispatcher; $this->logger = $logger; $this->serializer = $serializer; + $this->centerResolver = $centerResolver; } /** @@ -198,7 +205,7 @@ final class ActivityController extends AbstractController // $this->denyAccessUnlessGranted('CHILL_ACTIVITY_UPDATE', $entity); $form = $this->createForm(ActivityType::class, $entity, [ - 'center' => $entity->getCenters()[0] ?? null, + 'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null, 'role' => new Role('CHILL_ACTIVITY_UPDATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, @@ -416,7 +423,7 @@ final class ActivityController extends AbstractController $this->denyAccessUnlessGranted(ActivityVoter::CREATE, $entity); $form = $this->createForm(ActivityType::class, $entity, [ - 'center' => $entity->getCenters()[0] ?? null, + 'center' => $this->centerResolver->resolveCenters($entity)[0] ?? null, 'role' => new Role('CHILL_ACTIVITY_CREATE'), 'activityType' => $entity->getActivityType(), 'accompanyingPeriod' => $accompanyingPeriod, diff --git a/src/Bundle/ChillActivityBundle/Entity/Activity.php b/src/Bundle/ChillActivityBundle/Entity/Activity.php index faa042e03..828cb68f2 100644 --- a/src/Bundle/ChillActivityBundle/Entity/Activity.php +++ b/src/Bundle/ChillActivityBundle/Entity/Activity.php @@ -306,14 +306,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac * get the center * center is extracted from person. */ - public function getCenters(): array + public function getCenters(): iterable { if ($this->person instanceof Person) { return [$this->person->getCenter()]; } if ($this->getAccompanyingPeriod() instanceof AccompanyingPeriod) { - return $this->getAccompanyingPeriod()->getCenters(); + return $this->getAccompanyingPeriod()->getCenters() ?? []; } return []; From 9fa3d596bbcafc99aabecdcb5a05102411116860 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 12 Jul 2022 13:06:29 +0200 Subject: [PATCH 009/191] split title and description for list activity export --- src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php | 2 +- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php index a99decc6c..eaf95a871 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php @@ -94,7 +94,7 @@ class ListActivity implements ListInterface public function getDescription() { - return 'List activities'; + return 'List activities description'; } public function getLabels($key, array $values, $data) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 0dd16a9e7..85466498b 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -208,6 +208,7 @@ Count activities by various parameters.: Compte le nombre d'activités enregistr Sum activity duration: Total de la durée des activités Sum activities duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. List activities: Liste les activités +List activities description: Créer la liste des activités Number of activities: Nombre d'activités #filters From e9fca1288acea9c45971ac7af40738cc5c8194e2 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 12 Jul 2022 13:07:48 +0200 Subject: [PATCH 010/191] exports: fix errors and depreciations --- .../Export/Export/StatActivityDuration.php | 3 ++- .../CustomFields/CustomFieldChoice.php | 2 +- .../ChillPersonBundle/Export/Export/ListPersonDuplicate.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php index 3e6122621..07e4425ba 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php @@ -13,6 +13,7 @@ namespace Chill\ActivityBundle\Export\Export; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; +use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Doctrine\ORM\Query; @@ -99,7 +100,7 @@ class StatActivityDuration implements ExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { $centers = array_map( - static fn (array $el): string => $el['center'], + static fn (array $el): Center => $el['center'], $acl ); diff --git a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php index b57fdf4db..2982b1c83 100644 --- a/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php +++ b/src/Bundle/ChillCustomFieldsBundle/CustomFields/CustomFieldChoice.php @@ -188,7 +188,7 @@ class CustomFieldChoice extends AbstractCustomField $choices = []; foreach ($cf->getOptions()[self::CHOICES] as $choice) { - if (false === $choices['active']) { + if (false === $choice['active']) { continue; } $choices[$choice['slug']] = $this->translatableStringHelper diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index 2a4ca4e97..d66c6be57 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -192,8 +192,8 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat $statement = $this->entityManager->getConnection()->prepare($sql); $statement->bindValue('precision', $precision); - $statement->execute(); + $result = $statement->executeQuery(); - return $statement->fetchAll(); + return $result->fetchAllAssociative(); } } From 56bed12886f54718519499dc75a4fb24ab481226 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 12 Jul 2022 14:19:50 +0200 Subject: [PATCH 011/191] exports: fix errors and depreciations --- .../ChillPersonBundle/Export/Export/ListPerson.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index 50b0f3d72..d3bc2728a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -425,7 +425,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface if ('_header' === $value) { return $this->translatableStringHelper->localize($cf->getName()); } - + if (null === $value) { + return ''; + } return $this->customFieldProvider ->getCustomFieldByType($cf->getType()) ->render(json_decode($value, true), $cf, 'csv'); @@ -434,6 +436,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface if ($cfType instanceof CustomFieldChoice && $cfType->isMultiple($cf)) { return function ($value) use ($cf, $cfType, $key) { $slugChoice = $this->extractInfosFromSlug($key)['additionnalInfos']['choiceSlug']; + if (null === $value) { + return ''; + } $decoded = json_decode($value, true); if ('_header' === $value) { @@ -459,7 +464,7 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface */ private function slugToDQL(string $slug, string $type = 'default', array $additionalInfos = []): string { - $uid = 'slug_' . uniqid('', true); + $uid = 'slug_' . uniqid('', false); $this->slugs[$uid] = [ 'slug' => $slug, From 28ed09b9d9abbd600b162a4825bde1f71f26a77e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 12 Jul 2022 15:16:38 +0200 Subject: [PATCH 012/191] exports: add 2 new exports for accompanying courses --- .../Export/Export/CountAccompanyingCourse.php | 76 ++++++++++++ .../Export/Export/ListAccompanyingCourse.php | 116 ++++++++++++++++++ .../Authorization/AccompanyingPeriodVoter.php | 7 ++ .../config/services/exports.yaml | 12 ++ .../translations/messages.fr.yml | 4 + 5 files changed, 215 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php new file mode 100644 index 000000000..51eeee6fb --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -0,0 +1,76 @@ + Date: Tue, 12 Jul 2022 18:08:54 +0200 Subject: [PATCH 013/191] fixed: rendering of course in list of courses by household --- .../views/AccompanyingPeriod/_list.html.twig | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig index 986392056..b140bb4c1 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -48,10 +48,13 @@ {% endmacro %} {% block content %} + + {# WARNING: this list is rendered in either person context or houshold context #} + {%- set acps = [] %} {%- set acpsClosed = [] %} {% for acp in accompanying_periods %} - {% if acp.step == 'CLOSED' or (acp.requestorPerson is not same as(person) and acp.openParticipationContainsPerson(person) is null ) %} + {% if acp.step == 'CLOSED' or (person is defined and acp.requestorPerson is not same as(person) and acp.openParticipationContainsPerson(person) is null ) %} {%- set acpsClosed = acpsClosed|merge([acp]) %} {% else %} {%- set acps = acps|merge([acp]) %} @@ -69,24 +72,30 @@
{% if acpsClosed|length > 0 %} -
+ {% if person is defined %} + {% set identifier = person.id %} + {% else %} + {% set identifier = household.id %} + {% endif %} + +
-

+

-
From 83ee3c7cfdc6b4c695f27db1b27ca742c97e1565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Jul 2022 18:15:16 +0200 Subject: [PATCH 014/191] fixed: add required type-hinting to AccompanyingPeriodComment, necessary for docgen rendering --- .../Entity/AccompanyingPeriod/Comment.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php index 595ffa35f..039489864 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Comment.php @@ -36,7 +36,7 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface * inversedBy="comments") * @ORM\JoinColumn(nullable=false, onDelete="CASCADE") */ - private $accompanyingPeriod; + private ?AccompanyingPeriod $accompanyingPeriod; /** * @ORM\Column(type="text") @@ -44,20 +44,20 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface * @Assert\NotBlank * @Assert\NotNull */ - private $content; + private ?string $content; /** * @ORM\Column(type="datetime") * @Groups({"read", "docgen:read"}) */ - private $createdAt; + private ?DateTimeInterface $createdAt; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) * @Groups({"read", "docgen:read"}) */ - private $creator; + private ?User $creator; /** * @ORM\Id @@ -65,20 +65,20 @@ class Comment implements TrackCreationInterface, TrackUpdateInterface * @ORM\Column(type="integer") * @Groups({"read", "docgen:read"}) */ - private $id; + private ?int $id; /** * @ORM\Column(type="datetime") * @Groups({"read"}) */ - private $updatedAt; + private ?DateTimeInterface $updatedAt; /** * @ORM\ManyToOne(targetEntity=User::class) * @ORM\JoinColumn(nullable=false) * @Groups({"read"}) */ - private $updatedBy; + private ?User $updatedBy; public function getAccompanyingPeriod(): ?AccompanyingPeriod { From 85796c22718c021a573d9d2c7a49c0d6bd3f41c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 12 Jul 2022 18:16:04 +0200 Subject: [PATCH 015/191] CS --- .../ChillActivityBundle/Controller/ActivityController.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php index ee2634884..2c380ad52 100644 --- a/src/Bundle/ChillActivityBundle/Controller/ActivityController.php +++ b/src/Bundle/ChillActivityBundle/Controller/ActivityController.php @@ -21,8 +21,6 @@ use Chill\ActivityBundle\Repository\ActivityTypeRepository; use Chill\ActivityBundle\Security\Authorization\ActivityVoter; use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Repository\LocationRepository; -use Chill\MainBundle\Security\Resolver\CenterResolverDispatcher; -use Chill\MainBundle\Security\Resolver\CenterResolverInterface; use Chill\MainBundle\Security\Resolver\CenterResolverManagerInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\Person; @@ -59,6 +57,8 @@ final class ActivityController extends AbstractController private ActivityTypeRepository $activityTypeRepository; + private CenterResolverManagerInterface $centerResolver; + private EntityManagerInterface $entityManager; private EventDispatcherInterface $eventDispatcher; @@ -73,8 +73,6 @@ final class ActivityController extends AbstractController private ThirdPartyRepository $thirdPartyRepository; - private CenterResolverManagerInterface $centerResolver; - public function __construct( ActivityACLAwareRepositoryInterface $activityACLAwareRepository, ActivityTypeRepository $activityTypeRepository, From ec38dc4d215da08abe78d55970b9625d85a1fd70 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 13 Jul 2022 10:08:18 +0200 Subject: [PATCH 016/191] add person exports in a group --- .../Resources/views/Export/layout.html.twig | 13 +++++-------- .../ChillPersonBundle/Export/Export/CountPerson.php | 8 +++++++- .../ChillPersonBundle/Export/Export/ListPerson.php | 8 +++++++- .../Export/Export/ListPersonDuplicate.php | 8 +++++++- .../ChillPersonBundle/translations/messages.fr.yml | 1 + 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig index c9682621a..a51871b2c 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig @@ -26,10 +26,10 @@

{{ 'Exports list'|trans }}

+ {% for group, exports in grouped_exports %}{% if group != '_' %} -

{{ group }}

- -
+

{{ group|trans }}

+
{% for export_alias, export in exports %}

{{ export.title|trans }}

@@ -45,13 +45,10 @@ {% endif %}{% endfor %} {% if grouped_exports|keys|length > 1 %} -

{{ 'Ungrouped exports'|trans }}

+

{{ 'Ungrouped exports'|trans }}

{% endif %} -
-
- -
+
{% for export_alias,export in grouped_exports['_'] %}
diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 27774c885..115b3489e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; @@ -22,7 +23,7 @@ use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -class CountPerson implements ExportInterface +class CountPerson implements ExportInterface, GroupedExportInterface { /** * @var EntityManagerInterface @@ -114,4 +115,9 @@ class CountPerson implements ExportInterface { return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN]; } + + public function getGroup(): string + { + return 'Exports of persons'; + } } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php index d3bc2728a..f2f72aa29 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPerson.php @@ -16,6 +16,7 @@ use Chill\CustomFieldsBundle\Entity\CustomField; use Chill\CustomFieldsBundle\Service\CustomFieldProvider; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Person; @@ -45,7 +46,7 @@ use function uniqid; /** * Render a list of people. */ -class ListPerson implements ExportElementValidatedInterface, ListInterface +class ListPerson implements ExportElementValidatedInterface, ListInterface, GroupedExportInterface { protected CustomFieldProvider $customFieldProvider; @@ -474,4 +475,9 @@ class ListPerson implements ExportElementValidatedInterface, ListInterface return $uid; } + + public function getGroup(): string + { + return 'Exports of persons'; + } } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php index d66c6be57..2c65acb84 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListPersonDuplicate.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\DirectExportInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Security\Authorization\PersonVoter; use Doctrine\ORM\EntityManagerInterface; use PhpOffice\PhpSpreadsheet\Spreadsheet; @@ -30,7 +31,7 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * Render a list of duplicate peoples. */ -class ListPersonDuplicate implements DirectExportInterface, ExportElementValidatedInterface +class ListPersonDuplicate implements DirectExportInterface, ExportElementValidatedInterface, GroupedExportInterface { /** * @var float @@ -196,4 +197,9 @@ class ListPersonDuplicate implements DirectExportInterface, ExportElementValidat return $result->fetchAllAssociative(); } + + public function getGroup(): string + { + return 'Exports of persons'; + } } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 5b0f571af..aad43627f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -326,6 +326,7 @@ Pediod closing form is not valide: Le formulaire de fermeture n'est pas valide Accompanyied people: Personnes accompagnées ## exports +Exports of persons: Exports des personnes Count peoples by various parameters.: Compte le nombre de personnes en fonction de différents filtres. Count peoples: Nombre de personnes List peoples: Liste des personnes From 2ce145cace112ba8200cdc605761c5b35f0589c8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 12 Jul 2022 16:41:12 +0200 Subject: [PATCH 017/191] wip.. setting acl for new accompanying course exports --- .../Export/Export/CountAccompanyingCourse.php | 69 ++++++++++++++----- .../Authorization/AccompanyingPeriodVoter.php | 5 ++ .../config/services/exports.yaml | 3 +- .../translations/messages.fr.yml | 1 + 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 51eeee6fb..4984fd9ae 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -12,56 +12,93 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; +use LogicException; class CountAccompanyingCourse implements ExportInterface { + /** + * @var EntityManagerInterface + */ + protected $entityManager; - public function buildForm(FormBuilderInterface $builder) + public function __construct( + EntityManagerInterface $em + ) { + $this->entityManager = $em; + } + + public function buildForm(FormBuilderInterface $builder): void { // TODO: Implement buildForm() method. } - public function getTitle() + public function getTitle(): string { return 'Count accompanying courses'; } - public function getAllowedFormattersTypes() + public function getAllowedFormattersTypes(): array { - // TODO: Implement getAllowedFormattersTypes() method. + return [FormatterInterface::TYPE_TABULAR]; } - public function getDescription() + public function getDescription(): string { return 'Count accompanying courses by various parameters'; } public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + 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 function ($value) use ($labels) { + return $labels[$value]; + }; } - public function getQueryKeys($data) + public function getQueryKeys($data): array { - // TODO: Implement getQueryKeys() method. + return ['export_result']; } - public function getResult($query, $data) + public function getResult($qb, $data) { - // TODO: Implement getResult() method. + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - public function getType() + public function getType(): string { - // TODO: Implement getType() method. + return 'accompanying_period'; } - public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - // TODO: Implement initiateQuery() method. + $centers = array_map(static function ($el) { + return $el['center']; + }, $acl); + + $qb = $this->entityManager->createQueryBuilder(); + + $qb->select('COUNT(acp.id) AS export_result') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->join('acp.center', 'center') + ->andWhere('center IN (:authorized_centers)') + ->setParameter('authorized_centers', $centers); + + return $qb; } public function requiredRole(): Role @@ -69,8 +106,8 @@ class CountAccompanyingCourse implements ExportInterface return new Role(AccompanyingPeriodVoter::STATS); } - public function supportsModifiers() + public function supportsModifiers(): array { - // TODO: Implement supportsModifiers() method. + return []; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php index 549f18f85..0d8deb569 100644 --- a/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php +++ b/src/Bundle/ChillPersonBundle/Security/Authorization/AccompanyingPeriodVoter.php @@ -219,6 +219,11 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH return $token->getUser() === $subject->getUser(); } + + if (self::STATS === $attribute) { + return true; + } + } return $this->voterHelper->voteOnAttribute($attribute, $subject, $token); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 2424c34c4..23a62f914 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -26,9 +26,10 @@ services: tags: - { name: chill.export, alias: list_person_duplicate } - chill.person.export.export_count_accompanying_course: + chill.person.export.count_accompanying_course: class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse arguments: + - "@doctrine.orm.entity_manager" tags: - { name: chill.export, alias: count_accompanying_course } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index aad43627f..25dc94665 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -315,6 +315,7 @@ CHILL_PERSON_ACCOMPANYING_PERIOD_UPDATE: Modifier une période d'accompagnement CHILL_PERSON_ACCOMPANYING_PERIOD_FULL: Voir les détails, créer, supprimer et mettre à jour une période d'accompagnement CHILL_PERSON_ACCOMPANYING_COURSE_REASSIGN_BULK: Réassigner les parcours en lot CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_DETAILS: Voir les détails d'une période d'accompagnement +CHILL_PERSON_ACCOMPANYING_PERIOD_STATS: Statistiques sur les parcours d'accompagnement #period Period closed!: Période clôturée! From 3cdcccc037fd5fb9dd90e2fe4c0087fe229913ec Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 13 Jul 2022 10:31:32 +0200 Subject: [PATCH 018/191] add activity exports in a group --- .../ChillActivityBundle/Export/Export/CountActivity.php | 8 +++++++- .../ChillActivityBundle/Export/Export/ListActivity.php | 8 +++++++- .../Export/Export/StatActivityDuration.php | 8 +++++++- .../ChillActivityBundle/translations/messages.fr.yml | 1 + .../Resources/views/Export/layout.html.twig | 2 +- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php index 3824b059f..92e15e8bb 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php @@ -15,12 +15,13 @@ use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -class CountActivity implements ExportInterface +class CountActivity implements ExportInterface, GroupedExportInterface { protected ActivityRepository $activityRepository; @@ -99,4 +100,9 @@ class CountActivity implements ExportInterface { return ['person', 'activity']; } + + public function getGroup(): string + { + return 'Exports of activities'; + } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php index eaf95a871..438a879c4 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\ListInterface; use Chill\MainBundle\Templating\TranslatableStringHelperInterface; use DateTime; @@ -32,7 +33,7 @@ use function array_key_exists; use function count; use function in_array; -class ListActivity implements ListInterface +class ListActivity implements ListInterface, GroupedExportInterface { protected EntityManagerInterface $entityManager; @@ -276,4 +277,9 @@ class ListActivity implements ListInterface { return ['activity', 'person']; } + + public function getGroup(): string + { + return 'Exports of activities'; + } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php index 07e4425ba..5493046c2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php @@ -16,6 +16,7 @@ use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -26,7 +27,7 @@ use Symfony\Component\Security\Core\Role\Role; * * The desired stat must be given in constructor. */ -class StatActivityDuration implements ExportInterface +class StatActivityDuration implements ExportInterface, GroupedExportInterface { public const SUM = 'sum'; @@ -128,4 +129,9 @@ class StatActivityDuration implements ExportInterface { return ['person', 'activity']; } + + public function getGroup(): string + { + return 'Exports of activities'; + } } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 85466498b..93839327e 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -210,6 +210,7 @@ Sum activities duration by various parameters.: Additionne la durée des activit List activities: Liste les activités List activities description: Créer la liste des activités Number of activities: Nombre d'activités +Exports of activities: Exports des activités #filters Filter by reason: Filtrer par sujet d'activité diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig index a51871b2c..9cf53993d 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/layout.html.twig @@ -44,7 +44,7 @@
{% endif %}{% endfor %} - {% if grouped_exports|keys|length > 1 %} + {% if grouped_exports|keys|length > 1 and grouped_exports['_']|length > 0 %}

{{ 'Ungrouped exports'|trans }}

{% endif %} From bda203d11d37d50ab835768bbd14619150df2fd4 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 13 Jul 2022 10:41:30 +0200 Subject: [PATCH 019/191] add accompanying courses exports in a group --- .../Export/Export/CountAccompanyingCourse.php | 8 +++++++- .../Export/Export/ListAccompanyingCourse.php | 8 +++++++- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 4984fd9ae..ab9542b7f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; @@ -22,7 +23,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use LogicException; -class CountAccompanyingCourse implements ExportInterface +class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface { /** * @var EntityManagerInterface @@ -110,4 +111,9 @@ class CountAccompanyingCourse implements ExportInterface { return []; } + + public function getGroup(): string + { + return 'Exports of accompanying courses'; + } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php index 4b8a6462a..ca004b066 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php @@ -12,13 +12,14 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportElementValidatedInterface; +use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Export\ListInterface; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; -class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInterface +class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInterface, GroupedExportInterface { /** @@ -113,4 +114,9 @@ class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInt { // TODO: Implement validateForm() method. } + + public function getGroup(): string + { + return 'Exports of accompanying courses'; + } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 25dc94665..4fbd06b22 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -336,6 +336,7 @@ Fields to include in export: Champs à inclure dans l'export Address valid at this date: Addresse valide à cette date List duplicates: Liste des doublons Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. +Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours Count accompanying courses by various parameters: Compte le nombre de parcours d'accompagnement en fonction de différents filtres. List accompanying courses: Liste des parcours From fe595860f2d55e3340ea4c5eb7217259fe001d63 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 13 Jul 2022 13:35:37 +0200 Subject: [PATCH 020/191] replace 'hideLabel' form option by 'fullWidth' sometimes we want fullWidth and display label --- src/Bundle/ChillMainBundle/Form/Type/CommentType.php | 2 +- src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php | 2 +- src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php | 2 +- .../Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig | 2 +- .../ChillMainBundle/Resources/views/Form/fields.html.twig | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php index 3adca5eca..fb64ed3b1 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/CommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/CommentType.php @@ -59,7 +59,7 @@ class CommentType extends AbstractType $view->vars = array_replace( $view->vars, [ - 'hideLabel' => true, + 'fullWidth' => true, ] ); } diff --git a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php index d4c0d1611..a96c0e353 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/PrivateCommentType.php @@ -46,7 +46,7 @@ class PrivateCommentType extends AbstractType public function buildView(FormView $view, FormInterface $form, array $options) { - $view->vars['hideLabel'] = true; + $view->vars['fullWidth'] = true; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php index 92a1b26c3..36c599f71 100644 --- a/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php +++ b/src/Bundle/ChillMainBundle/Form/Type/ScopePickerType.php @@ -108,7 +108,7 @@ class ScopePickerType extends AbstractType $view->vars = array_replace( $view->vars, [ - 'hideLabel' => true, + 'fullWidth' => true, ] ); } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig index e0c43629e..f4a2c3294 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/bootstrap5/bootstrap_5_horizontal_layout.html.twig @@ -60,7 +60,7 @@ {{- form_errors(form) -}}
{%- else -%} - {% if form.vars.hideLabel is not defined or form.vars.hideLabel == false %} + {% if form.vars.fullWidth is not defined or form.vars.fullWidth == false %} {{- form_label(form) -}}
{{- form_widget(form, widget_attr) -}} diff --git a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig index f45f91692..586b900aa 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Form/fields.html.twig @@ -18,7 +18,7 @@ {% block form_row %} {% apply spaceless %} - {% if form.vars.hideLabel is not defined or form.vars.hideLabel == false %} + {% if form.vars.fullWidth is not defined or form.vars.fullWidth == false %}
Date: Thu, 14 Jul 2022 14:27:55 +0200 Subject: [PATCH 023/191] fix count_accompanying_course query: no centers, not count DRAFT courses --- .../Export/Export/CountAccompanyingCourse.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index ab9542b7f..39df61cb8 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -87,17 +87,15 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $centers = array_map(static function ($el) { - return $el['center']; - }, $acl); - $qb = $this->entityManager->createQueryBuilder(); + $expr = $qb->expr(); $qb->select('COUNT(acp.id) AS export_result') ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') - ->join('acp.center', 'center') - ->andWhere('center IN (:authorized_centers)') - ->setParameter('authorized_centers', $centers); + ->where($expr->neq( + 'acp.step', $expr->literal('DRAFT') + )) + ; return $qb; } From 903ac2ff693e2a939bfb888f4e43380ae75fc243 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 14 Jul 2022 14:42:53 +0200 Subject: [PATCH 024/191] exports: init sum_accompanying_course_duration (replace list_accompanying_course) --- ...panyingCourse.php => StatAccompanyingCourseDuration.php} | 6 +++--- src/Bundle/ChillPersonBundle/config/services/exports.yaml | 6 +++--- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Export/{ListAccompanyingCourse.php => StatAccompanyingCourseDuration.php} (90%) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php similarity index 90% rename from src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php rename to src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index ca004b066..9a9319c20 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/ListAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -19,7 +19,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Context\ExecutionContextInterface; -class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInterface, GroupedExportInterface +class StatAccompanyingCourseDuration implements ListInterface, ExportElementValidatedInterface, GroupedExportInterface { /** @@ -35,7 +35,7 @@ class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInt */ public function getTitle() { - return 'List accompanying courses'; + return 'Accompanying courses duration'; } /** @@ -51,7 +51,7 @@ class ListAccompanyingCourse implements ListInterface, ExportElementValidatedInt */ public function getDescription() { - return 'Create a list of accompanying courses according to various filters'; + return 'Create an average of accompanying courses duration according to various filters'; } /** diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 521dbbf64..4b1db59a0 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -33,11 +33,11 @@ services: tags: - { name: chill.export, alias: count_accompanying_course } - chill.person.export.list_accompanying_course: - class: Chill\PersonBundle\Export\Export\ListAccompanyingCourse + chill.person.export.sum_accompanying_course_duration: + class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration arguments: tags: - - { name: chill.export, alias: list_accompanying_course } + - { name: chill.export, alias: sum_accompanying_course_duration } chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e80b85ee8..89d77ab6b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -339,9 +339,9 @@ List duplicates: Liste des doublons Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours -Count accompanying courses by various parameters: Compte le nombre de parcours d'accompagnement en fonction de différents filtres. -List accompanying courses: Liste des parcours -Create a list of accompanying courses according to various filters: Crée une liste des parcours d'accompagnement selon différents filtres. +Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres. +Accompanying courses duration: Durée des parcours +Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours selon différents filtres. ## filters Filter by person gender: Filtrer par genre de la personne From 34923df43c9cb0c532072d38dc92ffdac897a854 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 18 Jul 2022 14:38:48 +0200 Subject: [PATCH 025/191] exports avg_accompanying_course_duration with closingdate parameter --- .../Export/StatAccompanyingCourseDuration.php | 96 +++++++++++++------ .../config/services/exports.yaml | 5 +- .../translations/messages.fr.yml | 6 +- 3 files changed, 75 insertions(+), 32 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 9a9319c20..1241c7f88 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -11,29 +11,46 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Export; -use Chill\MainBundle\Export\ExportElementValidatedInterface; +use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\MainBundle\Export\ListInterface; +use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Doctrine\ORM\Query; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -use Symfony\Component\Validator\Context\ExecutionContextInterface; -class StatAccompanyingCourseDuration implements ListInterface, ExportElementValidatedInterface, GroupedExportInterface +class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface { + private AccompanyingPeriodRepository $periodRepository; + /** - * @inheritDoc + * @param AccompanyingPeriodRepository $periodRepository */ - public function buildForm(FormBuilderInterface $builder) - { - // TODO: Implement buildForm() method. + public function __construct( + AccompanyingPeriodRepository $periodRepository + ) { + $this->periodRepository = $periodRepository; } /** * @inheritDoc */ - public function getTitle() + public function buildForm(FormBuilderInterface $builder): void + { + $builder->add('closingdate', ChillDateType::class, [ + 'label' => 'Closingdate to apply', + 'data' => new \DateTime('now'), + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string { return 'Accompanying courses duration'; } @@ -41,15 +58,15 @@ class StatAccompanyingCourseDuration implements ListInterface, ExportElementVali /** * @inheritDoc */ - public function getAllowedFormattersTypes() + public function getAllowedFormattersTypes(): array { - // TODO: Implement getAllowedFormattersTypes() method. + return [FormatterInterface::TYPE_TABULAR]; } /** * @inheritDoc */ - public function getDescription() + public function getDescription(): string { return 'Create an average of accompanying courses duration according to various filters'; } @@ -59,39 +76,67 @@ class StatAccompanyingCourseDuration implements ListInterface, ExportElementVali */ public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + 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 function ($value) use ($labels) { + return $labels[$value]; + }; } /** * @inheritDoc */ - public function getQueryKeys($data) + public function getQueryKeys($data): array { - // TODO: Implement getQueryKeys() method. + return ['export_result']; } /** * @inheritDoc */ - public function getResult($query, $data) + public function getResult($qb, $data) { - // TODO: Implement getResult() method. + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } /** * @inheritDoc */ - public function getType() + public function getType(): string { - // TODO: Implement getType() method. + return 'accompanying_course'; } /** * @inheritDoc */ - public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - // TODO: Implement initiateQuery() method. + $qb = $this->periodRepository->createQueryBuilder('acp'); + $expr = $qb->expr(); + + $force_closingdate = $data['closingdate']; // parameter from buildForm + + $qb + ->select('AVG( + ( CASE + WHEN acp.closingDate IS NOT NULL + THEN acp.closingDate + ELSE :force_closingDate + END ) - acp.openingDate + ) AS export_result') + ->where($expr->neq( + 'acp.step', $expr->literal('DRAFT') + )) + ->setParameter('force_closingDate', $force_closingdate) + ; + + return $qb; } /** @@ -105,14 +150,9 @@ class StatAccompanyingCourseDuration implements ListInterface, ExportElementVali /** * @inheritDoc */ - public function supportsModifiers() + public function supportsModifiers(): array { - // TODO: Implement supportsModifiers() method. - } - - public function validateForm($data, ExecutionContextInterface $context) - { - // TODO: Implement validateForm() method. + return []; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 4b1db59a0..19ed9174b 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -33,11 +33,12 @@ services: tags: - { name: chill.export, alias: count_accompanying_course } - chill.person.export.sum_accompanying_course_duration: + chill.person.export.avg_accompanying_course_duration: class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration arguments: + - '@Chill\PersonBundle\Repository\AccompanyingPeriodRepository' tags: - - { name: chill.export, alias: sum_accompanying_course_duration } + - { name: chill.export, alias: avg_accompanying_course_duration } chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 89d77ab6b..b2cd212e6 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -337,11 +337,13 @@ Fields to include in export: Champs à inclure dans l'export Address valid at this date: Addresse valide à cette date List duplicates: Liste des doublons Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. + Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres. -Accompanying courses duration: Durée des parcours -Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours selon différents filtres. +Accompanying courses duration: Durée moyenne des parcours +Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. +Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré ## filters Filter by person gender: Filtrer par genre de la personne From b28677fac91f5529a7c9c06956d5f0764a96bcb0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 14:39:24 +0200 Subject: [PATCH 026/191] delete quitter et repositionner buttons from enfant hors menage --- .../Resources/views/Household/summary.html.twig | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig index 7ba2235a6..a8ff245d7 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/summary.html.twig @@ -180,10 +180,16 @@ {% if members|length > 0 %}
{% for m in members %} + {% if m.position.shareHousehold %} {% include '@ChillPerson/Household/_render_member.html.twig' with { 'member': m, 'customButtons': { 'before': _self.customButtons(m, household) } } %} + {% else %} + {% include '@ChillPerson/Household/_render_member.html.twig' with { + 'member': m, + } %} + {% endif %} {% endfor %}
{% else %} From 99154eaa994454eddc5c8d3b5863cfc98a8b3f71 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 14:42:41 +0200 Subject: [PATCH 027/191] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed9cdebf..9bcbb28db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to * [person-thirdparty]: fix quick-add of names that consist of multiple parts (eg. De Vlieger) within onthefly modal person/thirdparty * [search]: Order of birthdate fields changed in advanced search to avoid confusion. * [workflow]: Constraint added to workflow (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/675) +* [household]: Reposition and cut button for enfant hors menage have been deleted (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/620) ## Test releases From d55ba3661948bd747e5e62ab17d9940dc2c6d357 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 18 Jul 2022 15:39:00 +0200 Subject: [PATCH 028/191] [person] add comment field to accompanying period resource docgen --- .../ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php index 8f84f319a..73f2e069a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php +++ b/src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod/Resource.php @@ -47,7 +47,7 @@ class Resource /** * @ORM\Column(type="text", nullable=true) - * @Groups({"read"}) + * @Groups({"read", "docgen:read"}) */ private ?string $comment = ''; From e6caeecc50b7a8be4f16c0627d7194fb9815cf4f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 16:36:13 +0200 Subject: [PATCH 029/191] add composition type to admin menu --- .../HouseholdCompositionTypeController.php | 26 ++++++++++++ .../ChillPersonExtension.php | 21 ++++++++++ .../Form/HouseholdCompositionTypeType.php | 39 ++++++++++++++++++ .../Menu/AdminHouseholdMenuBuilder.php | 6 ++- .../HouseholdCompositionType/edit.html.twig | 11 +++++ .../HouseholdCompositionType/index.html.twig | 41 +++++++++++++++++++ .../HouseholdCompositionType/new.html.twig | 12 ++++++ .../translations/messages.fr.yml | 6 +++ 8 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php create mode 100644 src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/index.html.twig create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/new.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php new file mode 100644 index 000000000..eb1dc1ea9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdCompositionTypeController.php @@ -0,0 +1,26 @@ +addOrderBy('e.id', 'ASC'); + + return parent::orderQuery($action, $query, $request, $paginator); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index d7037c1d2..73ebb007c 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -227,6 +227,27 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\Household\HouseholdCompositionType::class, + 'name' => 'person_household_composition_type', + 'base_path' => '/admin/person/household/composition-type', + 'form_class' => \Chill\PersonBundle\Form\HouseholdCompositionTypeType::class, + 'controller' => \Chill\PersonBundle\Controller\HouseholdCompositionTypeController::class, + 'actions' => [ + 'index' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/index.html.twig', + ], + 'new' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/new.html.twig', + ], + 'edit' => [ + 'role' => 'ROLE_ADMIN', + 'template' => '@ChillPerson/HouseholdCompositionType/edit.html.twig', + ], + ], + ], [ 'class' => \Chill\PersonBundle\Entity\Relationships\Relation::class, 'name' => 'person_relation', diff --git a/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php new file mode 100644 index 000000000..f5d26da7f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Form/HouseholdCompositionTypeType.php @@ -0,0 +1,39 @@ +add('label', TranslatableStringFormType::class) + ->add('active', CheckboxType::class, [ + 'label' => 'Actif?', + 'required' => false, + ]); + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefault('class', HouseholdCompositionType::class); + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php index e68059e1d..4dc43bcaa 100644 --- a/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/AdminHouseholdMenuBuilder.php @@ -46,9 +46,13 @@ class AdminHouseholdMenuBuilder implements LocalMenuBuilderInterface 'route' => 'chill_crud_person_household_position_index', ])->setExtras(['order' => 2110]); + $menu->addChild('Composition', [ + 'route' => 'chill_crud_person_household_composition_type_index', + ])->setExtras(['order' => 2120]); + $menu->addChild('person_admin.relation', [ 'route' => 'chill_crud_person_relation_index', - ])->setExtras(['order' => 2120]); + ])->setExtras(['order' => 2130]); } public static function getMenuIds(): array diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig new file mode 100644 index 000000000..28678bf6d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/edit.html.twig @@ -0,0 +1,11 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block title %} + {% include('@ChillMain/CRUD/_edit_title.html.twig') %} +{% endblock %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_edit_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/index.html.twig new file mode 100644 index 000000000..252e932e8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/index.html.twig @@ -0,0 +1,41 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_index.html.twig' %} + {% block table_entities_thead_tr %} + {{ 'Id'|trans }} + {{ 'Label'|trans }} + {{ 'Active'|trans }} +   + {% endblock %} + + {% block table_entities_tbody %} + {% for entity in entities %} + + {{ entity.id }} + {{ entity.label|localize_translatable_string }} + + {%- if entity.isActive -%} + + {%- else -%} + + {%- endif -%} + + +
    +
  • + +
  • +
+ + + {% endfor %} + {% endblock %} + + {% block actions_before %} +
  • + {{'Back to the admin'|trans}} +
  • + {% endblock %} + {% endembed %} +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/new.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/new.html.twig new file mode 100644 index 000000000..3a28dd85f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/HouseholdCompositionType/new.html.twig @@ -0,0 +1,12 @@ +{% extends '@ChillMain/CRUD/Admin/index.html.twig' %} + +{% block title %} + {% include('@ChillMain/CRUD/_new_title.html.twig') %} +{% endblock %} + +{% block admin_content %} + {% embed '@ChillMain/CRUD/_new_content.html.twig' %} + {% block content_form_actions_save_and_show %}{% endblock %} + {% endembed %} +{% endblock admin_content %} + diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 266970698..7fdec7314 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -409,6 +409,12 @@ crud: add_new: Ajouter un nouveau title_new: Nouvelle position title_edit: Modifier la position + person_household_composition_type: + index: + title: Composition + add_new: Ajouter un nouveau + title_new: Nouvelle composition + title_edit: Modifier la composition person_relation: index: title: Relations de filiations From 80df7b2f72f7b8ec1d85c34eb6368f9fe730ae98 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 18 Jul 2022 16:37:34 +0200 Subject: [PATCH 030/191] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bcbb28db..994d4bd61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to * [search]: Order of birthdate fields changed in advanced search to avoid confusion. * [workflow]: Constraint added to workflow (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/675) * [household]: Reposition and cut button for enfant hors menage have been deleted (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/620) +* [admin]: Add crud for composition type in admin (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/611) ## Test releases From 881e608c87fe450e0ad0e6afcb912bfb271383f1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 18 Jul 2022 18:45:02 +0200 Subject: [PATCH 031/191] exports: add a new user scope filter --- .../ChillPersonBundle/Export/Declarations.php | 2 + .../Export/Export/CountAccompanyingCourse.php | 5 +- .../Export/StatAccompanyingCourseDuration.php | 5 +- .../Export/Export/UserScopeFilter.php | 101 ++++++++++++++++++ .../config/services/exports.yaml | 16 ++- .../translations/messages.fr.yml | 4 + 6 files changed, 125 insertions(+), 8 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index b23325e5e..bb892a69c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -19,4 +19,6 @@ abstract class Declarations public const PERSON_IMPLIED_IN = 'person_implied_in'; public const PERSON_TYPE = 'person'; + + public const ACP_TYPE = 'accompanying_period'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 39df61cb8..69ab19a55 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; +use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; @@ -82,7 +83,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function getType(): string { - return 'accompanying_period'; + return Declarations::ACP_TYPE; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder @@ -107,7 +108,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function supportsModifiers(): array { - return []; + return [Declarations::ACP_TYPE]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 1241c7f88..639fa56a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\Query; @@ -109,7 +110,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn */ public function getType(): string { - return 'accompanying_course'; + return Declarations::ACP_TYPE; } /** @@ -152,7 +153,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn */ public function supportsModifiers(): array { - return []; + return [Declarations::ACP_TYPE]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php new file mode 100644 index 000000000..58aaf1b67 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php @@ -0,0 +1,101 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function describeAction($data, $format = 'string') + { + // to complete.. + return ['Filtered by user scopes']; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('acp.user', 'u') + ->join('u.mainScope', 's') + ; + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('u.mainScope', ':userscope'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('userscope', $data['accepted_userscope']); + + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('accepted_userscope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function(Scope $s) { + return $this->translatableStringHelper->localize($s->getName()); + }, + 'multiple' => true, + 'expanded' => true, + ]) + ; + } + + public function getTitle() + { + return 'Filter by user scope'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 19ed9174b..dad6cbf05 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -26,19 +26,19 @@ services: tags: - { name: chill.export, alias: list_person_duplicate } - chill.person.export.count_accompanying_course: + chill.person.export.count_accompanyingcourse: class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse arguments: - "@doctrine.orm.entity_manager" tags: - - { name: chill.export, alias: count_accompanying_course } + - { name: chill.export, alias: count_accompanyingcourse } - chill.person.export.avg_accompanying_course_duration: + chill.person.export.avg_accompanyingcourse_duration: class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration arguments: - '@Chill\PersonBundle\Repository\AccompanyingPeriodRepository' tags: - - { name: chill.export, alias: avg_accompanying_course_duration } + - { name: chill.export, alias: avg_accompanyingcourse_duration } chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter @@ -58,6 +58,14 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_nationality_filter } + + chill.person.export.filter_userscope: + class: Chill\PersonBundle\Export\Filter\UserScopeFilter + arguments: + $translator: '@translator' + $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + tags: + - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index b2cd212e6..382331503 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -376,6 +376,10 @@ Having an accompanying period closed after this date: Ayant une période d'accom "Having an accompanying period closed before this date": "Ayant une période d'accompagnement fermée avant cette date" "Filtered by accompanying period: persons having an accompanying period closed between the %date_from% and %date_to%": "Filtrer par période d'accompagnement: ayant une période fermée entre le %date_from% et le %date_to%" +Filter by user scope: Filtrer par service du référent +Accepted userscope: Services +Filtered by user scopes: Filtré par service du référent + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From 70f118011b8bd7c9e96a6afebfc87c38fce838e0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 19 Jul 2022 15:04:57 +0200 Subject: [PATCH 032/191] exports: add a new user job filter --- .../Export/Filter/UserJobFilter.php | 102 ++++++++++++++++++ .../{Export => Filter}/UserScopeFilter.php | 0 .../config/services/exports.yaml | 8 ++ .../translations/messages.fr.yml | 4 + 4 files changed, 114 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php rename src/Bundle/ChillPersonBundle/Export/{Export => Filter}/UserScopeFilter.php (100%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php new file mode 100644 index 000000000..6e2c7d19f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php @@ -0,0 +1,102 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function describeAction($data, $format = 'string') + { + // to complete.. + return ['Filtered by user jobs']; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('acp.user', 'u') + ->join('u.userJob', 'j') + ; + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('u.userJob', ':userjob'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('userjob', $data['accepted_userjob']); + + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('accepted_userjob', EntityType::class, [ + 'class' => UserJob::class, + 'choice_label' => function(UserJob $j) { + return $this->translatableStringHelper->localize($j->getLabel()); + }, + 'multiple' => true, + 'expanded' => true, + ]) + ; + } + + public function getTitle() + { + return 'Filter by user job'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php similarity index 100% rename from src/Bundle/ChillPersonBundle/Export/Export/UserScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index dad6cbf05..4cf752870 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -66,6 +66,14 @@ services: $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' tags: - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } + + chill.person.export.filter_userjob: + class: Chill\PersonBundle\Export\Filter\UserJobFilter + arguments: + $translator: '@translator' + $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + tags: + - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 382331503..122571198 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -380,6 +380,10 @@ Filter by user scope: Filtrer par service du référent Accepted userscope: Services Filtered by user scopes: Filtré par service du référent +Filter by user job: Filtrer par métier du référent +Accepted userjob: Métiers +Filtered by user jobs: Filtré par métier du référent + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From d7c14988825f090ce77d4f0fcd72a174ee867590 Mon Sep 17 00:00:00 2001 From: LenaertsJ Date: Tue, 19 Jul 2022 14:20:38 +0000 Subject: [PATCH 033/191] english corrected --- docs/source/development/exports.rst | 114 ++++++++++++++-------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/docs/source/development/exports.rst b/docs/source/development/exports.rst index 2d3323ff7..3b01f9e0f 100644 --- a/docs/source/development/exports.rst +++ b/docs/source/development/exports.rst @@ -10,17 +10,17 @@ Exports ******* -Export is an important issue for the Chill software : users should be able to : +Export is an important issue within the Chill software : users should be able to : - compute statistics about their activity ; -- list "things" which make part of their activities. +- list "things" which are a part of their activities. The `main bundle`_ provides a powerful framework to build custom queries with re-usable parts across differents bundles. .. contents:: Table of content :local: -.. seealso:: +.. seealso:: `The issue where this framework was discussed `_ Provides some information about the pursued features and architecture. @@ -32,37 +32,37 @@ Concepts Some vocabulary: 3 "Export elements" ------------------------------------ -Four terms are used for this framework : +Four terms are used for this framework : -exports - provides some basic operation on the date. Two kind of exports are available : +Exports + provide some basic operation on the data. Two kinds of exports are available : - computed data : it may be "the number of people", "the number of activities", "the duration of activities", ... - - list data : it may be "the list of people", "the list of activity", ... + - list data : it may be "the list of people", "the list of activities", ... -filters - The filters make a filter on the date: it removes some information the user doesn't want to introduce in the computation done by export. In other word, filters make a filter... +Filters + The filters create a filter on the data: it removes some information the user doesn't want to introduce in the computation done by the export. - Example of filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ... + Example of a filter: "people under 18 years olds", "activities between the 1st of June and the 31st December", ... -aggregators - The aggregator aggregates the data into some group (some software use the term 'bucket'). +Aggregators + The aggregator aggregates the data into some group (some software use the term 'bucket'). - Example of aggregator : "group people by gender", "group people by nationality", "group activity by type", ... + Example of an aggregator : "group people by gender", "group people by nationality", "group activity by type", ... -formatters - The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client. +Formatters + The formatters format the data into a :class:`Symfony\Component\HttpFoundation\Response`, which will be returned "as is" by the controller to the web client. - Example of formatter: "format data as CSV", "format data as ods spreadsheet", ... + Example of a formatter: "format data as CSV", "format data as an ods spreadsheet", ... Anatomy of an export --------------------- -An export may be explained as a sentence, where each part of this sentence refers to one or multiple exports element. Examples : +An export can be thought of as a sentence where each part of this sentence refers to one or multiple export elements. Examples : **Example 1**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender, and format them in a CSV spreadsheet. -Here : +Here : - *count the number of people* is the export part - *having at least one activity* is the filter part @@ -72,10 +72,10 @@ Here : Note that : -- aggregators, filters, exports and aggregators are cross-bundle. Here the bundle *activity* provides a filter which apply on an export provided by the person bundle ; -- there may exists multiple aggregator or filter for one export. Currently, only one export is allowed. +- Aggregators, filters, exports and formatters are cross-bundle. Here the bundle *activity* provides a filter which is applied on an export provided by the person bundle ; +- Multiple aggregator or filter for one export may exist. Currently, only one export is allowed. -The result might be : +The result might be : +-----------------------+----------------+---------------------------+ | Nationality | Gender | Number of people | @@ -89,9 +89,9 @@ The result might be : | France | Female | 150 | +-----------------------+----------------+---------------------------+ -**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in a OpenDocument spreadsheet. +**Example 2**: Count the average duration of an activity with type "meeting", which occurs between the 1st of June and the 31st of December, group them by week, and format the data in an OpenDocument spreadsheet. -Here : +Here : - *count the average duration of an activity* is the export part - *activity with type meeting* is a filter part @@ -102,7 +102,7 @@ Here : The result might be : +-----------------------+----------------------+ -| Week | Number of activities | +| Week | Number of activities | +=======================+======================+ | 2015-10 | 10 | +-----------------------+----------------------+ @@ -116,77 +116,77 @@ The result might be : Authorization and exports ------------------------- -Exports, filters and aggregators should not make see data the user is not allowed to see. +Exports, filters and aggregators should not show data the user is not allowed to see within the application. In other words, developers are required to take care of user authorization for each export. -It should exists a special role that should be granted to users which are allowed to build exports. For more simplicity, this role should apply on center, and should not requires special circles. +There should be a specific role that grants permission to users who are allowed to build exports. For more simplicity, this role should apply on a center, and should not require special circles. -How does the magic works ? +How does the magic work ? =========================== To build an export, we rely on the capacity of the database to execute queries with aggregate (i.e. GROUP BY) and filter (i.e. WHERE) instructions. An export is an SQL query which is initiated by an export, and modified by aggregators and filters. -.. note:: +.. note:: **Example**: Count the number of people having at least one activity in the last 12 month, and group them by nationality and gender - 1. The report initiate the query + 1. The report initiates the query .. code-block:: SQL SELECT count(people.*) FROM people - 2. The filter add a where and join clause : + 2. The filter adds a where and join clause : .. code-block:: SQL - SELECT count(people.*) FROM people - RIGHT JOIN activity + SELECT count(people.*) FROM people + RIGHT JOIN activity WHERE activity.date IS BETWEEN now AND 6 month ago - 3. The aggregator "nationality" add a GROUP BY clause and a column in the SELECT statement: + 3. The aggregator "nationality" adds a GROUP BY clause and a column in the SELECT statement: .. code-block:: sql - SELECT people.nationality, count(people.*) FROM people - RIGHT JOIN activity - WHERE activity.date IS BETWEEN now AND 6 month ago + SELECT people.nationality, count(people.*) FROM people + RIGHT JOIN activity + WHERE activity.date IS BETWEEN now AND 6 month ago GROUP BY nationality - 4. The aggregator "gender" do the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement : + 4. The aggregator "gender" does the same job as the nationality aggregator : it adds a GROUP BY clause and a column in the SELECT statement : .. code-block:: sql - SELECT people.nationality, people.gender, count(people.*) - FROM people RIGHT JOIN activity - WHERE activity.date IS BETWEEN now AND 6 month ago + SELECT people.nationality, people.gender, count(people.*) + FROM people RIGHT JOIN activity + WHERE activity.date IS BETWEEN now AND 6 month ago GROUP BY nationality, gender -Each filter, aggregator and filter may collect parameters from the user by providing a form. This form is appended to the export form. Here is an example. +Each filter, aggregator and filter may collect parameters from the user through a form. This form is appended to the export form. Here is an example. .. figure:: /_static/screenshots/development/export_form-fullpage.png - The screenshot show the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which allow to show a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other filter, which are unchecked, does not show the subform. + The screenshot shows the export form for ``CountPeople`` (Nombre de personnes). The filter by date of birth is checked (*Filtrer par date de naissance de la personne*), which triggers a subform, which is provided by the :class:`Chill\PersonBundle\Export\Filter\BirthdateFilter`. The other unchecked filter does not show the subform. - Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also open a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform. + Two aggregators are also checked : by Country of birth (*Aggréger les personnes par pays de naissance*, the corresponding class is :class:`Chill\PersonBundle\Export\Aggregator\CountryOfBirthAggregator`, which also triggers a subform. The aggregator by gender (*Aggréger les personnes par genre*) is also checked, but there is no corresponding subform. The Export Manager ------------------ -The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which register all exports, aggregators, filters and formatters. +The Export manager (:class:`Chill\MainBundle\Export\ExportManager` is the central class which registers all exports, aggregators, filters and formatters. -The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` to each export request. +The export manager is also responsible for orchestrating the whole export process, producing a :class:`Symfony\FrameworkBundle\HttpFoundation\Request` for each export request. The export form step -------------------- -The form step allow to build a form, aggregating different parts of the module. +The form step allows you to build a form, combining different parts of the module. -The building of forms is separated between different subform, which are responsible for rendering their part of the form (aggregators, filters, and export). +The building of forms is split into different subforms, where each one is responsible for rendering their part of the form (aggregators, filters, and export). .. figure:: /_static/puml/exports/form_steps.png :scale: 40% @@ -194,12 +194,12 @@ The building of forms is separated between different subform, which are responsi The formatter form step ----------------------- -The formatter form is processed *after* the user filled the export form. It is built the same way, but receive in parameters the data entered by the user on the previous step (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators). +The formatter form is processed *after* the user filled the export form. It is built the same way, but receives the data entered by the user on the previous step as parameters (i.e. export form). It may then adapt it accordingly (example: show a list of columns selected in aggregators). Processing the export --------------------- -The export process may be explained by this schema : +The export process can be explained by this schema : .. figure:: /_static/puml/exports/processing_export.png :scale: 40% @@ -219,20 +219,20 @@ This is an example of the ``CountPerson`` export : :language: php :linenos: -* **Line 36**: the ``getType`` function return a string. This string will be used to find the aggregtors and filters which will apply to this export. -* **Line 41**: a simple description to help user to understand what your export does. +* **Line 36**: the ``getType`` function returns a string. This string will be used to find the aggregtors and filters which will apply to this export. +* **Line 41**: a simple description to help users understand what your export does. * **Line 46**: The title of the export. A summary of what your export does. -* **Line 51**: The list of roles requires to execute this export. +* **Line 51**: The list of roles required to execute this export. * **Line 56**: We initiate the query here... -* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` object in one array -* **Line 63**: We create the query, with a query builder. -* **Line 74**: We simply returns the result, but take care of hydrating the results as an array. -* **Line 103**: return the list of formatters types which are allowed to apply on this filter +* **Line 59**: We have to filter the query with centers the users checked in the form. We process the $acl variable to get all ``Center`` objects in one array +* **Line 63**: We create the query with a query builder. +* **Line 74**: We return the result, but make sure to hydrate the results as an array. +* **Line 103**: return the list of formatter types which are allowed to be applied on this filter Filters ------- -This is an example of the *filter by birthdate*. This filter ask some information in a form (`buildForm` is not empty), and this form must be validated. To performs this validations, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`: +This is an example of the *filter by birthdate*. This filter asks some information through a form (`buildForm` is not empty), and this form must be validated. To perform this validation, we implement a new Interface: :class:`Chill\MainBundle\Export\ExportElementValidatedInterface`: .. literalinclude:: /_static/code/exports/BirthdateFilter.php :language: php From ff8a32a321c7682a22d116d4f6a7761fa738e855 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 11:23:03 +0200 Subject: [PATCH 034/191] user scope filter: change query (TO CHECK) --- .../ChillPersonBundle/Export/Filter/UserScopeFilter.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php index 58aaf1b67..8f4eefb88 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php @@ -56,13 +56,10 @@ class UserScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('acp.user', 'u') - ->join('u.mainScope', 's') - ; + $qb->join('acp.scopes', 's'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.mainScope', ':userscope'); + $clause = $qb->expr()->in('s.id', ':userscope'); if ($where instanceof Andx) { $where->add($clause); From 7f1dadc136eef38bfb536f96d1ae801096075e49 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 11:24:13 +0200 Subject: [PATCH 035/191] user scope/job filters: improve translation in csv --- .../Export/Filter/UserJobFilter.php | 16 ++++++++++++++-- .../Export/Filter/UserScopeFilter.php | 16 ++++++++++++++-- .../translations/messages.fr.yml | 4 ++-- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php index 6e2c7d19f..a3fe907b1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php @@ -46,8 +46,20 @@ class UserJobFilter implements FilterInterface public function describeAction($data, $format = 'string') { - // to complete.. - return ['Filtered by user jobs']; + $jobs = []; + + foreach ($data['accepted_userjob'] as $j) { + if ('null' === $j) { + $jobs[] = $this->translator->trans('Not given'); + } else { + $jobs[] = $this->translatableStringHelper->localize($j->getLabel()); + } + } + + return [ + 'Filtered by user jobs: only %jobs%', + ['%jobs%' => implode(', ', $jobs)], + ]; } public function addRole() diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php index 8f4eefb88..f235d9b86 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php @@ -45,8 +45,20 @@ class UserScopeFilter implements FilterInterface public function describeAction($data, $format = 'string') { - // to complete.. - return ['Filtered by user scopes']; + $scopes = []; + + foreach ($data['accepted_userscope'] as $s) { + if ('null' === $s) { + $scopes[] = $this->translator->trans('Not given'); + } else { + $scopes[] = $this->translatableStringHelper->localize($s->getName()); + } + } + + return [ + 'Filtered by user scopes: only %scopes%', + ['%scopes%' => implode(', ', $scopes)], + ]; } public function addRole() diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 122571198..7939a083d 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -378,11 +378,11 @@ Having an accompanying period closed after this date: Ayant une période d'accom Filter by user scope: Filtrer par service du référent Accepted userscope: Services -Filtered by user scopes: Filtré par service du référent +"Filtered by user scopes: only %scopes%": "Filtré par service du référent: uniquement %scopes%" Filter by user job: Filtrer par métier du référent Accepted userjob: Métiers -Filtered by user jobs: Filtré par métier du référent +"Filtered by user jobs: only %jobs%": "Filtré par métier du référent: uniquement %jobs%" ## aggregators Group people by nationality: Aggréger les personnes par nationalités From b60897632659a3e8c3e46750bd63586a3b6c0ab9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 13:47:15 +0200 Subject: [PATCH 036/191] exports: add new step filter --- .../Export/Filter/StepFilter.php | 85 +++++++++++++++++++ .../config/services/exports.yaml | 17 ++-- .../translations/messages.fr.yml | 10 ++- 3 files changed, 103 insertions(+), 9 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php new file mode 100644 index 000000000..4c2183a7a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php @@ -0,0 +1,85 @@ + AccompanyingPeriod::STEP_DRAFT, + 'Confirmed' => AccompanyingPeriod::STEP_CONFIRMED, + 'Closed' => AccompanyingPeriod::STEP_CLOSED, + ]; + + private const DEFAULT_CHOICE = AccompanyingPeriod::STEP_CONFIRMED; + + /** + * @var TranslatorInterface + */ + protected $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_step', ChoiceType::class, [ + 'choices' => self::STEPS, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle() + { + return 'Filter by step'; + } + + public function describeAction($data, $format = 'string') + { + $step = array_flip(self::STEPS)[$data['accepted_step']]; + + return ["Filtered by steps: only %step%", [ + '%step%' => $this->translator->trans($step) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.step', ':step'); + + // override original where clause + $where = $qb->expr()->andX($clause); + + $qb->add('where', $where); + $qb->setParameter('step', $data['accepted_step']); + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 4cf752870..e58ba3ef5 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -61,19 +61,24 @@ services: chill.person.export.filter_userscope: class: Chill\PersonBundle\Export\Filter\UserScopeFilter - arguments: - $translator: '@translator' - $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + autowire: true + autoconfigure: true tags: - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } chill.person.export.filter_userjob: class: Chill\PersonBundle\Export\Filter\UserJobFilter - arguments: - $translator: '@translator' - $translatableStringHelper: '@Chill\MainBundle\Templating\TranslatableStringHelper' + autowire: true + autoconfigure: true tags: - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } + + chill.person.export.filter_step: + class: Chill\PersonBundle\Export\Filter\StepFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_step_filter } chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7939a083d..42b6e6840 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -384,6 +384,10 @@ Filter by user job: Filtrer par métier du référent Accepted userjob: Métiers "Filtered by user jobs: only %jobs%": "Filtré par métier du référent: uniquement %jobs%" +Filter by step: Filtrer par statut du parcours +Accepted step: Statuts +"Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau @@ -536,9 +540,9 @@ occasional: ponctuel regular: régulier Confidential: confidentiel confidential: confidentiel -Draft: brouillon -Confirmed: en file active -Closed: Cloturé +Draft: Brouillon +Confirmed: En file active +Closed: Clôturé # Accompanying Course Accompanying Course: Parcours d'accompagnement From bb22317eb108380c3af0c25131e2953472c10603 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 16:38:46 +0200 Subject: [PATCH 037/191] exports: add new social issues filter (wip) --- .../Export/Filter/SocialIssueFilter.php | 97 +++++++++++++++++++ .../config/services/exports.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 108 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php new file mode 100644 index 000000000..eac3544f8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -0,0 +1,97 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialissue', EntityType::class, [ + 'class' => SocialIssue::class, + 'choice_label' => function(SocialIssue $s) { + return $this->translatableStringHelper->localize($s->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle() + { + return 'Filter by social issue'; + } + + public function describeAction($data, $format = 'string') + { + $issues = []; + + foreach ($data['accepted_socialissue'] as $i) { + if ('null' === $i) { + $issues[] = $this->translator->trans('Not given'); + } else { + $issues[] = $this->translatableStringHelper->localize($i->getTitle()); + } + } + + return [ + 'Filtered by socialissues: only %socialissues%', [ + '%socialissues%' => implode(', ', $issues) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.socialIssues', 's'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('s.id', ':socialissues'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('socialissues', $data['accepted_socialissue']); + } + + public function applyOn() + { + return Declarations::ACP_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index e58ba3ef5..2a02707ed 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -73,6 +73,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } + chill.person.export.filter_socialissue: + class: Chill\PersonBundle\Export\Filter\SocialIssueFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_socialissue_filter } + chill.person.export.filter_step: class: Chill\PersonBundle\Export\Filter\StepFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 42b6e6840..690936ae4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -384,6 +384,10 @@ Filter by user job: Filtrer par métier du référent Accepted userjob: Métiers "Filtered by user jobs: only %jobs%": "Filtré par métier du référent: uniquement %jobs%" +Filter by social issue: Filtrer par problématiques sociales +Accepted socialissue: Problématiques sociales +"Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" + Filter by step: Filtrer par statut du parcours Accepted step: Statuts "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" From 0d38d4df40b497758e9f58a4501e6755f2590ebf Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 19:33:42 +0200 Subject: [PATCH 038/191] social issues filter: improve render with parents, add parents in where clause --- .../Export/Filter/SocialIssueFilter.php | 55 +++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php index eac3544f8..f82873dcd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -6,6 +6,7 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\SocialIssue; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Templating\Entity\SocialIssueRender; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -24,20 +25,27 @@ class SocialIssueFilter implements FilterInterface */ private TranslatableStringHelper $translatableStringHelper; + /** + * @var SocialIssueRender + */ + private SocialIssueRender $socialIssueRender; + public function __construct( TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper + TranslatableStringHelper $translatableStringHelper, + SocialIssueRender $socialIssueRender ) { $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; + $this->socialIssueRender = $socialIssueRender; } public function buildForm(FormBuilderInterface $builder) { $builder->add('accepted_socialissue', EntityType::class, [ 'class' => SocialIssue::class, - 'choice_label' => function(SocialIssue $s) { - return $this->translatableStringHelper->localize($s->getTitle()); + 'choice_label' => function ($socialIssue) { + return $this->socialIssueRender->renderString($socialIssue, []); }, 'multiple' => true, 'expanded' => true, @@ -57,7 +65,7 @@ class SocialIssueFilter implements FilterInterface if ('null' === $i) { $issues[] = $this->translator->trans('Not given'); } else { - $issues[] = $this->translatableStringHelper->localize($i->getTitle()); + $issues[] = $this->socialIssueRender->renderString($i, []); } } @@ -86,7 +94,44 @@ class SocialIssueFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('socialissues', $data['accepted_socialissue']); + $qb->setParameter('socialissues', + $this->addParentIssues($data['accepted_socialissue']) + ); + } + + /** + * "Le filtre retiendra les parcours qui comportent cette problématique, + * ou une problématique parente à celles choisies." + * + * Add parent of each socialissue selected, and remove duplicates + * + * @param $accepted_issues + * @return array + */ + private function addParentIssues($accepted_issues) + { + $array = []; + foreach ($accepted_issues as $i) + { + /** @var SocialIssue $i */ + if ($i->hasParent()) { + $array[] = $i->getParent(); + } + $array[] = $i; + } + return $this->removeDuplicate($array); + } + + private function removeDuplicate(array $array): array + { + $ids = array_map(function ($item) { + return $item->getId(); + }, $array); + + $unique_ids = array_unique($ids); dump($unique_ids); + + return array_values( + array_intersect_key($array, $unique_ids)); } public function applyOn() From d5d3866122c1ffb6d636c2a980962ed70ece0a79 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 20 Jul 2022 23:17:05 +0200 Subject: [PATCH 039/191] fix conflict with where clause in indicator ; initiate a filter test --- .../Export/Export/CountAccompanyingCourse.php | 3 - .../Export/StatAccompanyingCourseDuration.php | 3 - .../Export/Filter/SocialIssueFilter.php | 6 +- .../Export/Filter/StepFilter.php | 7 ++- .../Export/Filter/SocialIssueFilterTest.php | 63 +++++++++++++++++++ 5 files changed, 71 insertions(+), 11 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 69ab19a55..b7b57d3cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -93,9 +93,6 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface $qb->select('COUNT(acp.id) AS export_result') ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') - ->where($expr->neq( - 'acp.step', $expr->literal('DRAFT') - )) ; return $qb; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 639fa56a4..8747c288a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -131,9 +131,6 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn ELSE :force_closingDate END ) - acp.openingDate ) AS export_result') - ->where($expr->neq( - 'acp.step', $expr->literal('DRAFT') - )) ->setParameter('force_closingDate', $force_closingdate) ; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php index f82873dcd..b26e523eb 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -82,10 +82,10 @@ class SocialIssueFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.socialIssues', 's'); + $qb->join('acp.socialIssues', 'si'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('s.id', ':socialissues'); + $clause = $qb->expr()->in('si.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause); @@ -128,7 +128,7 @@ class SocialIssueFilter implements FilterInterface return $item->getId(); }, $array); - $unique_ids = array_unique($ids); dump($unique_ids); + $unique_ids = array_unique($ids); return array_values( array_intersect_key($array, $unique_ids)); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php index 4c2183a7a..ac47be949 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php @@ -70,8 +70,11 @@ class StepFilter implements FilterInterface $where = $qb->getDQLPart('where'); $clause = $qb->expr()->eq('acp.step', ':step'); - // override original where clause - $where = $qb->expr()->andX($clause); + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } $qb->add('where', $where); $qb->setParameter('step', $data['accepted_step']); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php new file mode 100644 index 000000000..ed520e90b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php @@ -0,0 +1,63 @@ +filter = self::$container->get('chill.person.export.filter_socialissue'); + } catch (ServiceNotFoundException $e) { + $this->markTestSkipped('Filter service is not found'); + } + } + + public function getFilter() + { + return $this->filter; + } + + public function getFormData() + { + return [ + ['accepted_socialissue' => [ + + ]], + ['accepted_socialissue' => [ + + ]], + ['accepted_socialissue' => [ + + ]], + ]; + } + + public function getQueryBuilders() + { + // TODO: Implement getQueryBuilders() method. + } + +} \ No newline at end of file From ddd0aeb7b4ae03fc25e7c477f4dfb86b5a8b8070 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 22 Jul 2022 14:08:43 +0200 Subject: [PATCH 040/191] issue 605: improve the way chill loads bootstrap module custom variables are loaded before bootstrap variables, custom maps are loaded after --- .../public/module/bootstrap/_shared.scss | 23 +- .../public/module/bootstrap/bootstrap.scss | 23 +- .../public/module/bootstrap/custom/_maps.scss | 69 + .../module/bootstrap/custom/_variables.scss | 1496 +---------------- 4 files changed, 131 insertions(+), 1480 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_maps.scss diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss index 21e1ceca0..c216c5cf8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/_shared.scss @@ -1,14 +1,23 @@ -// Configuration +/* + * This shared file is used in Chill sass sheets and Vue sass styles to use some bootstrap/chill variables. + * Search on @import 'ChillMainAssets/module/bootstrap/shared'; + */ + +// 1. Include functions first (so you can manipulate colors, SVGs, calc, etc) @import "bootstrap/scss/functions"; -/* -* Replaced by CHILL variables -* it is necessary to keep the possibility of making a diff with original ! -* original: "bootstrap/scss/variables"; -*/ +// 2. Include any default variable overrides here @import "custom/_variables"; +// 3. Include remainder of required Bootstrap stylesheets +@import "bootstrap/scss/variables"; + +// 4. Include any default map overrides here +@import "custom/_maps"; + +// 5. Include remainder of required parts @import "bootstrap/scss/mixins"; -@import "bootstrap/scss/utilities"; +@import "bootstrap/scss/root"; + diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/bootstrap.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/bootstrap.scss index cf36a9a54..a8d5f2f13 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/bootstrap.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/bootstrap.scss @@ -1,18 +1,8 @@ -/*! - * Bootstrap v5.0.1 (https://getbootstrap.com/) - * Copyright 2011-2021 The Bootstrap Authors - * Copyright 2011-2021 Twitter, Inc. - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) - * - * Enable / disable bootstrap assets - */ - -// Bootstrap configuration files are shared with chill entrypoint +// Some Bootstrap variables and configuration files are shared with chill entrypoint @import "shared"; -// scss-docs-start import-stack -// Layout & components -@import "bootstrap/scss/root"; +// 6. Optionally include any other parts as needed +@import "bootstrap/scss/utilities"; @import "bootstrap/scss/reboot"; @import "bootstrap/scss/type"; @import "bootstrap/scss/images"; @@ -42,14 +32,11 @@ @import "bootstrap/scss/carousel"; @import "bootstrap/scss/spinners"; @import "bootstrap/scss/offcanvas"; - -// Helpers @import "bootstrap/scss/helpers"; -// Utilities +// 7. Optionally include utilities API last to generate classes based on the Sass map in @import "bootstrap/scss/utilities/api"; -// scss-docs-end import-stack -// CHILL custom +// 8. Add additional custom code here @import "custom"; @import "custom/_debug"; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_maps.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_maps.scss new file mode 100644 index 000000000..a2f996fb9 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_maps.scss @@ -0,0 +1,69 @@ +//// CHILL OVERRIDE DEFAULT BOOTSTRAP COLORS MAP + +// 'beige' variations +$beige-100: tint-color($beige, 80%); +$beige-200: tint-color($beige, 60%); +$beige-300: tint-color($beige, 40%); +$beige-400: tint-color($beige, 20%); +$beige-500: $beige; +$beige-600: shade-color($beige, 20%); +$beige-700: shade-color($beige, 40%); +$beige-800: shade-color($beige, 60%); +$beige-900: shade-color($beige, 80%); + +$chill-blue: $blue; +$chill-green: $green; +$chill-green-dark: $green-600; +$chill-orange: $orange; +$chill-yellow: $yellow; +$chill-red: $red; +$chill-beige: $beige; +$chill-pink: $pink; +$chill-dark-gray: $gray-800; +$chill-gray: $gray-600; +$chill-l-gray: $gray-400; +$chill-ll-gray: $gray-300; +$chill-light-gray: $gray-200; +$chill-llight-gray: $gray-100; + +$colors: ( + "blue": $blue, + "green": $green, + "green-dark": $green-600, + "yellow": $yellow, + "orange": $orange, + "red": $red, + "pink": $pink, + "beige": $beige, + "white": $white, + "gray": $gray-600, + "dark": $gray-800, + "black": $black +); + +$chill-colors: ( + "chill-blue": $chill-blue, + "chill-green": $chill-green, + "chill-green-dark": $chill-green-dark, + "chill-orange": $chill-orange, + "chill-yellow": $chill-yellow, + "chill-red": $chill-red, + "chill-beige": $chill-beige, + "chill-pink": $chill-pink, + "chill-dark-gray": $chill-dark-gray, + "chill-gray": $chill-gray, + "chill-l-gray": $chill-l-gray, + "chill-ll-gray": $chill-ll-gray, + "chill-light-gray": $chill-light-gray, + "chill-llight-gray": $chill-llight-gray, +); + +// Merge the maps +$theme-colors: map-merge($theme-colors, $chill-colors); + +// Chill color classes +@each $color, $value in $chill-colors { + .#{$color} { + color: $value; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss index f9cd33f5f..26bf517ed 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/module/bootstrap/custom/_variables.scss @@ -1,144 +1,32 @@ -// Variables -// -// Variables should follow the `$component-state-property-size` formula for -// consistent naming. Ex: $nav-link-disabled-color and $modal-content-box-shadow-xs. - -// Color system - -// scss-docs-start gray-color-variables -$white: #fff !default; -$gray-100: #f3f3f3 !default; -$gray-200: #e6e6e6 !default; -$gray-300: #dee2e6 !default; -$gray-400: #ced4da !default; -$gray-500: #b2b2b2 !default; -$gray-600: #6c757d !default; -$gray-700: #495057 !default; -$gray-800: #2c2d2f !default; -$gray-900: #212529 !default; -$black: #111 !default; -// scss-docs-end gray-color-variables - -// fusv-disable -// scss-docs-start gray-colors-map -$grays: ( - "100": $gray-100, - "200": $gray-200, /* = $chill-light-gray, $chill-gray */ - "300": $gray-300, - "400": $gray-400, - "500": $gray-500, /* = $chill-light-gray */ - "600": $gray-600, - "700": $gray-700, - "800": $gray-800, /* = $chill-dark-gray */ - "900": $gray-900 -) !default; -// scss-docs-end gray-colors-map -// fusv-enable - /* * CHILL Theme colors - * (apply chill colors, add missing colors, trust in bootstrap grey scale) */ -// scss-docs-start color-variables -$blue: #334d5c !default; -$green: #43b29d !default; -$yellow: #eec84a !default; -$orange: #e2793d !default; -$red: #df4949 !default; -$pink: #dd506d !default; -$beige: #cabb9f !default; -// scss-docs-end color-variables -// fusv-disable -$blue-100: tint-color($blue, 80%) !default; -$blue-200: tint-color($blue, 60%) !default; -$blue-300: tint-color($blue, 40%) !default; -$blue-400: tint-color($blue, 20%) !default; -$blue-500: $blue !default; -$blue-600: shade-color($blue, 20%) !default; -$blue-700: shade-color($blue, 40%) !default; -$blue-800: shade-color($blue, 60%) !default; -$blue-900: shade-color($blue, 80%) !default; +//// CHILL OVERRIDE DEFAULT BOOTSTRAP COLORS VARIABLES -$beige-100: tint-color($beige, 80%) !default; -$beige-200: tint-color($beige, 60%) !default; -$beige-300: tint-color($beige, 40%) !default; -$beige-400: tint-color($beige, 20%) !default; -$beige-500: $beige !default; -$beige-600: shade-color($beige, 20%) !default; -$beige-700: shade-color($beige, 40%) !default; -$beige-800: shade-color($beige, 60%) !default; -$beige-900: shade-color($beige, 80%) !default; +$white: #fff; +$gray-100: #f3f3f3; +$gray-200: #e6e6e6; +$gray-300: #dee2e6; +$gray-400: #ced4da; +$gray-500: #b2b2b2; +$gray-600: #6c757d; +$gray-700: #495057; +$gray-800: #2c2d2f; +$gray-900: #212529; +$black: #111; -$pink-100: tint-color($pink, 80%) !default; -$pink-200: tint-color($pink, 60%) !default; -$pink-300: tint-color($pink, 40%) !default; -$pink-400: tint-color($pink, 20%) !default; -$pink-500: $pink !default; -$pink-600: shade-color($pink, 20%) !default; -$pink-700: shade-color($pink, 40%) !default; -$pink-800: shade-color($pink, 60%) !default; -$pink-900: shade-color($pink, 80%) !default; +// override main colors +// don't use indigo, purple, teal +// add 'beige' +$blue: #334d5c; +$green: #43b29d; +$yellow: #eec84a; +$orange: #e2793d; +$red: #df4949; +$pink: #dd506d; +$beige: #cabb9f; -$red-100: tint-color($red, 80%) !default; -$red-200: tint-color($red, 60%) !default; -$red-300: tint-color($red, 40%) !default; -$red-400: tint-color($red, 20%) !default; -$red-500: $red !default; -$red-600: shade-color($red, 20%) !default; -$red-700: shade-color($red, 40%) !default; -$red-800: shade-color($red, 60%) !default; -$red-900: shade-color($red, 80%) !default; - -$orange-100: tint-color($orange, 80%) !default; -$orange-200: tint-color($orange, 60%) !default; -$orange-300: tint-color($orange, 40%) !default; -$orange-400: tint-color($orange, 20%) !default; -$orange-500: $orange !default; -$orange-600: shade-color($orange, 20%) !default; -$orange-700: shade-color($orange, 40%) !default; -$orange-800: shade-color($orange, 60%) !default; -$orange-900: shade-color($orange, 80%) !default; - -$yellow-100: tint-color($yellow, 80%) !default; -$yellow-200: tint-color($yellow, 60%) !default; -$yellow-300: tint-color($yellow, 40%) !default; -$yellow-400: tint-color($yellow, 20%) !default; -$yellow-500: $yellow !default; -$yellow-600: shade-color($yellow, 20%) !default; -$yellow-700: shade-color($yellow, 40%) !default; -$yellow-800: shade-color($yellow, 60%) !default; -$yellow-900: shade-color($yellow, 80%) !default; - -$green-100: tint-color($green, 80%) !default; -$green-200: tint-color($green, 60%) !default; -$green-300: tint-color($green, 40%) !default; -$green-400: tint-color($green, 20%) !default; -$green-500: $green !default; -$green-600: shade-color($green, 20%) !default; -$green-700: shade-color($green, 40%) !default; -$green-800: shade-color($green, 60%) !default; -$green-900: shade-color($green, 80%) !default; -// fusv-enable - -// scss-docs-start colors-map -$colors: ( - "blue": $blue, - "green": $green, - "green-dark": $green-600, - "yellow": $yellow, - "orange": $orange, - "red": $red, - "pink": $pink, - "beige": $beige, - "white": $white, - "gray": $gray-600, - "dark": $gray-800, - "black": $black -) !default; -// scss-docs-end colors-map - -// scss-docs-start theme-color-variables $primary: $blue; $secondary: $gray-500; $success: $green; @@ -149,1331 +37,29 @@ $light: $gray-100; $dark: $gray-800; $black: $black; -$chill-blue: $blue; -$chill-green: $green; -$chill-green-dark: $green-600; -$chill-orange: $orange; -$chill-yellow: $yellow; -$chill-red: $red; -$chill-beige: $beige; -$chill-pink: $pink; -$chill-dark-gray: $gray-800; -$chill-gray: $gray-600; -$chill-l-gray: $gray-400; -$chill-ll-gray: $gray-300; -$chill-light-gray: $gray-200; -$chill-llight-gray: $gray-100; -// scss-docs-end theme-color-variables -// scss-docs-start theme-colors-map -$theme-colors: ( - "primary": $primary, - "secondary": $secondary, - "success": $success, - "info": $info, - "warning": $warning, - "danger": $danger, - "light": $light, - "dark": $dark, -) !default; -// scss-docs-end theme-colors-map +//// CHILL OVERRIDE DEFAULT BOOTSTRAP VARIABLES -$chill-colors: ( - "chill-blue": $chill-blue, - "chill-green": $chill-green, - "chill-green-dark": $chill-green-dark, - "chill-orange": $chill-orange, - "chill-yellow": $chill-yellow, - "chill-red": $chill-red, - "chill-beige": $chill-beige, - "chill-pink": $chill-pink, - "chill-dark-gray": $chill-dark-gray, - "chill-gray": $chill-gray, - "chill-l-gray": $chill-l-gray, - "chill-ll-gray": $chill-ll-gray, - "chill-light-gray": $chill-light-gray, - "chill-llight-gray": $chill-llight-gray, -); +$border-radius: .25rem; //.25rem !default; +$font-family-sans-serif: 'Open Sans'; //system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default; -// Merge the maps -$theme-colors: map-merge($theme-colors, $chill-colors); +$font-size-base-chill: 1rem; //$font-size-base: 1rem !default; +$h1-font-size: $font-size-base-chill * 2.0; //$font-size-base * 2.5 !default; +$h2-font-size: $font-size-base-chill * 1.5; //$font-size-base * 2 !default; +$h3-font-size: $font-size-base-chill * 1.25; //$font-size-base * 1.75 !default; +$h4-font-size: $font-size-base-chill * 1.15; //$font-size-base * 1.5 !default; +$h5-font-size: $font-size-base-chill * 1.05; //$font-size-base * 1.25 !default; -// Chill color classes -@each $color, $value in $chill-colors { - .#{$color} { - color: $value; - } -} +$headings-font-weight: 600; //500 !default; +$table-striped-bg-factor: .10; //.05 !default; +$table-active-bg-factor: .15; //.1 !default; +$table-hover-bg-factor: .125; //.075 !default; +$table-border-factor: .15; //.1 !default; +$btn-border-radius: 0; //$border-radius !default; +$btn-border-radius-sm: 0; //$border-radius-sm !default; +$btn-border-radius-lg: 0; //$border-radius-lg !default; -// The contrast ratio to reach against white, to determine if color changes from "light" to "dark". Acceptable values for WCAG 2.0 are 3, 4.5 and 7. -// See https://www.w3.org/TR/WCAG20/#visual-audio-contrast-contrast -$min-contrast-ratio: 4.5 !default; - -// Customize the light and dark text colors for use in our color contrast function. -$color-contrast-dark: $black !default; -$color-contrast-light: $white !default; - -// Characters which are escaped by the escape-svg function -$escaped-characters: ( - ("<", "%3c"), - (">", "%3e"), - ("#", "%23"), - ("(", "%28"), - (")", "%29"), -) !default; - -// Options -// -// Quickly modify global styling by enabling or disabling optional features. - -$enable-caret: true !default; -$enable-rounded: true !default; -$enable-shadows: false !default; -$enable-gradients: false !default; -$enable-transitions: true !default; -$enable-reduced-motion: true !default; -$enable-smooth-scroll: true !default; -$enable-grid-classes: true !default; -$enable-button-pointers: true !default; -$enable-rfs: true !default; -$enable-validation-icons: true !default; -$enable-negative-margins: false !default; -$enable-deprecation-messages: true !default; -$enable-important-utilities: true !default; - -// Prefix for :root CSS variables - -$variable-prefix: bs- !default; - -// Gradient -// -// The gradient which is added to components if `$enable-gradients` is `true` -// This gradient is also added to elements with `.bg-gradient` -// scss-docs-start variable-gradient -$gradient: linear-gradient(180deg, rgba($white, .15), rgba($white, 0)) !default; -// scss-docs-end variable-gradient - -// Spacing -// -// Control the default styling of most Bootstrap elements by modifying these -// variables. Mostly focused on spacing. -// You can add more entries to the $spacers map, should you need more variation. - -// scss-docs-start spacer-variables-maps -$spacer: 1rem !default; -$spacers: ( - 0: 0, - 1: $spacer / 4, - 2: $spacer / 2, - 3: $spacer, - 4: $spacer * 1.5, - 5: $spacer * 3, -) !default; - -$negative-spacers: if($enable-negative-margins, negativify-map($spacers), null) !default; -// scss-docs-end spacer-variables-maps - -// Position -// -// Define the edge positioning anchors of the position utilities. - -// scss-docs-start position-map -$position-values: ( - 0: 0, - 50: 50%, - 100: 100% -) !default; -// scss-docs-end position-map - -// Body -// -// Settings for the `` element. - -$body-bg: $white !default; -$body-color: $gray-900 !default; -$body-text-align: null !default; - - -// Links -// -// Style anchor elements. - -$link-color: $primary !default; -$link-decoration: underline !default; -$link-shade-percentage: 20% !default; -$link-hover-color: shift-color($link-color, $link-shade-percentage) !default; -$link-hover-decoration: null !default; - -$stretched-link-pseudo-element: after !default; -$stretched-link-z-index: 1 !default; - -// Paragraphs -// -// Style p element. - -$paragraph-margin-bottom: 1rem !default; - - -// Grid breakpoints -// -// Define the minimum dimensions at which your layout will change, -// adapting to different screen sizes, for use in media queries. - -// scss-docs-start grid-breakpoints -$grid-breakpoints: ( - xs: 0, - sm: 576px, - md: 768px, - lg: 992px, - xl: 1200px, - xxl: 1400px -) !default; -// scss-docs-end grid-breakpoints - -@include _assert-ascending($grid-breakpoints, "$grid-breakpoints"); -@include _assert-starts-at-zero($grid-breakpoints, "$grid-breakpoints"); - - -// Grid containers -// -// Define the maximum width of `.container` for different screen sizes. - -// scss-docs-start container-max-widths -$container-max-widths: ( - sm: 540px, - md: 720px, - lg: 960px, - xl: 1140px, - xxl: 1320px -) !default; -// scss-docs-end container-max-widths - -@include _assert-ascending($container-max-widths, "$container-max-widths"); - - -// Grid columns -// -// Set the number of columns and specify the width of the gutters. - -$grid-columns: 12 !default; -$grid-gutter-width: 1.5rem !default; -$grid-row-columns: 6 !default; - -$gutters: $spacers !default; - -// Container padding - -$container-padding-x: $grid-gutter-width / 2 !default; - - -// Components -// -// Define common padding and border radius sizes and more. - -// scss-docs-start border-variables -$border-width: 1px !default; -$border-widths: ( - 1: 1px, - 2: 2px, - 3: 3px, - 4: 4px, - 5: 5px -) !default; - -$border-color: $gray-300 !default; -// scss-docs-end border-variables - -// scss-docs-start border-radius-variables -$border-radius: .25rem !default; // <== -$border-radius-sm: .2rem !default; -$border-radius-lg: .3rem !default; -$border-radius-pill: 50rem !default; -// scss-docs-end border-radius-variables - -// scss-docs-start box-shadow-variables -$box-shadow: 0 .5rem 1rem rgba($black, .15) !default; -$box-shadow-sm: 0 .125rem .25rem rgba($black, .075) !default; -$box-shadow-lg: 0 1rem 3rem rgba($black, .175) !default; -$box-shadow-inset: inset 0 1px 2px rgba($black, .075) !default; -// scss-docs-end box-shadow-variables - -$component-active-color: $white !default; -$component-active-bg: $primary !default; - -// scss-docs-start caret-variables -$caret-width: .3em !default; -$caret-vertical-align: $caret-width * .85 !default; -$caret-spacing: $caret-width * .85 !default; -// scss-docs-end caret-variables - -$transition-base: all .2s ease-in-out !default; -$transition-fade: opacity .15s linear !default; -// scss-docs-start collapse-transition -$transition-collapse: height .35s ease !default; -// scss-docs-end collapse-transition - -// stylelint-disable function-disallowed-list -// scss-docs-start aspect-ratios -$aspect-ratios: ( - "1x1": 100%, - "4x3": calc(3 / 4 * 100%), - "16x9": calc(9 / 16 * 100%), - "21x9": calc(9 / 21 * 100%) -) !default; -// scss-docs-end aspect-ratios -// stylelint-enable function-disallowed-list - -// Typography -// -// Font, line-height, and color for body text, headings, and more. - -// scss-docs-start font-variables -// stylelint-disable value-keyword-case -$font-family-sans-serif: 'Open Sans'; -$font-family-monospace: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace !default; -// stylelint-enable value-keyword-case -$font-family-base: var(--#{$variable-prefix}font-sans-serif) !default; -$font-family-code: var(--#{$variable-prefix}font-monospace) !default; - -// $font-size-root effects the value of `rem`, which is used for as well font sizes, paddings and margins -// $font-size-base effects the font size of the body text -$font-size-root: null !default; -$font-size-base: 1rem !default; // Assumes the browser default, typically `16px` -$font-size-sm: $font-size-base * .875 !default; -$font-size-lg: $font-size-base * 1.25 !default; - -$font-weight-lighter: lighter !default; -$font-weight-light: 300 !default; -$font-weight-normal: 400 !default; -$font-weight-bold: 700 !default; -$font-weight-bolder: bolder !default; - -$font-weight-base: $font-weight-normal !default; - -$line-height-base: 1.5 !default; -$line-height-sm: 1.25 !default; -$line-height-lg: 2 !default; - -$h1-font-size: $font-size-base * 2.0 !default; -$h2-font-size: $font-size-base * 1.5 !default; -$h3-font-size: $font-size-base * 1.25 !default; -$h4-font-size: $font-size-base * 1.15 !default; -$h5-font-size: $font-size-base * 1.05 !default; -$h6-font-size: $font-size-base !default; -// scss-docs-end font-variables - -// scss-docs-start font-sizes -$font-sizes: ( - 1: $h1-font-size, - 2: $h2-font-size, - 3: $h3-font-size, - 4: $h4-font-size, - 5: $h5-font-size, - 6: $h6-font-size -) !default; -// scss-docs-end font-sizes - -// scss-docs-start headings-variables -$headings-margin-bottom: $spacer / 2 !default; -$headings-font-family: null !default; -$headings-font-style: null !default; -$headings-font-weight: 600 !default; -$headings-line-height: 1.2 !default; -$headings-color: null !default; -// scss-docs-end headings-variables - -// scss-docs-start display-headings -$display-font-sizes: ( - 1: 5rem, - 2: 4.5rem, - 3: 4rem, - 4: 3.5rem, - 5: 3rem, - 6: 2.5rem -) !default; - -$display-font-weight: 300 !default; -$display-line-height: $headings-line-height !default; -// scss-docs-end display-headings - -// scss-docs-start type-variables -$lead-font-size: $font-size-base * 1.25 !default; -$lead-font-weight: 300 !default; - -$small-font-size: .875em !default; - -$sub-sup-font-size: .75em !default; - -$text-muted: $gray-600 !default; - -$initialism-font-size: $small-font-size !default; - -$blockquote-margin-y: $spacer !default; -$blockquote-font-size: $font-size-base * 1.25 !default; -$blockquote-footer-color: $gray-600 !default; -$blockquote-footer-font-size: $small-font-size !default; - -$hr-margin-y: $spacer !default; -$hr-color: inherit !default; -$hr-height: $border-width !default; -$hr-opacity: .25 !default; - -$legend-margin-bottom: .5rem !default; -$legend-font-size: 1.5rem !default; -$legend-font-weight: null !default; - -$mark-padding: .2em !default; - -$dt-font-weight: $font-weight-bold !default; - -$nested-kbd-font-weight: $font-weight-bold !default; - -$list-inline-padding: .5rem !default; - -$mark-bg: #fcf8e3 !default; -// scss-docs-end type-variables - - -// Tables -// -// Customizes the `.table` component with basic values, each used across all table variations. - -// scss-docs-start table-variables -$table-cell-padding-y: .5rem !default; -$table-cell-padding-x: .5rem !default; -$table-cell-padding-y-sm: .25rem !default; -$table-cell-padding-x-sm: .25rem !default; - -$table-cell-vertical-align: top !default; - -$table-color: $body-color !default; -$table-bg: transparent !default; - -$table-th-font-weight: null !default; - -$table-striped-color: $table-color !default; -$table-striped-bg-factor: .10 !default; -$table-striped-bg: rgba($black, $table-striped-bg-factor) !default; - -$table-active-color: $table-color !default; -$table-active-bg-factor: .15 !default; -$table-active-bg: rgba($black, $table-active-bg-factor) !default; - -$table-hover-color: $table-color !default; -$table-hover-bg-factor: .125 !default; -$table-hover-bg: rgba($black, $table-hover-bg-factor) !default; - -$table-border-factor: .15 !default; -$table-border-width: $border-width !default; -$table-border-color: $border-color !default; - -$table-striped-order: odd !default; - -$table-group-separator-color: currentColor !default; - -$table-caption-color: $text-muted !default; - -$table-bg-scale: -80% !default; -// scss-docs-end table-variables - -// scss-docs-start table-loop -$table-variants: ( - "primary": shift-color($primary, $table-bg-scale), - "secondary": shift-color($secondary, $table-bg-scale), - "success": shift-color($success, $table-bg-scale), - "info": shift-color($info, $table-bg-scale), - "warning": shift-color($warning, $table-bg-scale), - "danger": shift-color($danger, $table-bg-scale), - "light": $light, - "dark": $dark, -) !default; -// scss-docs-end table-loop - - -// Buttons + Forms -// -// Shared variables that are reassigned to `$input-` and `$btn-` specific variables. - -// scss-docs-start input-btn-variables -$input-btn-padding-y: .375rem !default; -$input-btn-padding-x: .75rem !default; -$input-btn-font-family: null !default; -$input-btn-font-size: $font-size-base !default; -$input-btn-line-height: $line-height-base !default; - -$input-btn-focus-width: .25rem !default; -$input-btn-focus-color-opacity: .25 !default; -$input-btn-focus-color: rgba($component-active-bg, $input-btn-focus-color-opacity) !default; -$input-btn-focus-blur: 0 !default; -$input-btn-focus-box-shadow: 0 0 $input-btn-focus-blur $input-btn-focus-width $input-btn-focus-color !default; - -$input-btn-padding-y-sm: .25rem !default; -$input-btn-padding-x-sm: .5rem !default; -$input-btn-font-size-sm: $font-size-sm !default; - -$input-btn-padding-y-lg: .5rem !default; -$input-btn-padding-x-lg: 1rem !default; -$input-btn-font-size-lg: $font-size-lg !default; - -$input-btn-border-width: $border-width !default; -// scss-docs-end input-btn-variables - - -// Buttons -// -// For each of Bootstrap's buttons, define text, background, and border color. - -// scss-docs-start btn-variables -$btn-padding-y: $input-btn-padding-y !default; -$btn-padding-x: $input-btn-padding-x !default; -$btn-font-family: $input-btn-font-family !default; -$btn-font-size: $input-btn-font-size !default; -$btn-line-height: $input-btn-line-height !default; -$btn-white-space: null !default; // Set to `nowrap` to prevent text wrapping - -$btn-padding-y-sm: $input-btn-padding-y-sm !default; -$btn-padding-x-sm: $input-btn-padding-x-sm !default; -$btn-font-size-sm: $input-btn-font-size-sm !default; - -$btn-padding-y-lg: $input-btn-padding-y-lg !default; -$btn-padding-x-lg: $input-btn-padding-x-lg !default; -$btn-font-size-lg: $input-btn-font-size-lg !default; - -$btn-border-width: $input-btn-border-width !default; - -$btn-font-weight: $font-weight-normal !default; -$btn-box-shadow: inset 0 1px 0 rgba($white, .15), 0 1px 1px rgba($black, .075) !default; -$btn-focus-width: $input-btn-focus-width !default; -$btn-focus-box-shadow: $input-btn-focus-box-shadow !default; -$btn-disabled-opacity: .65 !default; -$btn-active-box-shadow: inset 0 3px 5px rgba($black, .125) !default; - -$btn-link-color: $link-color !default; -$btn-link-hover-color: $link-hover-color !default; -$btn-link-disabled-color: $gray-600 !default; - -// Allows for customizing button radius independently from global border radius -$btn-border-radius: 0 !default; // $border-radius !default; (only disabled for button) -$btn-border-radius-sm: 0 !default; // $border-radius-sm !default; -$btn-border-radius-lg: 0 !default; // $border-radius-lg !default; - -$btn-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; - -$btn-hover-bg-shade-amount: 15% !default; -$btn-hover-bg-tint-amount: 15% !default; -$btn-hover-border-shade-amount: 20% !default; -$btn-hover-border-tint-amount: 10% !default; -$btn-active-bg-shade-amount: 20% !default; -$btn-active-bg-tint-amount: 20% !default; -$btn-active-border-shade-amount: 25% !default; -$btn-active-border-tint-amount: 10% !default; -// scss-docs-end btn-variables - - -// Forms - -// scss-docs-start form-text-variables -$form-text-margin-top: .25rem !default; -$form-text-font-size: $small-font-size !default; -$form-text-font-style: null !default; -$form-text-font-weight: null !default; -$form-text-color: $text-muted !default; -// scss-docs-end form-text-variables - -// scss-docs-start form-label-variables -$form-label-margin-bottom: .5rem !default; -$form-label-font-size: null !default; -$form-label-font-style: null !default; -$form-label-font-weight: null !default; -$form-label-color: null !default; -// scss-docs-end form-label-variables - -// scss-docs-start form-input-variables -$input-padding-y: $input-btn-padding-y !default; -$input-padding-x: $input-btn-padding-x !default; -$input-font-family: $input-btn-font-family !default; -$input-font-size: $input-btn-font-size !default; -$input-font-weight: $font-weight-base !default; -$input-line-height: $input-btn-line-height !default; - -$input-padding-y-sm: $input-btn-padding-y-sm !default; -$input-padding-x-sm: $input-btn-padding-x-sm !default; -$input-font-size-sm: $input-btn-font-size-sm !default; - -$input-padding-y-lg: $input-btn-padding-y-lg !default; -$input-padding-x-lg: $input-btn-padding-x-lg !default; -$input-font-size-lg: $input-btn-font-size-lg !default; - -$input-bg: $white !default; -$input-disabled-bg: $gray-200 !default; -$input-disabled-border-color: null !default; - -$input-color: $body-color !default; -$input-border-color: $gray-400 !default; -$input-border-width: $input-btn-border-width !default; -$input-box-shadow: $box-shadow-inset !default; - -$input-border-radius: $border-radius !default; -$input-border-radius-sm: $border-radius-sm !default; -$input-border-radius-lg: $border-radius-lg !default; - -$input-focus-bg: $input-bg !default; -$input-focus-border-color: tint-color($component-active-bg, 50%) !default; -$input-focus-color: $input-color !default; -$input-focus-width: $input-btn-focus-width !default; -$input-focus-box-shadow: $input-btn-focus-box-shadow !default; - -$input-placeholder-color: $gray-600 !default; -$input-plaintext-color: $body-color !default; - -$input-height-border: $input-border-width * 2 !default; - -$input-height-inner: add($input-line-height * 1em, $input-padding-y * 2) !default; -$input-height-inner-half: add($input-line-height * .5em, $input-padding-y) !default; -$input-height-inner-quarter: add($input-line-height * .25em, $input-padding-y / 2) !default; - -$input-height: add($input-line-height * 1em, add($input-padding-y * 2, $input-height-border, false)) !default; -$input-height-sm: add($input-line-height * 1em, add($input-padding-y-sm * 2, $input-height-border, false)) !default; -$input-height-lg: add($input-line-height * 1em, add($input-padding-y-lg * 2, $input-height-border, false)) !default; - -$input-transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; -// scss-docs-end form-input-variables - -// scss-docs-start form-check-variables -$form-check-input-width: 1em !default; -$form-check-min-height: $font-size-base * $line-height-base !default; -$form-check-padding-start: $form-check-input-width + .5em !default; -$form-check-margin-bottom: .125rem !default; -$form-check-label-color: null !default; -$form-check-label-cursor: null !default; -$form-check-transition: null !default; - -$form-check-input-active-filter: brightness(90%) !default; - -$form-check-input-bg: $input-bg !default; -$form-check-input-border: 1px solid rgba($black, .25) !default; -$form-check-input-border-radius: .25em !default; -$form-check-radio-border-radius: 50% !default; -$form-check-input-focus-border: $input-focus-border-color !default; -$form-check-input-focus-box-shadow: $input-btn-focus-box-shadow !default; - -$form-check-input-checked-color: $component-active-color !default; -$form-check-input-checked-bg-color: $component-active-bg !default; -$form-check-input-checked-border-color: $form-check-input-checked-bg-color !default; -$form-check-input-checked-bg-image: url("data:image/svg+xml,") !default; -$form-check-radio-checked-bg-image: url("data:image/svg+xml,") !default; - -$form-check-input-indeterminate-color: $component-active-color !default; -$form-check-input-indeterminate-bg-color: $component-active-bg !default; -$form-check-input-indeterminate-border-color: $form-check-input-indeterminate-bg-color !default; -$form-check-input-indeterminate-bg-image: url("data:image/svg+xml,") !default; - -$form-check-input-disabled-opacity: .5 !default; -$form-check-label-disabled-opacity: $form-check-input-disabled-opacity !default; -$form-check-btn-check-disabled-opacity: $btn-disabled-opacity !default; - -$form-check-inline-margin-end: 1rem !default; -// scss-docs-end form-check-variables - -// scss-docs-start form-switch-variables -$form-switch-color: rgba(0, 0, 0, .25) !default; -$form-switch-width: 2em !default; -$form-switch-padding-start: $form-switch-width + .5em !default; -$form-switch-bg-image: url("data:image/svg+xml,") !default; -$form-switch-border-radius: $form-switch-width !default; -$form-switch-transition: background-position .15s ease-in-out !default; - -$form-switch-focus-color: $input-focus-border-color !default; -$form-switch-focus-bg-image: url("data:image/svg+xml,") !default; - -$form-switch-checked-color: $component-active-color !default; -$form-switch-checked-bg-image: url("data:image/svg+xml,") !default; -$form-switch-checked-bg-position: right center !default; -// scss-docs-end form-switch-variables - -// scss-docs-start input-group-variables -$input-group-addon-padding-y: $input-padding-y !default; -$input-group-addon-padding-x: $input-padding-x !default; -$input-group-addon-font-weight: $input-font-weight !default; -$input-group-addon-color: $input-color !default; -$input-group-addon-bg: $gray-200 !default; -$input-group-addon-border-color: $input-border-color !default; -// scss-docs-end input-group-variables - -// scss-docs-start form-select-variables -$form-select-padding-y: $input-padding-y !default; -$form-select-padding-x: $input-padding-x !default; -$form-select-font-family: $input-font-family !default; -$form-select-font-size: $input-font-size !default; -$form-select-indicator-padding: $form-select-padding-x * 3 !default; // Extra padding for background-image -$form-select-font-weight: $input-font-weight !default; -$form-select-line-height: $input-line-height !default; -$form-select-color: $input-color !default; -$form-select-bg: $input-bg !default; -$form-select-disabled-color: null !default; -$form-select-disabled-bg: $gray-200 !default; -$form-select-disabled-border-color: $input-disabled-border-color !default; -$form-select-bg-position: right $form-select-padding-x center !default; -$form-select-bg-size: 16px 12px !default; // In pixels because image dimensions -$form-select-indicator-color: $gray-800 !default; -$form-select-indicator: url("data:image/svg+xml,") !default; - -$form-select-feedback-icon-padding-end: $form-select-padding-x * 2.5 + $form-select-indicator-padding !default; -$form-select-feedback-icon-position: center right $form-select-indicator-padding !default; -$form-select-feedback-icon-size: $input-height-inner-half $input-height-inner-half !default; - -$form-select-border-width: $input-border-width !default; -$form-select-border-color: $input-border-color !default; -$form-select-border-radius: $border-radius !default; -$form-select-box-shadow: $box-shadow-inset !default; - -$form-select-focus-border-color: $input-focus-border-color !default; -$form-select-focus-width: $input-focus-width !default; -$form-select-focus-box-shadow: 0 0 0 $form-select-focus-width $input-btn-focus-color !default; - -$form-select-padding-y-sm: $input-padding-y-sm !default; -$form-select-padding-x-sm: $input-padding-x-sm !default; -$form-select-font-size-sm: $input-font-size-sm !default; - -$form-select-padding-y-lg: $input-padding-y-lg !default; -$form-select-padding-x-lg: $input-padding-x-lg !default; -$form-select-font-size-lg: $input-font-size-lg !default; -// scss-docs-end form-select-variables - -// scss-docs-start form-range-variables -$form-range-track-width: 100% !default; -$form-range-track-height: .5rem !default; -$form-range-track-cursor: pointer !default; -$form-range-track-bg: $gray-300 !default; -$form-range-track-border-radius: 1rem !default; -$form-range-track-box-shadow: $box-shadow-inset !default; - -$form-range-thumb-width: 1rem !default; -$form-range-thumb-height: $form-range-thumb-width !default; -$form-range-thumb-bg: $component-active-bg !default; -$form-range-thumb-border: 0 !default; -$form-range-thumb-border-radius: 1rem !default; -$form-range-thumb-box-shadow: 0 .1rem .25rem rgba($black, .1) !default; -$form-range-thumb-focus-box-shadow: 0 0 0 1px $body-bg, $input-focus-box-shadow !default; -$form-range-thumb-focus-box-shadow-width: $input-focus-width !default; // For focus box shadow issue in Edge -$form-range-thumb-active-bg: tint-color($component-active-bg, 70%) !default; -$form-range-thumb-disabled-bg: $gray-500 !default; -$form-range-thumb-transition: background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; -// scss-docs-end form-range-variables - -// scss-docs-start form-file-variables -$form-file-button-color: $input-color !default; -$form-file-button-bg: $input-group-addon-bg !default; -$form-file-button-hover-bg: shade-color($form-file-button-bg, 5%) !default; -// scss-docs-end form-file-variables - -// scss-docs-start form-floating-variables -$form-floating-height: add(3.5rem, $input-height-border) !default; -$form-floating-padding-x: $input-padding-x !default; -$form-floating-padding-y: 1rem !default; -$form-floating-input-padding-t: 1.625rem !default; -$form-floating-input-padding-b: .625rem !default; -$form-floating-label-opacity: .65 !default; -$form-floating-label-transform: scale(.85) translateY(-.5rem) translateX(.15rem) !default; -$form-floating-transition: opacity .1s ease-in-out, transform .1s ease-in-out !default; -// scss-docs-end form-floating-variables - -// Form validation - -// scss-docs-start form-feedback-variables -$form-feedback-margin-top: $form-text-margin-top !default; -$form-feedback-font-size: $form-text-font-size !default; -$form-feedback-font-style: $form-text-font-style !default; -$form-feedback-valid-color: $success !default; -$form-feedback-invalid-color: $danger !default; - -$form-feedback-icon-valid-color: $form-feedback-valid-color !default; -$form-feedback-icon-valid: url("data:image/svg+xml,") !default; -$form-feedback-icon-invalid-color: $form-feedback-invalid-color !default; -$form-feedback-icon-invalid: url("data:image/svg+xml,") !default; -// scss-docs-end form-feedback-variables - -// scss-docs-start form-validation-states -$form-validation-states: ( - "valid": ( - "color": $form-feedback-valid-color, - "icon": $form-feedback-icon-valid - ), - "invalid": ( - "color": $form-feedback-invalid-color, - "icon": $form-feedback-icon-invalid - ) -) !default; -// scss-docs-end form-validation-states - -// Z-index master list -// -// Warning: Avoid customizing these values. They're used for a bird's eye view -// of components dependent on the z-axis and are designed to all work together. - -// scss-docs-start zindex-stack -$zindex-dropdown: 1000 !default; -$zindex-sticky: 1020 !default; -$zindex-fixed: 1030 !default; -$zindex-modal-backdrop: 1040 !default; -$zindex-offcanvas: 1050 !default; -$zindex-modal: 1060 !default; -$zindex-popover: 1070 !default; -$zindex-tooltip: 1080 !default; -// scss-docs-end zindex-stack - - -// Navs - -// scss-docs-start nav-variables -$nav-link-padding-y: .5rem !default; -$nav-link-padding-x: 1rem !default; -$nav-link-font-size: null !default; -$nav-link-font-weight: null !default; -$nav-link-color: $link-color !default; -$nav-link-hover-color: $link-hover-color !default; -$nav-link-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out !default; -$nav-link-disabled-color: $gray-600 !default; - -$nav-tabs-border-color: $gray-300 !default; -$nav-tabs-border-width: $border-width !default; -$nav-tabs-border-radius: $border-radius !default; -$nav-tabs-link-hover-border-color: $gray-200 $gray-200 $nav-tabs-border-color !default; -$nav-tabs-link-active-color: $gray-700 !default; -$nav-tabs-link-active-bg: $body-bg !default; -$nav-tabs-link-active-border-color: $gray-300 $gray-300 $nav-tabs-link-active-bg !default; - -$nav-pills-border-radius: $border-radius !default; -$nav-pills-link-active-color: $component-active-color !default; -$nav-pills-link-active-bg: $component-active-bg !default; -// scss-docs-end nav-variables - - -// Navbar - -// scss-docs-start navbar-variables -$navbar-padding-y: $spacer / 2 !default; -$navbar-padding-x: null !default; - -$navbar-nav-link-padding-x: .5rem !default; - -$navbar-brand-font-size: $font-size-lg !default; -// Compute the navbar-brand padding-y so the navbar-brand will have the same height as navbar-text and nav-link -$nav-link-height: $font-size-base * $line-height-base + $nav-link-padding-y * 2 !default; -$navbar-brand-height: $navbar-brand-font-size * $line-height-base !default; -$navbar-brand-padding-y: ($nav-link-height - $navbar-brand-height) / 2 !default; -$navbar-brand-margin-end: 1rem !default; - -$navbar-toggler-padding-y: .25rem !default; -$navbar-toggler-padding-x: .75rem !default; -$navbar-toggler-font-size: $font-size-lg !default; -$navbar-toggler-border-radius: $btn-border-radius !default; -$navbar-toggler-focus-width: $btn-focus-width !default; -$navbar-toggler-transition: box-shadow .15s ease-in-out !default; -// scss-docs-end navbar-variables - -// scss-docs-start navbar-theme-variables -$navbar-dark-color: rgba($white, .55) !default; -$navbar-dark-hover-color: rgba($white, .75) !default; -$navbar-dark-active-color: $white !default; -$navbar-dark-disabled-color: rgba($white, .25) !default; -$navbar-dark-toggler-icon-bg: url("data:image/svg+xml,") !default; -$navbar-dark-toggler-border-color: rgba($white, .1) !default; - -$navbar-light-color: rgba($black, .55) !default; -$navbar-light-hover-color: rgba($black, .7) !default; -$navbar-light-active-color: rgba($black, .9) !default; -$navbar-light-disabled-color: rgba($black, .3) !default; -$navbar-light-toggler-icon-bg: url("data:image/svg+xml,") !default; -$navbar-light-toggler-border-color: rgba($black, .1) !default; - -$navbar-light-brand-color: $navbar-light-active-color !default; -$navbar-light-brand-hover-color: $navbar-light-active-color !default; -$navbar-dark-brand-color: $navbar-dark-active-color !default; -$navbar-dark-brand-hover-color: $navbar-dark-active-color !default; -// scss-docs-end navbar-theme-variables - - -// Dropdowns -// -// Dropdown menu container and contents. - -// scss-docs-start dropdown-variables -$dropdown-min-width: 10rem !default; -$dropdown-padding-x: 0 !default; -$dropdown-padding-y: .5rem !default; -$dropdown-spacer: .125rem !default; -$dropdown-font-size: $font-size-base !default; -$dropdown-color: $body-color !default; -$dropdown-bg: $white !default; -$dropdown-border-color: rgba($black, .15) !default; -$dropdown-border-radius: $border-radius !default; -$dropdown-border-width: $border-width !default; -$dropdown-inner-border-radius: subtract($dropdown-border-radius, $dropdown-border-width) !default; -$dropdown-divider-bg: $dropdown-border-color !default; -$dropdown-divider-margin-y: $spacer / 2 !default; -$dropdown-box-shadow: $box-shadow !default; - -$dropdown-link-color: $gray-900 !default; -$dropdown-link-hover-color: shade-color($gray-900, 10%) !default; -$dropdown-link-hover-bg: $gray-200 !default; - -$dropdown-link-active-color: $component-active-color !default; -$dropdown-link-active-bg: $component-active-bg !default; - -$dropdown-link-disabled-color: $gray-500 !default; - -$dropdown-item-padding-y: $spacer / 4 !default; -$dropdown-item-padding-x: $spacer !default; - -$dropdown-header-color: $gray-600 !default; -$dropdown-header-padding: $dropdown-padding-y $dropdown-item-padding-x !default; -// scss-docs-end dropdown-variables - -// scss-docs-start dropdown-dark-variables -$dropdown-dark-color: $gray-300 !default; -$dropdown-dark-bg: $gray-800 !default; -$dropdown-dark-border-color: $dropdown-border-color !default; -$dropdown-dark-divider-bg: $dropdown-divider-bg !default; -$dropdown-dark-box-shadow: null !default; -$dropdown-dark-link-color: $dropdown-dark-color !default; -$dropdown-dark-link-hover-color: $white !default; -$dropdown-dark-link-hover-bg: rgba($white, .15) !default; -$dropdown-dark-link-active-color: $dropdown-link-active-color !default; -$dropdown-dark-link-active-bg: $dropdown-link-active-bg !default; -$dropdown-dark-link-disabled-color: $gray-500 !default; -$dropdown-dark-header-color: $gray-500 !default; -// scss-docs-end dropdown-dark-variables - - -// Pagination - -// scss-docs-start pagination-variables -$pagination-padding-y: .375rem !default; -$pagination-padding-x: .75rem !default; -$pagination-padding-y-sm: .25rem !default; -$pagination-padding-x-sm: .5rem !default; -$pagination-padding-y-lg: .75rem !default; -$pagination-padding-x-lg: 1.5rem !default; - -$pagination-color: $link-color !default; -$pagination-bg: $white !default; -$pagination-border-width: $border-width !default; -$pagination-border-radius: $border-radius !default; -$pagination-margin-start: -$pagination-border-width !default; -$pagination-border-color: $gray-300 !default; - -$pagination-focus-color: $link-hover-color !default; -$pagination-focus-bg: $gray-200 !default; -$pagination-focus-box-shadow: $input-btn-focus-box-shadow !default; -$pagination-focus-outline: 0 !default; - -$pagination-hover-color: $link-hover-color !default; -$pagination-hover-bg: $gray-200 !default; -$pagination-hover-border-color: $gray-300 !default; - -$pagination-active-color: $component-active-color !default; -$pagination-active-bg: $component-active-bg !default; -$pagination-active-border-color: $pagination-active-bg !default; - -$pagination-disabled-color: $gray-600 !default; -$pagination-disabled-bg: $white !default; -$pagination-disabled-border-color: $gray-300 !default; - -$pagination-transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out !default; - -$pagination-border-radius-sm: $border-radius-sm !default; -$pagination-border-radius-lg: $border-radius-lg !default; -// scss-docs-end pagination-variables - - -// Cards - -// scss-docs-start card-variables -$card-spacer-y: $spacer !default; -$card-spacer-x: $spacer !default; -$card-title-spacer-y: $spacer / 2 !default; -$card-border-width: $border-width !default; -$card-border-radius: $border-radius !default; -$card-border-color: rgba($black, .125) !default; -$card-inner-border-radius: subtract($card-border-radius, $card-border-width) !default; -$card-cap-padding-y: $card-spacer-y / 2 !default; -$card-cap-padding-x: $card-spacer-x !default; -$card-cap-bg: rgba($black, .03) !default; -$card-cap-color: null !default; -$card-height: null !default; -$card-color: null !default; -$card-bg: $white !default; -$card-img-overlay-padding: $spacer !default; -$card-group-margin: $grid-gutter-width / 2 !default; -// scss-docs-end card-variables - -// Accordion - -// scss-docs-start accordion-variables -$accordion-padding-y: 1rem !default; -$accordion-padding-x: 1.25rem !default; -$accordion-color: $body-color !default; -$accordion-bg: $body-bg !default; -$accordion-border-width: $border-width !default; -$accordion-border-color: rgba($black, .125) !default; -$accordion-border-radius: $border-radius !default; -$accordion-inner-border-radius: subtract($accordion-border-radius, $accordion-border-width) !default; - -$accordion-body-padding-y: $accordion-padding-y !default; -$accordion-body-padding-x: $accordion-padding-x !default; - -$accordion-button-padding-y: $accordion-padding-y !default; -$accordion-button-padding-x: $accordion-padding-x !default; -$accordion-button-color: $accordion-color !default; -$accordion-button-bg: $accordion-bg !default; -$accordion-transition: $btn-transition, border-radius .15s ease !default; -$accordion-button-active-bg: tint-color($component-active-bg, 90%) !default; -$accordion-button-active-color: shade-color($primary, 10%) !default; - -$accordion-button-focus-border-color: $input-focus-border-color !default; -$accordion-button-focus-box-shadow: $btn-focus-box-shadow !default; - -$accordion-icon-width: 1.25rem !default; -$accordion-icon-color: $accordion-color !default; -$accordion-icon-active-color: $accordion-button-active-color !default; -$accordion-icon-transition: transform .2s ease-in-out !default; -$accordion-icon-transform: rotate(-180deg) !default; - -$accordion-button-icon: url("data:image/svg+xml,") !default; -$accordion-button-active-icon: url("data:image/svg+xml,") !default; -// scss-docs-end accordion-variables - -// Tooltips - -// scss-docs-start tooltip-variables -$tooltip-font-size: $font-size-sm !default; -$tooltip-max-width: 200px !default; -$tooltip-color: $white !default; -$tooltip-bg: $black !default; -$tooltip-border-radius: $border-radius !default; -$tooltip-opacity: .9 !default; -$tooltip-padding-y: $spacer / 4 !default; -$tooltip-padding-x: $spacer / 2 !default; -$tooltip-margin: 0 !default; - -$tooltip-arrow-width: .8rem !default; -$tooltip-arrow-height: .4rem !default; -$tooltip-arrow-color: $tooltip-bg !default; -// scss-docs-end tooltip-variables - -// Form tooltips must come after regular tooltips -// scss-docs-start tooltip-feedback-variables -$form-feedback-tooltip-padding-y: $tooltip-padding-y !default; -$form-feedback-tooltip-padding-x: $tooltip-padding-x !default; -$form-feedback-tooltip-font-size: $tooltip-font-size !default; -$form-feedback-tooltip-line-height: null !default; -$form-feedback-tooltip-opacity: $tooltip-opacity !default; -$form-feedback-tooltip-border-radius: $tooltip-border-radius !default; -// scss-docs-start tooltip-feedback-variables - - -// Popovers - -// scss-docs-start popover-variables -$popover-font-size: $font-size-sm !default; -$popover-bg: $white !default; -$popover-max-width: 276px !default; -$popover-border-width: $border-width !default; -$popover-border-color: rgba($black, .2) !default; -$popover-border-radius: $border-radius-lg !default; -$popover-inner-border-radius: subtract($popover-border-radius, $popover-border-width) !default; -$popover-box-shadow: $box-shadow !default; - -$popover-header-bg: shade-color($popover-bg, 6%) !default; -$popover-header-color: $headings-color !default; -$popover-header-padding-y: .5rem !default; -$popover-header-padding-x: $spacer !default; - -$popover-body-color: $body-color !default; -$popover-body-padding-y: $spacer !default; -$popover-body-padding-x: $spacer !default; - -$popover-arrow-width: 1rem !default; -$popover-arrow-height: .5rem !default; -$popover-arrow-color: $popover-bg !default; - -$popover-arrow-outer-color: fade-in($popover-border-color, .05) !default; -// scss-docs-end popover-variables - - -// Toasts - -// scss-docs-start toast-variables -$toast-max-width: 350px !default; -$toast-padding-x: .75rem !default; -$toast-padding-y: .5rem !default; -$toast-font-size: .875rem !default; -$toast-color: null !default; -$toast-background-color: rgba($white, .85) !default; -$toast-border-width: 1px !default; -$toast-border-color: rgba(0, 0, 0, .1) !default; -$toast-border-radius: $border-radius !default; -$toast-box-shadow: $box-shadow !default; -$toast-spacing: $container-padding-x !default; - -$toast-header-color: $gray-600 !default; -$toast-header-background-color: rgba($white, .85) !default; -$toast-header-border-color: rgba(0, 0, 0, .05) !default; -// scss-docs-end toast-variables - - -// Badges - -// scss-docs-start badge-variables -$badge-font-size: .75em !default; -$badge-font-weight: $font-weight-bold !default; -$badge-color: $white !default; -$badge-padding-y: .35em !default; -$badge-padding-x: .65em !default; -$badge-border-radius: $border-radius !default; -// scss-docs-end badge-variables - - -// Modals - -// scss-docs-start modal-variables -$modal-inner-padding: $spacer !default; - -$modal-footer-margin-between: .5rem !default; - -$modal-dialog-margin: .5rem !default; -$modal-dialog-margin-y-sm-up: 1.75rem !default; - -$modal-title-line-height: $line-height-base !default; - -$modal-content-color: null !default; -$modal-content-bg: $white !default; -$modal-content-border-color: rgba($black, .2) !default; -$modal-content-border-width: $border-width !default; -$modal-content-border-radius: $border-radius-lg !default; -$modal-content-inner-border-radius: subtract($modal-content-border-radius, $modal-content-border-width) !default; -$modal-content-box-shadow-xs: $box-shadow-sm !default; -$modal-content-box-shadow-sm-up: $box-shadow !default; - -$modal-backdrop-bg: $black !default; -$modal-backdrop-opacity: .5 !default; -$modal-header-border-color: $border-color !default; -$modal-footer-border-color: $modal-header-border-color !default; -$modal-header-border-width: $modal-content-border-width !default; -$modal-footer-border-width: $modal-header-border-width !default; -$modal-header-padding-y: $modal-inner-padding !default; -$modal-header-padding-x: $modal-inner-padding !default; -$modal-header-padding: $modal-header-padding-y $modal-header-padding-x !default; // Keep this for backwards compatibility - -$modal-sm: 300px !default; -$modal-md: 500px !default; -$modal-lg: 800px !default; -$modal-xl: 1140px !default; - -$modal-fade-transform: translate(0, -50px) !default; -$modal-show-transform: none !default; -$modal-transition: transform .3s ease-out !default; -$modal-scale-transform: scale(1.02) !default; -// scss-docs-end modal-variables - - -// Alerts -// -// Define alert colors, border radius, and padding. - -// scss-docs-start alert-variables -$alert-padding-y: $spacer !default; -$alert-padding-x: $spacer !default; -$alert-margin-bottom: 1rem !default; -$alert-border-radius: 0 !default; //$border-radius !default; -$alert-link-font-weight: $font-weight-bold !default; -$alert-border-width: 0 !default; //$border-width !default; -$alert-bg-scale: -80% !default; -$alert-border-scale: -70% !default; -$alert-color-scale: 40% !default; -$alert-dismissible-padding-r: $alert-padding-x * 3 !default; // 3x covers width of x plus default padding on either side -// scss-docs-end alert-variables - - -// Progress bars - -// scss-docs-start progress-variables -$progress-height: 1rem !default; -$progress-font-size: $font-size-base * .75 !default; -$progress-bg: $gray-200 !default; -$progress-border-radius: $border-radius !default; -$progress-box-shadow: $box-shadow-inset !default; -$progress-bar-color: $white !default; -$progress-bar-bg: $primary !default; -$progress-bar-animation-timing: 1s linear infinite !default; -$progress-bar-transition: width .6s ease !default; -// scss-docs-end progress-variables - - -// List group - -// scss-docs-start list-group-variables -$list-group-color: $gray-900 !default; -$list-group-bg: $white !default; -$list-group-border-color: rgba($black, .125) !default; -$list-group-border-width: $border-width !default; -$list-group-border-radius: $border-radius !default; - -$list-group-item-padding-y: $spacer / 2 !default; -$list-group-item-padding-x: $spacer !default; -$list-group-item-bg-scale: -80% !default; -$list-group-item-color-scale: 40% !default; - -$list-group-hover-bg: $gray-100 !default; -$list-group-active-color: $component-active-color !default; -$list-group-active-bg: $component-active-bg !default; -$list-group-active-border-color: $list-group-active-bg !default; - -$list-group-disabled-color: $gray-600 !default; -$list-group-disabled-bg: $list-group-bg !default; - -$list-group-action-color: $gray-700 !default; -$list-group-action-hover-color: $list-group-action-color !default; - -$list-group-action-active-color: $body-color !default; -$list-group-action-active-bg: $gray-200 !default; -// scss-docs-end list-group-variables - - -// Image thumbnails - -// scss-docs-start thumbnail-variables -$thumbnail-padding: .25rem !default; -$thumbnail-bg: $body-bg !default; -$thumbnail-border-width: $border-width !default; -$thumbnail-border-color: $gray-300 !default; -$thumbnail-border-radius: $border-radius !default; -$thumbnail-box-shadow: $box-shadow-sm !default; -// scss-docs-end thumbnail-variables - - -// Figures - -// scss-docs-start figure-variables -$figure-caption-font-size: $small-font-size !default; -$figure-caption-color: $gray-600 !default; -// scss-docs-end figure-variables - - -// Breadcrumbs - -// scss-docs-start breadcrumb-variables -$breadcrumb-font-size: null !default; -$breadcrumb-padding-y: 0 !default; -$breadcrumb-padding-x: 0 !default; -$breadcrumb-item-padding-x: .5rem !default; -$breadcrumb-margin-bottom: 1rem !default; -$breadcrumb-bg: null !default; -$breadcrumb-divider-color: $gray-600 !default; -$breadcrumb-active-color: $gray-600 !default; -$breadcrumb-divider: quote("/") !default; -$breadcrumb-divider-flipped: $breadcrumb-divider !default; -$breadcrumb-border-radius: null !default; -// scss-docs-end breadcrumb-variables - -// Carousel - -// scss-docs-start carousel-variables -$carousel-control-color: $white !default; -$carousel-control-width: 15% !default; -$carousel-control-opacity: .5 !default; -$carousel-control-hover-opacity: .9 !default; -$carousel-control-transition: opacity .15s ease !default; - -$carousel-indicator-width: 30px !default; -$carousel-indicator-height: 3px !default; -$carousel-indicator-hit-area-height: 10px !default; -$carousel-indicator-spacer: 3px !default; -$carousel-indicator-opacity: .5 !default; -$carousel-indicator-active-bg: $white !default; -$carousel-indicator-active-opacity: 1 !default; -$carousel-indicator-transition: opacity .6s ease !default; - -$carousel-caption-width: 70% !default; -$carousel-caption-color: $white !default; -$carousel-caption-padding-y: 1.25rem !default; -$carousel-caption-spacer: 1.25rem !default; - -$carousel-control-icon-width: 2rem !default; - -$carousel-control-prev-icon-bg: url("data:image/svg+xml,") !default; -$carousel-control-next-icon-bg: url("data:image/svg+xml,") !default; - -$carousel-transition-duration: .6s !default; -$carousel-transition: transform $carousel-transition-duration ease-in-out !default; // Define transform transition first if using multiple transitions (e.g., `transform 2s ease, opacity .5s ease-out`) - -$carousel-dark-indicator-active-bg: $black !default; -$carousel-dark-caption-color: $black !default; -$carousel-dark-control-icon-filter: invert(1) grayscale(100) !default; -// scss-docs-end carousel-variables - - -// Spinners - -// scss-docs-start spinner-variables -$spinner-width: 2rem !default; -$spinner-height: $spinner-width !default; -$spinner-vertical-align: -.125em !default; -$spinner-border-width: .25em !default; -$spinner-animation-speed: .75s !default; - -$spinner-width-sm: 1rem !default; -$spinner-height-sm: $spinner-width-sm !default; -$spinner-border-width-sm: .2em !default; -// scss-docs-end spinner-variables - - -// Close - -// scss-docs-start close-variables -$btn-close-width: 1em !default; -$btn-close-height: $btn-close-width !default; -$btn-close-padding-x: .25em !default; -$btn-close-padding-y: $btn-close-padding-x !default; -$btn-close-color: $black !default; -$btn-close-bg: url("data:image/svg+xml,") !default; -$btn-close-focus-shadow: $input-btn-focus-box-shadow !default; -$btn-close-opacity: .5 !default; -$btn-close-hover-opacity: .75 !default; -$btn-close-focus-opacity: 1 !default; -$btn-close-disabled-opacity: .25 !default; -$btn-close-white-filter: invert(1) grayscale(100%) brightness(200%) !default; -// scss-docs-end close-variables - - -// Offcanvas - -// scss-docs-start offcanvas-variables -$offcanvas-padding-y: $modal-inner-padding !default; -$offcanvas-padding-x: $modal-inner-padding !default; -$offcanvas-horizontal-width: 400px !default; -$offcanvas-vertical-height: 30vh !default; -$offcanvas-transition-duration: .3s !default; -$offcanvas-border-color: $modal-content-border-color !default; -$offcanvas-border-width: $modal-content-border-width !default; -$offcanvas-title-line-height: $modal-title-line-height !default; -$offcanvas-bg-color: $modal-content-bg !default; -$offcanvas-color: $modal-content-color !default; -$offcanvas-box-shadow: $modal-content-box-shadow-xs !default; -// scss-docs-end offcanvas-variables - -// Code - -$code-font-size: $small-font-size !default; -$code-color: $pink !default; - -$kbd-padding-y: .2rem !default; -$kbd-padding-x: .4rem !default; -$kbd-font-size: $code-font-size !default; -$kbd-color: $white !default; -$kbd-bg: $gray-900 !default; - -$pre-color: null !default; +$alert-border-radius: 0; //$border-radius !default; +$alert-border-width: 0; //$border-width !default; \ No newline at end of file From 5744a68f5fb955729cfd9bf2af141d71515ea963 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 22 Jul 2022 14:13:16 +0200 Subject: [PATCH 041/191] issue 605: remove old scratch sass framework --- .../public/module/scratch/_custom.scss | 190 ---- .../module/scratch/config/_buttons.scss | 7 - .../public/module/scratch/config/_colors.scss | 64 -- .../module/scratch/config/_variables.scss | 115 --- .../bourbon/_bourbon-deprecated-upcoming.scss | 411 --------- .../scratch/contrib/bourbon/_bourbon.scss | 87 -- .../contrib/bourbon/addons/_border-color.scss | 26 - .../bourbon/addons/_border-radius.scss | 48 - .../contrib/bourbon/addons/_border-style.scss | 25 - .../contrib/bourbon/addons/_border-width.scss | 25 - .../contrib/bourbon/addons/_buttons.scss | 64 -- .../contrib/bourbon/addons/_clearfix.scss | 25 - .../contrib/bourbon/addons/_ellipsis.scss | 30 - .../contrib/bourbon/addons/_font-stacks.scss | 31 - .../contrib/bourbon/addons/_hide-text.scss | 27 - .../contrib/bourbon/addons/_margin.scss | 26 - .../contrib/bourbon/addons/_padding.scss | 26 - .../contrib/bourbon/addons/_position.scss | 48 - .../contrib/bourbon/addons/_prefixer.scss | 66 -- .../contrib/bourbon/addons/_retina-image.scss | 25 - .../scratch/contrib/bourbon/addons/_size.scss | 51 -- .../contrib/bourbon/addons/_text-inputs.scss | 113 --- .../bourbon/addons/_timing-functions.scss | 34 - .../contrib/bourbon/addons/_triangle.scss | 63 -- .../contrib/bourbon/addons/_word-wrap.scss | 29 - .../contrib/bourbon/css3/_animation.scss | 43 - .../contrib/bourbon/css3/_appearance.scss | 3 - .../bourbon/css3/_backface-visibility.scss | 3 - .../bourbon/css3/_background-image.scss | 42 - .../contrib/bourbon/css3/_background.scss | 55 -- .../contrib/bourbon/css3/_border-image.scss | 59 -- .../scratch/contrib/bourbon/css3/_calc.scss | 4 - .../contrib/bourbon/css3/_columns.scss | 47 - .../scratch/contrib/bourbon/css3/_filter.scss | 4 - .../contrib/bourbon/css3/_flex-box.scss | 287 ------ .../contrib/bourbon/css3/_font-face.scss | 24 - .../bourbon/css3/_font-feature-settings.scss | 4 - .../bourbon/css3/_hidpi-media-query.scss | 10 - .../contrib/bourbon/css3/_hyphens.scss | 4 - .../bourbon/css3/_image-rendering.scss | 14 - .../contrib/bourbon/css3/_keyframes.scss | 36 - .../bourbon/css3/_linear-gradient.scss | 38 - .../contrib/bourbon/css3/_perspective.scss | 8 - .../contrib/bourbon/css3/_placeholder.scss | 8 - .../bourbon/css3/_radial-gradient.scss | 39 - .../contrib/bourbon/css3/_selection.scss | 42 - .../bourbon/css3/_text-decoration.scss | 19 - .../contrib/bourbon/css3/_transform.scss | 15 - .../contrib/bourbon/css3/_transition.scss | 71 -- .../contrib/bourbon/css3/_user-select.scss | 3 - .../bourbon/functions/_assign-inputs.scss | 11 - .../bourbon/functions/_contains-falsy.scss | 20 - .../contrib/bourbon/functions/_contains.scss | 26 - .../contrib/bourbon/functions/_is-length.scss | 11 - .../contrib/bourbon/functions/_is-light.scss | 21 - .../contrib/bourbon/functions/_is-number.scss | 11 - .../contrib/bourbon/functions/_is-size.scss | 13 - .../bourbon/functions/_modular-scale.scss | 69 -- .../contrib/bourbon/functions/_px-to-em.scss | 13 - .../contrib/bourbon/functions/_px-to-rem.scss | 15 - .../contrib/bourbon/functions/_shade.scss | 24 - .../bourbon/functions/_strip-units.scss | 17 - .../contrib/bourbon/functions/_tint.scss | 24 - .../functions/_transition-property-name.scss | 22 - .../contrib/bourbon/functions/_unpack.scss | 27 - .../bourbon/helpers/_convert-units.scss | 21 - .../bourbon/helpers/_directional-values.scss | 96 -- .../helpers/_font-source-declaration.scss | 43 - .../helpers/_gradient-positions-parser.scss | 13 - .../bourbon/helpers/_linear-angle-parser.scss | 25 - .../helpers/_linear-gradient-parser.scss | 41 - .../helpers/_linear-positions-parser.scss | 61 -- .../helpers/_linear-side-corner-parser.scss | 31 - .../bourbon/helpers/_radial-arg-parser.scss | 69 -- .../helpers/_radial-gradient-parser.scss | 50 -- .../helpers/_radial-positions-parser.scss | 18 - .../bourbon/helpers/_render-gradients.scss | 26 - .../bourbon/helpers/_shape-size-stripper.scss | 10 - .../contrib/bourbon/helpers/_str-to-num.scss | 50 -- .../bourbon/settings/_asset-pipeline.scss | 7 - .../contrib/bourbon/settings/_prefixer.scss | 9 - .../contrib/bourbon/settings/_px-to-em.scss | 1 - .../contrib/gridle/_grid-settings.scss | 23 - .../contrib/gridle/grid-bootstrap.scss | 48 - .../module/scratch/contrib/gridle/grid.scss | 24 - .../contrib/gridle/gridle/_common-mixins.scss | 124 --- .../gridle/gridle/_default-states.scss | 35 - .../contrib/gridle/gridle/_functions.scss | 387 -------- .../gridle/gridle/_generate-mixins.scss | 624 ------------- .../contrib/gridle/gridle/_gridle.scss | 141 --- .../contrib/gridle/gridle/_mixins.scss | 831 ------------------ .../gridle/gridle/_settings-mixins.scss | 139 --- .../contrib/gridle/gridle/_settings.scss | 69 -- .../gridle/gridle/_silent-classes.scss | 106 --- .../contrib/gridle/style-bootstrap.scss | 11 - .../module/scratch/contrib/gridle/style.scss | 76 -- .../module/scratch/contrib/gridle/tests.scss | 280 ------ .../scratch/contrib/normalize/_normalize.scss | 424 --------- .../module/scratch/custom/_address.scss | 20 - .../public/module/scratch/custom/_box.scss | 24 - .../module/scratch/custom/_custom-fields.scss | 14 - .../scratch/custom/_flash_messages.scss | 14 - .../public/module/scratch/custom/_fonts.scss | 2 - .../module/scratch/custom/_pagination.scss | 32 - .../public/module/scratch/custom/_person.scss | 3 - .../scratch/custom/_record_actions.scss | 58 -- .../public/module/scratch/custom/_report.scss | 3 - .../module/scratch/custom/_timeline.scss | 53 -- .../module/scratch/custom/config/_colors.scss | 65 -- .../scratch/custom/config/_variables.scss | 45 - .../module/scratch/custom/mixins/entity.scss | 16 - .../scratch/custom/modules/_buttons.scss | 175 ---- .../module/scratch/custom/modules/_forms.scss | 28 - .../scratch/custom/modules/_navigation.scss | 88 -- .../scratch/custom/modules/copy-solid.svg | 4 - .../custom/modules/users-slash-solid.svg | 1 - .../Resources/public/module/scratch/index.js | 1 - .../public/module/scratch/mixins/_alerts.scss | 7 - .../module/scratch/mixins/_buttons.scss | 34 - .../module/scratch/modules/_alerts.scss | 15 - .../module/scratch/modules/_buttons.scss | 12 - .../module/scratch/modules/_content.scss | 7 - .../module/scratch/modules/_footer.scss | 65 -- .../public/module/scratch/modules/_forms.scss | 156 ---- .../module/scratch/modules/_navigation.scss | 299 ------- .../public/module/scratch/modules/_table.scss | 33 - .../public/module/scratch/modules/_tabs.scss | 54 -- .../module/scratch/modules/_typography.scss | 23 - .../public/module/scratch/scratch.scss | 46 - 129 files changed, 8172 deletions(-) delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/_custom.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_buttons.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_colors.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_variables.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon-deprecated-upcoming.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-color.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-radius.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-style.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-width.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_buttons.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_clearfix.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_ellipsis.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_font-stacks.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_hide-text.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_margin.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_padding.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_position.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_prefixer.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_retina-image.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_size.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_text-inputs.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_timing-functions.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_triangle.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_word-wrap.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_animation.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_appearance.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_backface-visibility.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background-image.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_border-image.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_calc.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_columns.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_filter.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_flex-box.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_font-face.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_font-feature-settings.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_hidpi-media-query.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_hyphens.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_image-rendering.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_keyframes.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_linear-gradient.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_perspective.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_placeholder.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_radial-gradient.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_selection.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_text-decoration.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transform.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transition.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_user-select.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_assign-inputs.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains-falsy.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-length.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-light.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-number.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-size.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_modular-scale.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-em.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-rem.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_shade.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_strip-units.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_tint.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_transition-property-name.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_unpack.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_convert-units.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_directional-values.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_font-source-declaration.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_gradient-positions-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-angle-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-gradient-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-positions-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-side-corner-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-arg-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-gradient-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-positions-parser.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_render-gradients.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_shape-size-stripper.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_str-to-num.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_asset-pipeline.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_prefixer.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_px-to-em.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/_grid-settings.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid-bootstrap.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_common-mixins.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_default-states.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_functions.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_generate-mixins.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_gridle.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_mixins.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings-mixins.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_silent-classes.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style-bootstrap.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/tests.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/normalize/_normalize.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_address.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_box.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_custom-fields.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_flash_messages.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_fonts.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_pagination.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_person.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_record_actions.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_report.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_timeline.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_colors.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_variables.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/mixins/entity.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_buttons.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_forms.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_navigation.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/copy-solid.svg delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/users-slash-solid.svg delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/index.js delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_alerts.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_buttons.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_alerts.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_buttons.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_content.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_footer.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_forms.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_navigation.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_table.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_tabs.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_typography.scss delete mode 100644 src/Bundle/ChillMainBundle/Resources/public/module/scratch/scratch.scss diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/_custom.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/_custom.scss deleted file mode 100644 index e44fdebcc..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/_custom.scss +++ /dev/null @@ -1,190 +0,0 @@ -/* - * NOTE 2021.04 - * scss/chill.scss is the main sass file for the new chill.2 - * scratch will be replaced by bootstrap, please avoid to edit in modules/scratch/_custom.scss - */ - -// YOUR CUSTOM SCSS -@import 'custom/config/colors'; -@import 'custom/config/variables'; -@import 'custom/fonts'; -@import 'custom/timeline'; -@import 'custom/mixins/entity'; -@import 'custom/report'; -@import 'custom/person'; -@import 'custom/pagination'; -@import 'custom/custom-fields'; -@import 'custom/address'; -@import 'custom/record_actions'; -@import 'custom/flash_messages'; -@import 'custom/box'; - - -html,body { - min-height:100%; - font-family: 'Open Sans'; -} - -header { - position: relative; -} - -#content_conainter { - position: relative; - min-height: calc(100% - 145px); -} - -#content_conainter:before { - bottom: 0; - content: ""; - left: 0; - opacity: 0.1; - position: absolute; - right: 0; - top: 0; - z-index: -1; - //background-image: url('./../../img/background/desert.jpg'); - background-attachment: fixed; - background-repeat: no-repeat; - background-size: cover; - background-position: center; -} - -/* CUSTOM FIELDS -> */ -.cf-title { - font-size: 2em; -} - -.cf-subtitle { - font-size: 1.5em; -} -/* <- CUSTOM FIELDS */ - -@each $len in 11, 15 { - ul.submenu.width-#{$len}-em { - min-width: #{$len}em; - } -} - -.content { - padding-top: 1em; - padding-bottom: 1em; -} - -.select2 { - width: 100%; -} - -ul.custom_fields.choice li { - list-style:none; -} - -.errors { - color: $red; -} - -.footer { - p { - font-family: 'Open Sans'; - font-weight: 300; - } - - a { - color: white; - text-decoration: underline; - } -} - -// inline time input -.time_compound { - input[type=text], select { - width: 4em; - display: inline-block; - text-align: center; - } - - .separator { - margin-left: 0.2em; - margin-right: 0.2em; - } -} - -.open_sansbold { - font-family: 'Open Sans'; - font-weight: bold; - -} - - -dd { - margin-left: 0; -} - -dt { - font-family: 'Open Sans'; - font-weight: 600; -} - - -/* INPUT CLASS -> */ -div.input_with_post_text { - display: flex; - align-items: center; -} - -div.input_with_post_text span.post_text { - flex: 1; - margin-left: 0.5em; -} -div.input_with_post_text input { - width: 70%; - display: inline-block; - flex: 2; -} -/* <- INPUT CLASS */ - -dl.chill_report_view_data, -dl.chill_view_data { - - dt { - margin-top: 1.5em; - color: $chill-blue; - } - - dd { - padding-left: 1.5em; - margin-top: 0.2em; - - ul { - padding-left: 0; - } - } - -} - -blockquote.chill-user-quote, -div.chill-user-quote { - border-left: 10px solid $chill-yellow; - margin: 1.5em 10px; - padding: 0.5em 10px; - quotes: "\201C""\201D""\2018""\2019"; - background-color: $chill-llight-gray; - - blockquote { - margin: 1.5em 10px; - padding: 0.5em 10px; - } - - blockquote:before { - color: #ccc; - content: open-quote; - font-size: 4em; - line-height: 0.1em; - margin-right: 0.25em; - vertical-align: -0.4em; - } -} - -.chill-no-data-statement { - font-style: italic; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_buttons.scss deleted file mode 100644 index 00b61968c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_buttons.scss +++ /dev/null @@ -1,7 +0,0 @@ -// Buttons -$button-font-size : 15px !default; -$button-text-color : #000 !default; -$button-text-weight : 300 !default; -$button-padding : 8px 12px !default; -$button-background : #eee !default; -$button-margin : 5px !default; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_colors.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_colors.scss deleted file mode 100644 index 9c200db0f..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_colors.scss +++ /dev/null @@ -1,64 +0,0 @@ -// BODY -$body-background : #fff !default; - -// PLAIN TEXT -$text-color : #555 !default; - -// HEADINGS -$headings-color : #404040 !default; - -// LINKS -$link-color : #6998C9 !default; -$link-visited-color : #808080 !default; -$link-active-color : shade(red,5%) !default; -$link-hover-color : #007ED5 !default; -$link-focus-color : $link-color !default; - -$white : #fff !default; -$black : #000 !default; -$orange : #FF622C !default; -$red : #C83D3D !default; -$green : #27806f !default; -$blue : #2980b9 !default; -$yellow : #FFC82C !default; - -$light-blue : #4995C7; -$llight-blue : #72B0D9; -$dark-blue : #096EB0 !default; -$ddark-blue : #07507F !default; - -$light-green : #419484 !default; -$llight-green : #6CB3A5 !default; - -$warning-bg : $orange !default; -$caution-bg : $red !default; -$error-bg : $red !default; -$success-bg : $green !default; -$info-bg : $blue !default; - -$grey-95 : lighten($black, 5%) !default; -$grey-90 : lighten($black, 10%) !default; -$grey-85 : lighten($black, 15%) !default; -$grey-80 : lighten($black, 20%) !default; -$grey-75 : lighten($black, 25%) !default; -$grey-70 : lighten($black, 30%) !default; -$grey-65 : lighten($black, 35%) !default; -$grey-60 : lighten($black, 40%) !default; -$grey-55 : lighten($black, 45%) !default; -$grey-50 : lighten($black, 50%) !default; -$grey-45 : lighten($black, 55%) !default; -$grey-40 : lighten($black, 60%) !default; -$grey-35 : lighten($black, 65%) !default; -$grey-30 : lighten($black, 70%) !default; -$grey-25 : lighten($black, 75%) !default; -$grey-20 : lighten($black, 80%) !default; -$grey-15 : lighten($black, 85%) !default; -$grey-10 : lighten($black, 90%) !default; -$grey-5 : lighten($black, 95%) !default; - - -$dark-grey: $grey-80; //#333; -$medium-grey: $grey-50; //#999; -$light-grey: $grey-20; //#DDD; - -@import "../custom/config/colors"; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_variables.scss deleted file mode 100644 index 09840d957..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/config/_variables.scss +++ /dev/null @@ -1,115 +0,0 @@ -// Typography -//$sans-serif: $helvetica; -//$serif: $georgia; -//$base-font-family: $sans-serif; -//$header-font-family: $base-font-family; - -// Font Sizes -$base-font-size: 1em; -$h1-font-size: $base-font-size * 2.25; -$h2-font-size: $base-font-size * 2; -$h3-font-size: $base-font-size * 1.75; -$h4-font-size: $base-font-size * 1.5; -$h5-font-size: $base-font-size * 1.25; -$h6-font-size: $base-font-size; - -// Line height -$base-line-height: 1.5; -$header-line-height: 1.25; - -// Other Sizes -$base-border-radius: 3px; -$base-spacing: $base-line-height * 1em; -$base-z-index: 0; - -// Background Color -$base-background-color: white; - -// Font Colors -$base-font-color: $dark-grey; -$base-accent-color: $blue; - -// Link Colors -$base-link-color: $base-accent-color; -$hover-link-color: darken($base-accent-color, 15); -$base-button-color: $base-link-color; -$hover-button-color: $hover-link-color; - -/* -// Flash Colors -$alert-color: $light-yellow; -$error-color: $light-red; -$notice-color: lighten($base-accent-color, 40); -$success-color: $light-green; -*/ - -// Border color -$base-border-color: $light-grey; -$base-border: 1px solid $base-border-color; - -// Footer -$footer-background: $grey-50;//-blue;// desaturate(darken($base-accent-color, 20), 30); -$footer-color: white; -$footer-link-color: transparentize($footer-color, .6); -$footer-disclaimer-color: transparentize($footer-color, .6); -$footer-vertical-padding: 0; - -// Forms -$form-border-size: 1px; -$form-border-color: $base-border-color; -$form-border-color-hover: darken($base-border-color, 10); -$form-border-color-focus: $base-accent-color; -$form-border-radius: $base-border-radius; -$form-box-shadow: inset 0 1px 3px rgba(black,0.06); -$form-box-shadow-focus: $form-box-shadow, 0 0 5px rgba(darken($form-border-color-focus, 5), 0.7); -$form-font-size: $base-font-size; -//$form-font-family: $base-font-family; - -// Navigation -$navigation-background: $dark-grey; -$navigation-color: transparentize(white, 0.3); -$navigation-color-hover: white; -$navigation-height: 60px; -$navigation-active-link-color: transparentize(white, 0.5); -$navigation-submenu-padding: 1em; -$navigation-submenu-width: 12em; -$navigation-border-radius: $base-border-radius; -$navigation-first-padding-top: 1em; -$navigation-last-padding-bottom: 0.7em; -$navigation-more-pin: '\25BE'; -$navigation-more-pin-color: $navigation-color; -$navigation-ul-submenu-top: 1.5em; -$navigation-ul-submenu-padding-left: 0; -$navigation-search-padding: .85em .6em; -$navigation-border-bottom: 1px solid darken($navigation-background, 10); - -//Table -$table-width: 100%; - -$table-head-bg-color: $orange; -$table-head-td-border: unset; -$table-head-td-text-align: center; -$table-head-td-padding: 0.3em; -$table-head-text-color: $white; - -$table-body-tr-bg-color-even: $grey-5; -$table-body-tr-bg-color-odd: unset; -$table-body-td-border: unset; -$table-body-td-text-align: left; -$table-body-td-padding: 0.3em; -$table-body-text-color: unset; - -//Tabs -$tabs-nav-margin-bottom: none; -$tabs-nav-title-bg-color: $blue; -$tabs-nav-title-text-color: $white; -$tabs-nav-title-padding: 0.5em 0.5em 0.5em 1em; -$tabs-nav-bg-color: none; -$tabs-nav-text-color: inherit; -$tabs-new-border: 3px solid transparent; -$tabs-nav-hover-border: 3px solid $orange; -$tabs-nav-hover-text-color: inherit; -$tabs-nav-font-family: unset; -$tabs-nav-padding: 0.5em 0.5em 0.5em 1.5em; - -@import "../custom/config/variables"; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon-deprecated-upcoming.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon-deprecated-upcoming.scss deleted file mode 100644 index e6d1b8cec..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon-deprecated-upcoming.scss +++ /dev/null @@ -1,411 +0,0 @@ -// The following features have been deprecated and will be removed in the next MAJOR version release - -@mixin inline-block { - display: inline-block; - - @warn "The inline-block mixin is deprecated and will be removed in the next major version release"; -} - -@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) { - - @if type-of($style) == string and type-of($base-color) == color { - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - @if type-of($style) == string and type-of($base-color) == number { - $padding: $text-size; - $text-size: $base-color; - $base-color: #4294f0; - - @if $padding == inherit { - $padding: 7px 18px; - } - - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - @if type-of($style) == color and type-of($base-color) == color { - $base-color: $style; - $style: simple; - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - @if type-of($style) == color and type-of($base-color) == number { - $padding: $text-size; - $text-size: $base-color; - $base-color: $style; - $style: simple; - - @if $padding == inherit { - $padding: 7px 18px; - } - - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - @if type-of($style) == number { - $padding: $base-color; - $text-size: $style; - $base-color: #4294f0; - $style: simple; - - @if $padding == #4294f0 { - $padding: 7px 18px; - } - - @include buttonstyle($style, $base-color, $text-size, $padding); - } - - &:disabled { - cursor: not-allowed; - opacity: 0.5; - } - - @warn "The button mixin is deprecated and will be removed in the next major version release"; -} - -// Selector Style Button -@mixin buttonstyle($type, $b-color, $t-size, $pad) { - // Grayscale button - @if $type == simple and $b-color == grayscale($b-color) { - @include simple($b-color, true, $t-size, $pad); - } - - @if $type == shiny and $b-color == grayscale($b-color) { - @include shiny($b-color, true, $t-size, $pad); - } - - @if $type == pill and $b-color == grayscale($b-color) { - @include pill($b-color, true, $t-size, $pad); - } - - @if $type == flat and $b-color == grayscale($b-color) { - @include flat($b-color, true, $t-size, $pad); - } - - // Colored button - @if $type == simple { - @include simple($b-color, false, $t-size, $pad); - } - - @else if $type == shiny { - @include shiny($b-color, false, $t-size, $pad); - } - - @else if $type == pill { - @include pill($b-color, false, $t-size, $pad); - } - - @else if $type == flat { - @include flat($b-color, false, $t-size, $pad); - } -} - -// Simple Button -@mixin simple($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { - $color: hsl(0, 0, 100%); - $border: adjust-color($base-color, $saturation: 9%, $lightness: -14%); - $inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%); - $stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%); - $text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%); - - @if is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border: grayscale($border); - $inset-shadow: grayscale($inset-shadow); - $stop-gradient: grayscale($stop-gradient); - $text-shadow: grayscale($text-shadow); - } - - border: 1px solid $border; - border-radius: 3px; - box-shadow: inset 0 1px 0 0 $inset-shadow; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: bold; - @include linear-gradient ($base-color, $stop-gradient); - padding: $padding; - text-decoration: none; - text-shadow: 0 1px 0 $text-shadow; - background-clip: padding-box; - - &:hover:not(:disabled) { - $base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%); - $inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%); - $stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%); - - @if $grayscale == true { - $base-color-hover: grayscale($base-color-hover); - $inset-shadow-hover: grayscale($inset-shadow-hover); - $stop-gradient-hover: grayscale($stop-gradient-hover); - } - - @include linear-gradient ($base-color-hover, $stop-gradient-hover); - - box-shadow: inset 0 1px 0 0 $inset-shadow-hover; - cursor: pointer; - } - - &:active:not(:disabled), - &:focus:not(:disabled) { - $border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%); - $inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%); - - @if $grayscale == true { - $border-active: grayscale($border-active); - $inset-shadow-active: grayscale($inset-shadow-active); - } - - border: 1px solid $border-active; - box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active; - } -} - -// Shiny Button -@mixin shiny($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { - $color: hsl(0, 0, 100%); - $border: adjust-color($base-color, $red: -117, $green: -111, $blue: -81); - $border-bottom: adjust-color($base-color, $red: -126, $green: -127, $blue: -122); - $fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46); - $inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12); - $second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33); - $text-shadow: adjust-color($base-color, $red: -140, $green: -141, $blue: -114); - $third-stop: adjust-color($base-color, $red: -86, $green: -75, $blue: -48); - - @if is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border: grayscale($border); - $border-bottom: grayscale($border-bottom); - $fourth-stop: grayscale($fourth-stop); - $inset-shadow: grayscale($inset-shadow); - $second-stop: grayscale($second-stop); - $text-shadow: grayscale($text-shadow); - $third-stop: grayscale($third-stop); - } - - @include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%); - - border: 1px solid $border; - border-bottom: 1px solid $border-bottom; - border-radius: 5px; - box-shadow: inset 0 1px 0 0 $inset-shadow; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: bold; - padding: $padding; - text-align: center; - text-decoration: none; - text-shadow: 0 -1px 1px $text-shadow; - - &:hover:not(:disabled) { - $first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18); - $second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51); - $third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66); - $fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63); - - @if $grayscale == true { - $first-stop-hover: grayscale($first-stop-hover); - $second-stop-hover: grayscale($second-stop-hover); - $third-stop-hover: grayscale($third-stop-hover); - $fourth-stop-hover: grayscale($fourth-stop-hover); - } - - @include linear-gradient(top, $first-stop-hover 0%, - $second-stop-hover 50%, - $third-stop-hover 50%, - $fourth-stop-hover 100%); - cursor: pointer; - } - - &:active:not(:disabled), - &:focus:not(:disabled) { - $inset-shadow-active: adjust-color($base-color, $red: -111, $green: -116, $blue: -122); - - @if $grayscale == true { - $inset-shadow-active: grayscale($inset-shadow-active); - } - - box-shadow: inset 0 0 20px 0 $inset-shadow-active; - } -} - -// Pill Button -@mixin pill($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { - $color: hsl(0, 0, 100%); - $border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%); - $border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%); - $border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%); - $inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 7%); - $stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%); - $text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%); - - @if is-light($base-color) { - $color: hsl(0, 0, 20%); - $text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%); - } - - @if $grayscale == true { - $border-bottom: grayscale($border-bottom); - $border-sides: grayscale($border-sides); - $border-top: grayscale($border-top); - $inset-shadow: grayscale($inset-shadow); - $stop-gradient: grayscale($stop-gradient); - $text-shadow: grayscale($text-shadow); - } - - border: 1px solid $border-top; - border-color: $border-top $border-sides $border-bottom; - border-radius: 16px; - box-shadow: inset 0 1px 0 0 $inset-shadow; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: normal; - line-height: 1; - @include linear-gradient ($base-color, $stop-gradient); - padding: $padding; - text-align: center; - text-decoration: none; - text-shadow: 0 -1px 1px $text-shadow; - background-clip: padding-box; - - &:hover:not(:disabled) { - $base-color-hover: adjust-color($base-color, $lightness: -4.5%); - $border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%); - $border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%); - $border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%); - $inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%); - $stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%); - $text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%); - - @if $grayscale == true { - $base-color-hover: grayscale($base-color-hover); - $border-bottom: grayscale($border-bottom); - $border-sides: grayscale($border-sides); - $border-top: grayscale($border-top); - $inset-shadow-hover: grayscale($inset-shadow-hover); - $stop-gradient-hover: grayscale($stop-gradient-hover); - $text-shadow-hover: grayscale($text-shadow-hover); - } - - @include linear-gradient ($base-color-hover, $stop-gradient-hover); - - background-clip: padding-box; - border: 1px solid $border-top; - border-color: $border-top $border-sides $border-bottom; - box-shadow: inset 0 1px 0 0 $inset-shadow-hover; - cursor: pointer; - text-shadow: 0 -1px 1px $text-shadow-hover; - } - - &:active:not(:disabled), - &:focus:not(:disabled) { - $active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%); - $border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%); - $border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%); - $inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%); - $text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%); - - @if $grayscale == true { - $active-color: grayscale($active-color); - $border-active: grayscale($border-active); - $border-bottom-active: grayscale($border-bottom-active); - $inset-shadow-active: grayscale($inset-shadow-active); - $text-shadow-active: grayscale($text-shadow-active); - } - - background: $active-color; - border: 1px solid $border-active; - border-bottom: 1px solid $border-bottom-active; - box-shadow: inset 0 0 6px 3px $inset-shadow-active; - text-shadow: 0 -1px 1px $text-shadow-active; - } -} - -// Flat Button -@mixin flat($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) { - $color: hsl(0, 0, 100%); - - @if is-light($base-color) { - $color: hsl(0, 0, 20%); - } - - background-color: $base-color; - border-radius: 3px; - border: 0; - color: $color; - display: inline-block; - font-size: $textsize; - font-weight: bold; - padding: $padding; - text-decoration: none; - background-clip: padding-box; - - &:hover:not(:disabled){ - $base-color-hover: adjust-color($base-color, $saturation: 4%, $lightness: 5%); - - @if $grayscale == true { - $base-color-hover: grayscale($base-color-hover); - } - - background-color: $base-color-hover; - cursor: pointer; - } - - &:active:not(:disabled), - &:focus:not(:disabled) { - $base-color-active: adjust-color($base-color, $saturation: -4%, $lightness: -5%); - - @if $grayscale == true { - $base-color-active: grayscale($base-color-active); - } - - background-color: $base-color-active; - cursor: pointer; - } -} - -// Flexible grid -@function flex-grid($columns, $container-columns: $fg-max-columns) { - $width: $columns * $fg-column + ($columns - 1) * $fg-gutter; - $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; - @return percentage($width / $container-width); - - @warn "The flex-grid function is deprecated and will be removed in the next major version release"; -} - -// Flexible gutter -@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) { - $container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter; - @return percentage($gutter / $container-width); - - @warn "The flex-gutter function is deprecated and will be removed in the next major version release"; -} - -@function grid-width($n) { - @return $n * $gw-column + ($n - 1) * $gw-gutter; - - @warn "The grid-width function is deprecated and will be removed in the next major version release"; -} - -@function golden-ratio($value, $increment) { - @return modular-scale($increment, $value, $ratio: $golden); - - @warn "The golden-ratio function is deprecated and will be removed in the next major version release. Please use the modular-scale function, instead."; -} - -@mixin box-sizing($box) { - @include prefixer(box-sizing, $box, webkit moz spec); - - @warn "The box-sizing mixin is deprecated and will be removed in the next major version release. This property can now be used un-prefixed."; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon.scss deleted file mode 100644 index 509fcc10e..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/_bourbon.scss +++ /dev/null @@ -1,87 +0,0 @@ -// Bourbon 4.2.6 -// http://bourbon.io -// Copyright 2011-2015 thoughtbot, inc. -// MIT License - -@import "settings/prefixer"; -@import "settings/px-to-em"; -@import "settings/asset-pipeline"; - -@import "functions/assign-inputs"; -@import "functions/contains"; -@import "functions/contains-falsy"; -@import "functions/is-length"; -@import "functions/is-light"; -@import "functions/is-number"; -@import "functions/is-size"; -@import "functions/px-to-em"; -@import "functions/px-to-rem"; -@import "functions/shade"; -@import "functions/strip-units"; -@import "functions/tint"; -@import "functions/transition-property-name"; -@import "functions/unpack"; -@import "functions/modular-scale"; - -@import "helpers/convert-units"; -@import "helpers/directional-values"; -@import "helpers/font-source-declaration"; -@import "helpers/gradient-positions-parser"; -@import "helpers/linear-angle-parser"; -@import "helpers/linear-gradient-parser"; -@import "helpers/linear-positions-parser"; -@import "helpers/linear-side-corner-parser"; -@import "helpers/radial-arg-parser"; -@import "helpers/radial-positions-parser"; -@import "helpers/radial-gradient-parser"; -@import "helpers/render-gradients"; -@import "helpers/shape-size-stripper"; -@import "helpers/str-to-num"; - -@import "css3/animation"; -@import "css3/appearance"; -@import "css3/backface-visibility"; -@import "css3/background"; -@import "css3/background-image"; -@import "css3/border-image"; -@import "css3/calc"; -@import "css3/columns"; -@import "css3/filter"; -@import "css3/flex-box"; -@import "css3/font-face"; -@import "css3/font-feature-settings"; -@import "css3/hidpi-media-query"; -@import "css3/hyphens"; -@import "css3/image-rendering"; -@import "css3/keyframes"; -@import "css3/linear-gradient"; -@import "css3/perspective"; -@import "css3/placeholder"; -@import "css3/radial-gradient"; -@import "css3/selection"; -@import "css3/text-decoration"; -@import "css3/transform"; -@import "css3/transition"; -@import "css3/user-select"; - -@import "addons/border-color"; -@import "addons/border-radius"; -@import "addons/border-style"; -@import "addons/border-width"; -@import "addons/buttons"; -@import "addons/clearfix"; -@import "addons/ellipsis"; -@import "addons/font-stacks"; -@import "addons/hide-text"; -@import "addons/margin"; -@import "addons/padding"; -@import "addons/position"; -@import "addons/prefixer"; -@import "addons/retina-image"; -@import "addons/size"; -@import "addons/text-inputs"; -@import "addons/timing-functions"; -@import "addons/triangle"; -@import "addons/word-wrap"; - -@import "bourbon-deprecated-upcoming"; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-color.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-color.scss deleted file mode 100644 index 6f6ab36c4..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-color.scss +++ /dev/null @@ -1,26 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `border-color` on specific sides of a box. Use a `null` value to “skip” a side. -/// -/// @param {Arglist} $vals -/// List of arguments -/// -/// @example scss - Usage -/// .element { -/// @include border-color(#a60b55 #76cd9c null #e8ae1a); -/// } -/// -/// @example css - CSS Output -/// .element { -/// border-left-color: #e8ae1a; -/// border-right-color: #76cd9c; -/// border-top-color: #a60b55; -/// } -/// -/// @require {mixin} directional-property -/// -/// @output `border-color` - -@mixin border-color($vals...) { - @include directional-property(border, color, $vals...); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-radius.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-radius.scss deleted file mode 100644 index 1f6586335..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-radius.scss +++ /dev/null @@ -1,48 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `border-radius` on both corners on the side of a box. -/// -/// @param {Number} $radii -/// List of arguments -/// -/// @example scss - Usage -/// .element-one { -/// @include border-top-radius(5px); -/// } -/// -/// .element-two { -/// @include border-left-radius(3px); -/// } -/// -/// @example css - CSS Output -/// .element-one { -/// border-top-left-radius: 5px; -/// border-top-right-radius: 5px; -/// } -/// -/// .element-two { -/// border-bottom-left-radius: 3px; -/// border-top-left-radius: 3px; -/// } -/// -/// @output `border-radius` - -@mixin border-top-radius($radii) { - border-top-left-radius: $radii; - border-top-right-radius: $radii; -} - -@mixin border-right-radius($radii) { - border-bottom-right-radius: $radii; - border-top-right-radius: $radii; -} - -@mixin border-bottom-radius($radii) { - border-bottom-left-radius: $radii; - border-bottom-right-radius: $radii; -} - -@mixin border-left-radius($radii) { - border-bottom-left-radius: $radii; - border-top-left-radius: $radii; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-style.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-style.scss deleted file mode 100644 index d86ee79d9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-style.scss +++ /dev/null @@ -1,25 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `border-style` on specific sides of a box. Use a `null` value to “skip” a side. -/// -/// @param {Arglist} $vals -/// List of arguments -/// -/// @example scss - Usage -/// .element { -/// @include border-style(dashed null solid); -/// } -/// -/// @example css - CSS Output -/// .element { -/// border-bottom-style: solid; -/// border-top-style: dashed; -/// } -/// -/// @require {mixin} directional-property -/// -/// @output `border-style` - -@mixin border-style($vals...) { - @include directional-property(border, style, $vals...); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-width.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-width.scss deleted file mode 100644 index 0ea2d4b71..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_border-width.scss +++ /dev/null @@ -1,25 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `border-width` on specific sides of a box. Use a `null` value to “skip” a side. -/// -/// @param {Arglist} $vals -/// List of arguments -/// -/// @example scss - Usage -/// .element { -/// @include border-width(1em null 20px); -/// } -/// -/// @example css - CSS Output -/// .element { -/// border-bottom-width: 20px; -/// border-top-width: 1em; -/// } -/// -/// @require {mixin} directional-property -/// -/// @output `border-width` - -@mixin border-width($vals...) { - @include directional-property(border, width, $vals...); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_buttons.scss deleted file mode 100644 index debeabc53..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_buttons.scss +++ /dev/null @@ -1,64 +0,0 @@ -@charset "UTF-8"; - -/// Generates variables for all buttons. Please note that you must use interpolation on the variable: `#{$all-buttons}`. -/// -/// @example scss - Usage -/// #{$all-buttons} { -/// background-color: #f00; -/// } -/// -/// #{$all-buttons-focus}, -/// #{$all-buttons-hover} { -/// background-color: #0f0; -/// } -/// -/// #{$all-buttons-active} { -/// background-color: #00f; -/// } -/// -/// @example css - CSS Output -/// button, -/// input[type="button"], -/// input[type="reset"], -/// input[type="submit"] { -/// background-color: #f00; -/// } -/// -/// button:focus, -/// input[type="button"]:focus, -/// input[type="reset"]:focus, -/// input[type="submit"]:focus, -/// button:hover, -/// input[type="button"]:hover, -/// input[type="reset"]:hover, -/// input[type="submit"]:hover { -/// background-color: #0f0; -/// } -/// -/// button:active, -/// input[type="button"]:active, -/// input[type="reset"]:active, -/// input[type="submit"]:active { -/// background-color: #00f; -/// } -/// -/// @require assign-inputs -/// -/// @type List -/// -/// @todo Remove double assigned variables (Lines 59–62) in v5.0.0 - -$buttons-list: 'button', - 'input[type="button"]', - 'input[type="reset"]', - 'input[type="submit"]'; - -$all-buttons: assign-inputs($buttons-list); -$all-buttons-active: assign-inputs($buttons-list, active); -$all-buttons-focus: assign-inputs($buttons-list, focus); -$all-buttons-hover: assign-inputs($buttons-list, hover); - -$all-button-inputs: $all-buttons; -$all-button-inputs-active: $all-buttons-active; -$all-button-inputs-focus: $all-buttons-focus; -$all-button-inputs-hover: $all-buttons-hover; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_clearfix.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_clearfix.scss deleted file mode 100644 index 11313d66f..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_clearfix.scss +++ /dev/null @@ -1,25 +0,0 @@ -@charset "UTF-8"; - -/// Provides an easy way to include a clearfix for containing floats. -/// -/// @link http://cssmojo.com/latest_new_clearfix_so_far/ -/// -/// @example scss - Usage -/// .element { -/// @include clearfix; -/// } -/// -/// @example css - CSS Output -/// .element::after { -/// clear: both; -/// content: ""; -/// display: table; -/// } - -@mixin clearfix { - &::after { - clear: both; - content: ""; - display: table; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_ellipsis.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_ellipsis.scss deleted file mode 100644 index a367f651c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_ellipsis.scss +++ /dev/null @@ -1,30 +0,0 @@ -@charset "UTF-8"; - -/// Truncates text and adds an ellipsis to represent overflow. -/// -/// @param {Number} $width [100%] -/// Max-width for the string to respect before being truncated -/// -/// @example scss - Usage -/// .element { -/// @include ellipsis; -/// } -/// -/// @example css - CSS Output -/// .element { -/// display: inline-block; -/// max-width: 100%; -/// overflow: hidden; -/// text-overflow: ellipsis; -/// white-space: nowrap; -/// word-wrap: normal; -/// } - -@mixin ellipsis($width: 100%) { - display: inline-block; - max-width: $width; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - word-wrap: normal; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_font-stacks.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_font-stacks.scss deleted file mode 100644 index 57128f422..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_font-stacks.scss +++ /dev/null @@ -1,31 +0,0 @@ -@charset "UTF-8"; - -/// Georgia font stack. -/// -/// @type List - -$georgia: "Georgia", "Cambria", "Times New Roman", "Times", serif; - -/// Helvetica font stack. -/// -/// @type List - -$helvetica: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif; - -/// Lucida Grande font stack. -/// -/// @type List - -$lucida-grande: "Lucida Grande", "Tahoma", "Verdana", "Arial", sans-serif; - -/// Monospace font stack. -/// -/// @type List - -$monospace: "Bitstream Vera Sans Mono", "Consolas", "Courier", monospace; - -/// Verdana font stack. -/// -/// @type List - -$verdana: "Verdana", "Geneva", sans-serif; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_hide-text.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_hide-text.scss deleted file mode 100644 index 4caf20ed5..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_hide-text.scss +++ /dev/null @@ -1,27 +0,0 @@ -/// Hides the text in an element, commonly used to show an image. Some elements will need block-level styles applied. -/// -/// @link http://zeldman.com/2012/03/01/replacing-the-9999px-hack-new-image-replacement -/// -/// @example scss - Usage -/// .element { -/// @include hide-text; -/// } -/// -/// @example css - CSS Output -/// .element { -/// overflow: hidden; -/// text-indent: 101%; -/// white-space: nowrap; -/// } -/// -/// @todo Remove height argument in v5.0.0 - -@mixin hide-text($height: null) { - overflow: hidden; - text-indent: 101%; - white-space: nowrap; - - @if $height { - @warn "The `hide-text` mixin has changed and no longer requires a height. The height argument will no longer be accepted in v5.0.0"; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_margin.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_margin.scss deleted file mode 100644 index 674f4e5f6..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_margin.scss +++ /dev/null @@ -1,26 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `margin` on specific sides of a box. Use a `null` value to “skip” a side. -/// -/// @param {Arglist} $vals -/// List of arguments -/// -/// @example scss - Usage -/// .element { -/// @include margin(null 10px 3em 20vh); -/// } -/// -/// @example css - CSS Output -/// .element { -/// margin-bottom: 3em; -/// margin-left: 20vh; -/// margin-right: 10px; -/// } -/// -/// @require {mixin} directional-property -/// -/// @output `margin` - -@mixin margin($vals...) { - @include directional-property(margin, false, $vals...); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_padding.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_padding.scss deleted file mode 100644 index 40a5f006b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_padding.scss +++ /dev/null @@ -1,26 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for targeting `padding` on specific sides of a box. Use a `null` value to “skip” a side. -/// -/// @param {Arglist} $vals -/// List of arguments -/// -/// @example scss - Usage -/// .element { -/// @include padding(12vh null 10px 5%); -/// } -/// -/// @example css - CSS Output -/// .element { -/// padding-bottom: 10px; -/// padding-left: 5%; -/// padding-top: 12vh; -/// } -/// -/// @require {mixin} directional-property -/// -/// @output `padding` - -@mixin padding($vals...) { - @include directional-property(padding, false, $vals...); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_position.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_position.scss deleted file mode 100644 index e460f3ffd..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_position.scss +++ /dev/null @@ -1,48 +0,0 @@ -@charset "UTF-8"; - -/// Provides a quick method for setting an element’s position. Use a `null` value to “skip” a side. -/// -/// @param {Position} $position [relative] -/// A CSS position value -/// -/// @param {Arglist} $coordinates [null null null null] -/// List of values that correspond to the 4-value syntax for the edges of a box -/// -/// @example scss - Usage -/// .element { -/// @include position(absolute, 0 null null 10em); -/// } -/// -/// @example css - CSS Output -/// .element { -/// left: 10em; -/// position: absolute; -/// top: 0; -/// } -/// -/// @require {function} is-length -/// @require {function} unpack - -@mixin position($position: relative, $coordinates: null null null null) { - @if type-of($position) == list { - $coordinates: $position; - $position: relative; - } - - $coordinates: unpack($coordinates); - - $offsets: ( - top: nth($coordinates, 1), - right: nth($coordinates, 2), - bottom: nth($coordinates, 3), - left: nth($coordinates, 4) - ); - - position: $position; - - @each $offset, $value in $offsets { - @if is-length($value) { - #{$offset}: $value; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_prefixer.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_prefixer.scss deleted file mode 100644 index 2b6f73138..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_prefixer.scss +++ /dev/null @@ -1,66 +0,0 @@ -@charset "UTF-8"; - -/// A mixin for generating vendor prefixes on non-standardized properties. -/// -/// @param {String} $property -/// Property to prefix -/// -/// @param {*} $value -/// Value to use -/// -/// @param {List} $prefixes -/// Prefixes to define -/// -/// @example scss - Usage -/// .element { -/// @include prefixer(border-radius, 10px, webkit ms spec); -/// } -/// -/// @example css - CSS Output -/// .element { -/// -webkit-border-radius: 10px; -/// -moz-border-radius: 10px; -/// border-radius: 10px; -/// } -/// -/// @require {variable} $prefix-for-webkit -/// @require {variable} $prefix-for-mozilla -/// @require {variable} $prefix-for-microsoft -/// @require {variable} $prefix-for-opera -/// @require {variable} $prefix-for-spec - -@mixin prefixer($property, $value, $prefixes) { - @each $prefix in $prefixes { - @if $prefix == webkit { - @if $prefix-for-webkit { - -webkit-#{$property}: $value; - } - } @else if $prefix == moz { - @if $prefix-for-mozilla { - -moz-#{$property}: $value; - } - } @else if $prefix == ms { - @if $prefix-for-microsoft { - -ms-#{$property}: $value; - } - } @else if $prefix == o { - @if $prefix-for-opera { - -o-#{$property}: $value; - } - } @else if $prefix == spec { - @if $prefix-for-spec { - #{$property}: $value; - } - } @else { - @warn "Unrecognized prefix: #{$prefix}"; - } - } -} - -@mixin disable-prefix-for-all() { - $prefix-for-webkit: false !global; - $prefix-for-mozilla: false !global; - $prefix-for-microsoft: false !global; - $prefix-for-opera: false !global; - $prefix-for-spec: false !global; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_retina-image.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_retina-image.scss deleted file mode 100644 index 7febbd751..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_retina-image.scss +++ /dev/null @@ -1,25 +0,0 @@ -@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) { - @if $asset-pipeline { - background-image: image-url("#{$filename}.#{$extension}"); - } @else { - background-image: url("#{$filename}.#{$extension}"); - } - - @include hidpi { - @if $asset-pipeline { - @if $retina-filename { - background-image: image-url("#{$retina-filename}.#{$extension}"); - } @else { - background-image: image-url("#{$filename}#{$retina-suffix}.#{$extension}"); - } - } @else { - @if $retina-filename { - background-image: url("#{$retina-filename}.#{$extension}"); - } @else { - background-image: url("#{$filename}#{$retina-suffix}.#{$extension}"); - } - } - - background-size: $background-size; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_size.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_size.scss deleted file mode 100644 index a2992a34c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_size.scss +++ /dev/null @@ -1,51 +0,0 @@ -@charset "UTF-8"; - -/// Sets the `width` and `height` of the element. -/// -/// @param {List} $size -/// A list of at most 2 size values. -/// -/// If there is only a single value in `$size` it is used for both width and height. All units are supported. -/// -/// @example scss - Usage -/// .first-element { -/// @include size(2em); -/// } -/// -/// .second-element { -/// @include size(auto 10em); -/// } -/// -/// @example css - CSS Output -/// .first-element { -/// width: 2em; -/// height: 2em; -/// } -/// -/// .second-element { -/// width: auto; -/// height: 10em; -/// } -/// -/// @todo Refactor in 5.0.0 to use a comma-separated argument - -@mixin size($value) { - $width: nth($value, 1); - $height: $width; - - @if length($value) > 1 { - $height: nth($value, 2); - } - - @if is-size($height) { - height: $height; - } @else { - @warn "`#{$height}` is not a valid length for the `$height` parameter in the `size` mixin."; - } - - @if is-size($width) { - width: $width; - } @else { - @warn "`#{$width}` is not a valid length for the `$width` parameter in the `size` mixin."; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_text-inputs.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_text-inputs.scss deleted file mode 100644 index 1eb7a5451..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_text-inputs.scss +++ /dev/null @@ -1,113 +0,0 @@ -@charset "UTF-8"; - -/// Generates variables for all text-based inputs. Please note that you must use interpolation on the variable: `#{$all-text-inputs}`. -/// -/// @example scss - Usage -/// #{$all-text-inputs} { -/// border: 1px solid #f00; -/// } -/// -/// #{$all-text-inputs-focus}, -/// #{$all-text-inputs-hover} { -/// border: 1px solid #0f0; -/// } -/// -/// #{$all-text-inputs-active} { -/// border: 1px solid #00f; -/// } -/// -/// @example css - CSS Output -/// input[type="color"], -/// input[type="date"], -/// input[type="datetime"], -/// input[type="datetime-local"], -/// input[type="email"], -/// input[type="month"], -/// input[type="number"], -/// input[type="password"], -/// input[type="search"], -/// input[type="tel"], -/// input[type="text"], -/// input[type="time"], -/// input[type="url"], -/// input[type="week"], -/// textarea { -/// border: 1px solid #f00; -/// } -/// -/// input[type="color"]:focus, -/// input[type="date"]:focus, -/// input[type="datetime"]:focus, -/// input[type="datetime-local"]:focus, -/// input[type="email"]:focus, -/// input[type="month"]:focus, -/// input[type="number"]:focus, -/// input[type="password"]:focus, -/// input[type="search"]:focus, -/// input[type="tel"]:focus, -/// input[type="text"]:focus, -/// input[type="time"]:focus, -/// input[type="url"]:focus, -/// input[type="week"]:focus, -/// textarea:focus, -/// input[type="color"]:hover, -/// input[type="date"]:hover, -/// input[type="datetime"]:hover, -/// input[type="datetime-local"]:hover, -/// input[type="email"]:hover, -/// input[type="month"]:hover, -/// input[type="number"]:hover, -/// input[type="password"]:hover, -/// input[type="search"]:hover, -/// input[type="tel"]:hover, -/// input[type="text"]:hover, -/// input[type="time"]:hover, -/// input[type="url"]:hover, -/// input[type="week"]:hover, -/// textarea:hover { -/// border: 1px solid #0f0; -/// } -/// -/// input[type="color"]:active, -/// input[type="date"]:active, -/// input[type="datetime"]:active, -/// input[type="datetime-local"]:active, -/// input[type="email"]:active, -/// input[type="month"]:active, -/// input[type="number"]:active, -/// input[type="password"]:active, -/// input[type="search"]:active, -/// input[type="tel"]:active, -/// input[type="text"]:active, -/// input[type="time"]:active, -/// input[type="url"]:active, -/// input[type="week"]:active, -/// textarea:active { -/// border: 1px solid #00f; -/// } -/// -/// @require assign-inputs -/// -/// @type List - -$text-inputs-list: 'input[type="color"]', - 'input[type="date"]', - 'input[type="datetime"]', - 'input[type="datetime-local"]', - 'input[type="email"]', - 'input[type="month"]', - 'input[type="number"]', - 'input[type="password"]', - 'input[type="search"]', - 'input[type="tel"]', - 'input[type="text"]', - 'input[type="time"]', - 'input[type="url"]', - 'input[type="week"]', - 'input:not([type])', - 'textarea'; - -$all-text-inputs: assign-inputs($text-inputs-list); -$all-text-inputs-active: assign-inputs($text-inputs-list, active); -$all-text-inputs-focus: assign-inputs($text-inputs-list, focus); -$all-text-inputs-hover: assign-inputs($text-inputs-list, hover); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_timing-functions.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_timing-functions.scss deleted file mode 100644 index 20e5f1d40..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_timing-functions.scss +++ /dev/null @@ -1,34 +0,0 @@ -@charset "UTF-8"; - -/// CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie) -/// -/// Timing functions are the same as demoed here: http://jqueryui.com/resources/demos/effect/easing.html -/// -/// @type cubic-bezier - -$ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530); -$ease-in-cubic: cubic-bezier(0.550, 0.055, 0.675, 0.190); -$ease-in-quart: cubic-bezier(0.895, 0.030, 0.685, 0.220); -$ease-in-quint: cubic-bezier(0.755, 0.050, 0.855, 0.060); -$ease-in-sine: cubic-bezier(0.470, 0.000, 0.745, 0.715); -$ease-in-expo: cubic-bezier(0.950, 0.050, 0.795, 0.035); -$ease-in-circ: cubic-bezier(0.600, 0.040, 0.980, 0.335); -$ease-in-back: cubic-bezier(0.600, -0.280, 0.735, 0.045); - -$ease-out-quad: cubic-bezier(0.250, 0.460, 0.450, 0.940); -$ease-out-cubic: cubic-bezier(0.215, 0.610, 0.355, 1.000); -$ease-out-quart: cubic-bezier(0.165, 0.840, 0.440, 1.000); -$ease-out-quint: cubic-bezier(0.230, 1.000, 0.320, 1.000); -$ease-out-sine: cubic-bezier(0.390, 0.575, 0.565, 1.000); -$ease-out-expo: cubic-bezier(0.190, 1.000, 0.220, 1.000); -$ease-out-circ: cubic-bezier(0.075, 0.820, 0.165, 1.000); -$ease-out-back: cubic-bezier(0.175, 0.885, 0.320, 1.275); - -$ease-in-out-quad: cubic-bezier(0.455, 0.030, 0.515, 0.955); -$ease-in-out-cubic: cubic-bezier(0.645, 0.045, 0.355, 1.000); -$ease-in-out-quart: cubic-bezier(0.770, 0.000, 0.175, 1.000); -$ease-in-out-quint: cubic-bezier(0.860, 0.000, 0.070, 1.000); -$ease-in-out-sine: cubic-bezier(0.445, 0.050, 0.550, 0.950); -$ease-in-out-expo: cubic-bezier(1.000, 0.000, 0.000, 1.000); -$ease-in-out-circ: cubic-bezier(0.785, 0.135, 0.150, 0.860); -$ease-in-out-back: cubic-bezier(0.680, -0.550, 0.265, 1.550); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_triangle.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_triangle.scss deleted file mode 100644 index 8a1ed9cd0..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_triangle.scss +++ /dev/null @@ -1,63 +0,0 @@ -@mixin triangle($size, $color, $direction) { - $width: nth($size, 1); - $height: nth($size, length($size)); - $foreground-color: nth($color, 1); - $background-color: if(length($color) == 2, nth($color, 2), transparent); - height: 0; - width: 0; - - @if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) { - $width: $width / 2; - $height: if(length($size) > 1, $height, $height/2); - - @if $direction == up { - border-bottom: $height solid $foreground-color; - border-left: $width solid $background-color; - border-right: $width solid $background-color; - } @else if $direction == right { - border-bottom: $width solid $background-color; - border-left: $height solid $foreground-color; - border-top: $width solid $background-color; - } @else if $direction == down { - border-left: $width solid $background-color; - border-right: $width solid $background-color; - border-top: $height solid $foreground-color; - } @else if $direction == left { - border-bottom: $width solid $background-color; - border-right: $height solid $foreground-color; - border-top: $width solid $background-color; - } - } @else if ($direction == up-right) or ($direction == up-left) { - border-top: $height solid $foreground-color; - - @if $direction == up-right { - border-left: $width solid $background-color; - } @else if $direction == up-left { - border-right: $width solid $background-color; - } - } @else if ($direction == down-right) or ($direction == down-left) { - border-bottom: $height solid $foreground-color; - - @if $direction == down-right { - border-left: $width solid $background-color; - } @else if $direction == down-left { - border-right: $width solid $background-color; - } - } @else if ($direction == inset-up) { - border-color: $background-color $background-color $foreground-color; - border-style: solid; - border-width: $height $width; - } @else if ($direction == inset-down) { - border-color: $foreground-color $background-color $background-color; - border-style: solid; - border-width: $height $width; - } @else if ($direction == inset-right) { - border-color: $background-color $background-color $background-color $foreground-color; - border-style: solid; - border-width: $width $height; - } @else if ($direction == inset-left) { - border-color: $background-color $foreground-color $background-color $background-color; - border-style: solid; - border-width: $width $height; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_word-wrap.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_word-wrap.scss deleted file mode 100644 index 64856a925..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/addons/_word-wrap.scss +++ /dev/null @@ -1,29 +0,0 @@ -@charset "UTF-8"; - -/// Provides an easy way to change the `word-wrap` property. -/// -/// @param {String} $wrap [break-word] -/// Value for the `word-break` property. -/// -/// @example scss - Usage -/// .wrapper { -/// @include word-wrap(break-word); -/// } -/// -/// @example css - CSS Output -/// .wrapper { -/// overflow-wrap: break-word; -/// word-break: break-all; -/// word-wrap: break-word; -/// } - -@mixin word-wrap($wrap: break-word) { - overflow-wrap: $wrap; - word-wrap: $wrap; - - @if $wrap == break-word { - word-break: break-all; - } @else { - word-break: $wrap; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_animation.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_animation.scss deleted file mode 100644 index aac675f5a..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_animation.scss +++ /dev/null @@ -1,43 +0,0 @@ -// http://www.w3.org/TR/css3-animations/#the-animation-name-property- -// Each of these mixins support comma separated lists of values, which allows different transitions for individual properties to be described in a single style rule. Each value in the list corresponds to the value at that same position in the other properties. - -@mixin animation($animations...) { - @include prefixer(animation, $animations, webkit moz spec); -} - -@mixin animation-name($names...) { - @include prefixer(animation-name, $names, webkit moz spec); -} - -@mixin animation-duration($times...) { - @include prefixer(animation-duration, $times, webkit moz spec); -} - -@mixin animation-timing-function($motions...) { - // ease | linear | ease-in | ease-out | ease-in-out - @include prefixer(animation-timing-function, $motions, webkit moz spec); -} - -@mixin animation-iteration-count($values...) { - // infinite | - @include prefixer(animation-iteration-count, $values, webkit moz spec); -} - -@mixin animation-direction($directions...) { - // normal | alternate - @include prefixer(animation-direction, $directions, webkit moz spec); -} - -@mixin animation-play-state($states...) { - // running | paused - @include prefixer(animation-play-state, $states, webkit moz spec); -} - -@mixin animation-delay($times...) { - @include prefixer(animation-delay, $times, webkit moz spec); -} - -@mixin animation-fill-mode($modes...) { - // none | forwards | backwards | both - @include prefixer(animation-fill-mode, $modes, webkit moz spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_appearance.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_appearance.scss deleted file mode 100644 index abddc0204..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_appearance.scss +++ /dev/null @@ -1,3 +0,0 @@ -@mixin appearance($value) { - @include prefixer(appearance, $value, webkit moz ms o spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_backface-visibility.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_backface-visibility.scss deleted file mode 100644 index fc68e2dd0..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_backface-visibility.scss +++ /dev/null @@ -1,3 +0,0 @@ -@mixin backface-visibility($visibility) { - @include prefixer(backface-visibility, $visibility, webkit spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background-image.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background-image.scss deleted file mode 100644 index 6ed19ab58..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background-image.scss +++ /dev/null @@ -1,42 +0,0 @@ -//************************************************************************// -// Background-image property for adding multiple background images with -// gradients, or for stringing multiple gradients together. -//************************************************************************// - -@mixin background-image($images...) { - $webkit-images: (); - $spec-images: (); - - @each $image in $images { - $webkit-image: (); - $spec-image: (); - - @if (type-of($image) == string) { - $url-str: str-slice($image, 1, 3); - $gradient-type: str-slice($image, 1, 6); - - @if $url-str == "url" { - $webkit-image: $image; - $spec-image: $image; - } - - @else if $gradient-type == "linear" { - $gradients: _linear-gradient-parser($image); - $webkit-image: map-get($gradients, webkit-image); - $spec-image: map-get($gradients, spec-image); - } - - @else if $gradient-type == "radial" { - $gradients: _radial-gradient-parser($image); - $webkit-image: map-get($gradients, webkit-image); - $spec-image: map-get($gradients, spec-image); - } - } - - $webkit-images: append($webkit-images, $webkit-image, comma); - $spec-images: append($spec-images, $spec-image, comma); - } - - background-image: $webkit-images; - background-image: $spec-images; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background.scss deleted file mode 100644 index 019db0ed3..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_background.scss +++ /dev/null @@ -1,55 +0,0 @@ -//************************************************************************// -// Background property for adding multiple backgrounds using shorthand -// notation. -//************************************************************************// - -@mixin background($backgrounds...) { - $webkit-backgrounds: (); - $spec-backgrounds: (); - - @each $background in $backgrounds { - $webkit-background: (); - $spec-background: (); - $background-type: type-of($background); - - @if $background-type == string or $background-type == list { - $background-str: if($background-type == list, nth($background, 1), $background); - - $url-str: str-slice($background-str, 1, 3); - $gradient-type: str-slice($background-str, 1, 6); - - @if $url-str == "url" { - $webkit-background: $background; - $spec-background: $background; - } - - @else if $gradient-type == "linear" { - $gradients: _linear-gradient-parser("#{$background}"); - $webkit-background: map-get($gradients, webkit-image); - $spec-background: map-get($gradients, spec-image); - } - - @else if $gradient-type == "radial" { - $gradients: _radial-gradient-parser("#{$background}"); - $webkit-background: map-get($gradients, webkit-image); - $spec-background: map-get($gradients, spec-image); - } - - @else { - $webkit-background: $background; - $spec-background: $background; - } - } - - @else { - $webkit-background: $background; - $spec-background: $background; - } - - $webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma); - $spec-backgrounds: append($spec-backgrounds, $spec-background, comma); - } - - background: $webkit-backgrounds; - background: $spec-backgrounds; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_border-image.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_border-image.scss deleted file mode 100644 index cf568ce6d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_border-image.scss +++ /dev/null @@ -1,59 +0,0 @@ -@mixin border-image($borders...) { - $webkit-borders: (); - $spec-borders: (); - - @each $border in $borders { - $webkit-border: (); - $spec-border: (); - $border-type: type-of($border); - - @if $border-type == string or list { - $border-str: if($border-type == list, nth($border, 1), $border); - - $url-str: str-slice($border-str, 1, 3); - $gradient-type: str-slice($border-str, 1, 6); - - @if $url-str == "url" { - $webkit-border: $border; - $spec-border: $border; - } - - @else if $gradient-type == "linear" { - $gradients: _linear-gradient-parser("#{$border}"); - $webkit-border: map-get($gradients, webkit-image); - $spec-border: map-get($gradients, spec-image); - } - - @else if $gradient-type == "radial" { - $gradients: _radial-gradient-parser("#{$border}"); - $webkit-border: map-get($gradients, webkit-image); - $spec-border: map-get($gradients, spec-image); - } - - @else { - $webkit-border: $border; - $spec-border: $border; - } - } - - @else { - $webkit-border: $border; - $spec-border: $border; - } - - $webkit-borders: append($webkit-borders, $webkit-border, comma); - $spec-borders: append($spec-borders, $spec-border, comma); - } - - -webkit-border-image: $webkit-borders; - border-image: $spec-borders; - border-style: solid; -} - -//Examples: -// @include border-image(url("image.png")); -// @include border-image(url("image.png") 20 stretch); -// @include border-image(linear-gradient(45deg, orange, yellow)); -// @include border-image(linear-gradient(45deg, orange, yellow) stretch); -// @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round); -// @include border-image(radial-gradient(top, cover, orange, yellow, orange)); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_calc.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_calc.scss deleted file mode 100644 index 0bfc738dd..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_calc.scss +++ /dev/null @@ -1,4 +0,0 @@ -@mixin calc($property, $value) { - #{$property}: -webkit-calc(#{$value}); - #{$property}: calc(#{$value}); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_columns.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_columns.scss deleted file mode 100644 index 96117670c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_columns.scss +++ /dev/null @@ -1,47 +0,0 @@ -@mixin columns($arg: auto) { - // || - @include prefixer(columns, $arg, webkit moz spec); -} - -@mixin column-count($int: auto) { - // auto || integer - @include prefixer(column-count, $int, webkit moz spec); -} - -@mixin column-gap($length: normal) { - // normal || length - @include prefixer(column-gap, $length, webkit moz spec); -} - -@mixin column-fill($arg: auto) { - // auto || length - @include prefixer(column-fill, $arg, webkit moz spec); -} - -@mixin column-rule($arg) { - // || || - @include prefixer(column-rule, $arg, webkit moz spec); -} - -@mixin column-rule-color($color) { - @include prefixer(column-rule-color, $color, webkit moz spec); -} - -@mixin column-rule-style($style: none) { - // none | hidden | dashed | dotted | double | groove | inset | inset | outset | ridge | solid - @include prefixer(column-rule-style, $style, webkit moz spec); -} - -@mixin column-rule-width ($width: none) { - @include prefixer(column-rule-width, $width, webkit moz spec); -} - -@mixin column-span($arg: none) { - // none || all - @include prefixer(column-span, $arg, webkit moz spec); -} - -@mixin column-width($length: auto) { - // auto || length - @include prefixer(column-width, $length, webkit moz spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_filter.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_filter.scss deleted file mode 100644 index b8f8ffb0e..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_filter.scss +++ /dev/null @@ -1,4 +0,0 @@ -@mixin filter($function: none) { - // [ - @include prefixer(perspective, $depth, webkit moz spec); -} - -@mixin perspective-origin($value: 50% 50%) { - @include prefixer(perspective-origin, $value, webkit moz spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_placeholder.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_placeholder.scss deleted file mode 100644 index 5682fd097..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_placeholder.scss +++ /dev/null @@ -1,8 +0,0 @@ -@mixin placeholder { - $placeholders: ":-webkit-input" ":-moz" "-moz" "-ms-input"; - @each $placeholder in $placeholders { - &:#{$placeholder}-placeholder { - @content; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_radial-gradient.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_radial-gradient.scss deleted file mode 100644 index 8da076e28..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_radial-gradient.scss +++ /dev/null @@ -1,39 +0,0 @@ -// Requires Sass 3.1+ -@mixin radial-gradient($g1, $g2, - $g3: null, $g4: null, - $g5: null, $g6: null, - $g7: null, $g8: null, - $g9: null, $g10: null, - $pos: null, - $shape-size: null, - $fallback: null) { - - $data: _radial-arg-parser($g1, $g2, $pos, $shape-size); - $g1: nth($data, 1); - $g2: nth($data, 2); - $pos: nth($data, 3); - $shape-size: nth($data, 4); - - $full: $g1, $g2, $g3, $g4, $g5, $g6, $g7, $g8, $g9, $g10; - - // Strip deprecated cover/contain for spec - $shape-size-spec: _shape-size-stripper($shape-size); - - // Set $g1 as the default fallback color - $first-color: nth($full, 1); - $fallback-color: nth($first-color, 1); - - @if (type-of($fallback) == color) or ($fallback == "transparent") { - $fallback-color: $fallback; - } - - // Add Commas and spaces - $shape-size: if($shape-size, "#{$shape-size}, ", null); - $pos: if($pos, "#{$pos}, ", null); - $pos-spec: if($pos, "at #{$pos}", null); - $shape-size-spec: if(($shape-size-spec != " ") and ($pos == null), "#{$shape-size-spec}, ", "#{$shape-size-spec} "); - - background-color: $fallback-color; - background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full})); - background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})"); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_selection.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_selection.scss deleted file mode 100644 index 23303ab55..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_selection.scss +++ /dev/null @@ -1,42 +0,0 @@ -@charset "UTF-8"; - -/// Outputs the spec and prefixed versions of the `::selection` pseudo-element. -/// -/// @param {Bool} $current-selector [false] -/// If set to `true`, it takes the current element into consideration. -/// -/// @example scss - Usage -/// .element { -/// @include selection(true) { -/// background-color: #ffbb52; -/// } -/// } -/// -/// @example css - CSS Output -/// .element::-moz-selection { -/// background-color: #ffbb52; -/// } -/// -/// .element::selection { -/// background-color: #ffbb52; -/// } - -@mixin selection($current-selector: false) { - @if $current-selector { - &::-moz-selection { - @content; - } - - &::selection { - @content; - } - } @else { - ::-moz-selection { - @content; - } - - ::selection { - @content; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_text-decoration.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_text-decoration.scss deleted file mode 100644 index 9222746ce..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_text-decoration.scss +++ /dev/null @@ -1,19 +0,0 @@ -@mixin text-decoration($value) { -// || || - @include prefixer(text-decoration, $value, moz); -} - -@mixin text-decoration-line($line: none) { -// none || underline || overline || line-through - @include prefixer(text-decoration-line, $line, moz); -} - -@mixin text-decoration-style($style: solid) { -// solid || double || dotted || dashed || wavy - @include prefixer(text-decoration-style, $style, moz webkit); -} - -@mixin text-decoration-color($color: currentColor) { -// currentColor || - @include prefixer(text-decoration-color, $color, moz); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transform.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transform.scss deleted file mode 100644 index 8ee6509ff..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transform.scss +++ /dev/null @@ -1,15 +0,0 @@ -@mixin transform($property: none) { - // none | - @include prefixer(transform, $property, webkit moz ms o spec); -} - -@mixin transform-origin($axes: 50%) { - // x-axis - left | center | right | length | % - // y-axis - top | center | bottom | length | % - // z-axis - length - @include prefixer(transform-origin, $axes, webkit moz ms o spec); -} - -@mixin transform-style($style: flat) { - @include prefixer(transform-style, $style, webkit moz ms o spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transition.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transition.scss deleted file mode 100644 index 3c785ed52..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_transition.scss +++ /dev/null @@ -1,71 +0,0 @@ -// Shorthand mixin. Supports multiple parentheses-deliminated values for each variable. -// Example: @include transition (all 2s ease-in-out); -// @include transition (opacity 1s ease-in 2s, width 2s ease-out); -// @include transition-property (transform, opacity); - -@mixin transition($properties...) { - // Fix for vendor-prefix transform property - $needs-prefixes: false; - $webkit: (); - $moz: (); - $spec: (); - - // Create lists for vendor-prefixed transform - @each $list in $properties { - @if nth($list, 1) == "transform" { - $needs-prefixes: true; - $list1: -webkit-transform; - $list2: -moz-transform; - $list3: (); - - @each $var in $list { - $list3: join($list3, $var); - - @if $var != "transform" { - $list1: join($list1, $var); - $list2: join($list2, $var); - } - } - - $webkit: append($webkit, $list1); - $moz: append($moz, $list2); - $spec: append($spec, $list3); - } @else { - $webkit: append($webkit, $list, comma); - $moz: append($moz, $list, comma); - $spec: append($spec, $list, comma); - } - } - - @if $needs-prefixes { - -webkit-transition: $webkit; - -moz-transition: $moz; - transition: $spec; - } @else { - @if length($properties) >= 1 { - @include prefixer(transition, $properties, webkit moz spec); - } @else { - $properties: all 0.15s ease-out 0s; - @include prefixer(transition, $properties, webkit moz spec); - } - } -} - -@mixin transition-property($properties...) { - -webkit-transition-property: transition-property-names($properties, "webkit"); - -moz-transition-property: transition-property-names($properties, "moz"); - transition-property: transition-property-names($properties, false); -} - -@mixin transition-duration($times...) { - @include prefixer(transition-duration, $times, webkit moz spec); -} - -@mixin transition-timing-function($motions...) { - // ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier() - @include prefixer(transition-timing-function, $motions, webkit moz spec); -} - -@mixin transition-delay($times...) { - @include prefixer(transition-delay, $times, webkit moz spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_user-select.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_user-select.scss deleted file mode 100644 index d4e555100..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/css3/_user-select.scss +++ /dev/null @@ -1,3 +0,0 @@ -@mixin user-select($value: none) { - @include prefixer(user-select, $value, webkit moz ms spec); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_assign-inputs.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_assign-inputs.scss deleted file mode 100644 index f8aba9678..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_assign-inputs.scss +++ /dev/null @@ -1,11 +0,0 @@ -@function assign-inputs($inputs, $pseudo: null) { - $list: (); - - @each $input in $inputs { - $input: unquote($input); - $input: if($pseudo, $input + ":" + $pseudo, $input); - $list: append($list, $input, comma); - } - - @return $list; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains-falsy.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains-falsy.scss deleted file mode 100644 index c096fdb92..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains-falsy.scss +++ /dev/null @@ -1,20 +0,0 @@ -@charset "UTF-8"; - -/// Checks if a list does not contains a value. -/// -/// @access private -/// -/// @param {List} $list -/// The list to check against. -/// -/// @return {Bool} - -@function contains-falsy($list) { - @each $item in $list { - @if not $item { - @return true; - } - } - - @return false; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains.scss deleted file mode 100644 index 3dec27db8..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_contains.scss +++ /dev/null @@ -1,26 +0,0 @@ -@charset "UTF-8"; - -/// Checks if a list contains a value(s). -/// -/// @access private -/// -/// @param {List} $list -/// The list to check against. -/// -/// @param {List} $values -/// A single value or list of values to check for. -/// -/// @example scss - Usage -/// contains($list, $value) -/// -/// @return {Bool} - -@function contains($list, $values...) { - @each $value in $values { - @if type-of(index($list, $value)) != "number" { - @return false; - } - } - - @return true; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-length.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-length.scss deleted file mode 100644 index 5826e789b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-length.scss +++ /dev/null @@ -1,11 +0,0 @@ -@charset "UTF-8"; - -/// Checks for a valid CSS length. -/// -/// @param {String} $value - -@function is-length($value) { - @return type-of($value) != "null" and (str-slice($value + "", 1, 4) == "calc" - or index(auto inherit initial 0, $value) - or (type-of($value) == "number" and not(unitless($value)))); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-light.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-light.scss deleted file mode 100644 index 92d90ac3c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-light.scss +++ /dev/null @@ -1,21 +0,0 @@ -@charset "UTF-8"; - -/// Programatically determines whether a color is light or dark. -/// -/// @link http://robots.thoughtbot.com/closer-look-color-lightness -/// -/// @param {Color (Hex)} $color -/// -/// @example scss - Usage -/// is-light($color) -/// -/// @return {Bool} - -@function is-light($hex-color) { - $-local-red: red(rgba($hex-color, 1)); - $-local-green: green(rgba($hex-color, 1)); - $-local-blue: blue(rgba($hex-color, 1)); - $-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255; - - @return $-local-lightness > 0.6; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-number.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-number.scss deleted file mode 100644 index a64e0bf21..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-number.scss +++ /dev/null @@ -1,11 +0,0 @@ -@charset "UTF-8"; - -/// Checks for a valid number. -/// -/// @param {Number} $value -/// -/// @require {function} contains - -@function is-number($value) { - @return contains("0" "1" "2" "3" "4" "5" "6" "7" "8" "9" 0 1 2 3 4 5 6 7 8 9, $value); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-size.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-size.scss deleted file mode 100644 index 661789ab4..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_is-size.scss +++ /dev/null @@ -1,13 +0,0 @@ -@charset "UTF-8"; - -/// Checks for a valid CSS size. -/// -/// @param {String} $value -/// -/// @require {function} contains -/// @require {function} is-length - -@function is-size($value) { - @return is-length($value) - or contains("fill" "fit-content" "min-content" "max-content", $value); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_modular-scale.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_modular-scale.scss deleted file mode 100644 index 20fa38812..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_modular-scale.scss +++ /dev/null @@ -1,69 +0,0 @@ -// Scaling Variables -$golden: 1.618; -$minor-second: 1.067; -$major-second: 1.125; -$minor-third: 1.2; -$major-third: 1.25; -$perfect-fourth: 1.333; -$augmented-fourth: 1.414; -$perfect-fifth: 1.5; -$minor-sixth: 1.6; -$major-sixth: 1.667; -$minor-seventh: 1.778; -$major-seventh: 1.875; -$octave: 2; -$major-tenth: 2.5; -$major-eleventh: 2.667; -$major-twelfth: 3; -$double-octave: 4; - -$modular-scale-ratio: $perfect-fourth !default; -$modular-scale-base: em($em-base) !default; - -@function modular-scale($increment, $value: $modular-scale-base, $ratio: $modular-scale-ratio) { - $v1: nth($value, 1); - $v2: nth($value, length($value)); - $value: $v1; - - // scale $v2 to just above $v1 - @while $v2 > $v1 { - $v2: ($v2 / $ratio); // will be off-by-1 - } - @while $v2 < $v1 { - $v2: ($v2 * $ratio); // will fix off-by-1 - } - - // check AFTER scaling $v2 to prevent double-counting corner-case - $double-stranded: $v2 > $v1; - - @if $increment > 0 { - @for $i from 1 through $increment { - @if $double-stranded and ($v1 * $ratio) > $v2 { - $value: $v2; - $v2: ($v2 * $ratio); - } @else { - $v1: ($v1 * $ratio); - $value: $v1; - } - } - } - - @if $increment < 0 { - // adjust $v2 to just below $v1 - @if $double-stranded { - $v2: ($v2 / $ratio); - } - - @for $i from $increment through -1 { - @if $double-stranded and ($v1 / $ratio) < $v2 { - $value: $v2; - $v2: ($v2 / $ratio); - } @else { - $v1: ($v1 / $ratio); - $value: $v1; - } - } - } - - @return $value; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-em.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-em.scss deleted file mode 100644 index ae81a44ad..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-em.scss +++ /dev/null @@ -1,13 +0,0 @@ -// Convert pixels to ems -// eg. for a relational value of 12px write em(12) when the parent is 16px -// if the parent is another value say 24px write em(12, 24) - -@function em($pxval, $base: $em-base) { - @if not unitless($pxval) { - $pxval: strip-units($pxval); - } - @if not unitless($base) { - $base: strip-units($base); - } - @return ($pxval / $base) * 1em; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-rem.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-rem.scss deleted file mode 100644 index 0ac941e76..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_px-to-rem.scss +++ /dev/null @@ -1,15 +0,0 @@ -// Convert pixels to rems -// eg. for a relational value of 12px write rem(12) -// Assumes $em-base is the font-size of - -@function rem($pxval) { - @if not unitless($pxval) { - $pxval: strip-units($pxval); - } - - $base: $em-base; - @if not unitless($base) { - $base: strip-units($base); - } - @return ($pxval / $base) * 1rem; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_shade.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_shade.scss deleted file mode 100644 index 8aaf2c6d2..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_shade.scss +++ /dev/null @@ -1,24 +0,0 @@ -@charset "UTF-8"; - -/// Mixes a color with black. -/// -/// @param {Color} $color -/// -/// @param {Number (Percentage)} $percent -/// The amount of black to be mixed in. -/// -/// @example scss - Usage -/// .element { -/// background-color: shade(#ffbb52, 60%); -/// } -/// -/// @example css - CSS Output -/// .element { -/// background-color: #664a20; -/// } -/// -/// @return {Color} - -@function shade($color, $percent) { - @return mix(#000, $color, $percent); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_strip-units.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_strip-units.scss deleted file mode 100644 index 6c5f3e810..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_strip-units.scss +++ /dev/null @@ -1,17 +0,0 @@ -@charset "UTF-8"; - -/// Strips the unit from a number. -/// -/// @param {Number (With Unit)} $value -/// -/// @example scss - Usage -/// $dimension: strip-units(10em); -/// -/// @example css - CSS Output -/// $dimension: 10; -/// -/// @return {Number (Unitless)} - -@function strip-units($value) { - @return ($value / ($value * 0 + 1)); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_tint.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_tint.scss deleted file mode 100644 index 2e3381488..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_tint.scss +++ /dev/null @@ -1,24 +0,0 @@ -@charset "UTF-8"; - -/// Mixes a color with white. -/// -/// @param {Color} $color -/// -/// @param {Number (Percentage)} $percent -/// The amount of white to be mixed in. -/// -/// @example scss - Usage -/// .element { -/// background-color: tint(#6ecaa6, 40%); -/// } -/// -/// @example css - CSS Output -/// .element { -/// background-color: #a8dfc9; -/// } -/// -/// @return {Color} - -@function tint($color, $percent) { - @return mix(#fff, $color, $percent); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_transition-property-name.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_transition-property-name.scss deleted file mode 100644 index 18348b93a..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_transition-property-name.scss +++ /dev/null @@ -1,22 +0,0 @@ -// Return vendor-prefixed property names if appropriate -// Example: transition-property-names((transform, color, background), moz) -> -moz-transform, color, background -//************************************************************************// -@function transition-property-names($props, $vendor: false) { - $new-props: (); - - @each $prop in $props { - $new-props: append($new-props, transition-property-name($prop, $vendor), comma); - } - - @return $new-props; -} - -@function transition-property-name($prop, $vendor: false) { - // put other properties that need to be prefixed here aswell - @if $vendor and $prop == transform { - @return unquote('-'+$vendor+'-'+$prop); - } - @else { - @return $prop; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_unpack.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_unpack.scss deleted file mode 100644 index 4367935d5..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/functions/_unpack.scss +++ /dev/null @@ -1,27 +0,0 @@ -@charset "UTF-8"; - -/// Converts shorthand to the 4-value syntax. -/// -/// @param {List} $shorthand -/// -/// @example scss - Usage -/// .element { -/// margin: unpack(1em 2em); -/// } -/// -/// @example css - CSS Output -/// .element { -/// margin: 1em 2em 1em 2em; -/// } - -@function unpack($shorthand) { - @if length($shorthand) == 1 { - @return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1); - } @else if length($shorthand) == 2 { - @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2); - } @else if length($shorthand) == 3 { - @return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2); - } @else { - @return $shorthand; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_convert-units.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_convert-units.scss deleted file mode 100644 index e0a65a05c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_convert-units.scss +++ /dev/null @@ -1,21 +0,0 @@ -//************************************************************************// -// Helper function for str-to-num fn. -// Source: http://sassmeister.com/gist/9647408 -//************************************************************************// -@function _convert-units($number, $unit) { - $strings: "px", "cm", "mm", "%", "ch", "pica", "in", "em", "rem", "pt", "pc", "ex", "vw", "vh", "vmin", "vmax", "deg", "rad", "grad", "turn"; - $units: 1px, 1cm, 1mm, 1%, 1ch, 1pica, 1in, 1em, 1rem, 1pt, 1pc, 1ex, 1vw, 1vh, 1vmin, 1vmax, 1deg, 1rad, 1grad, 1turn; - $index: index($strings, $unit); - - @if not $index { - @warn "Unknown unit `#{$unit}`."; - @return false; - } - - @if type-of($number) != "number" { - @warn "`#{$number} is not a number`"; - @return false; - } - - @return $number * nth($units, $index); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_directional-values.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_directional-values.scss deleted file mode 100644 index 6ee538db4..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_directional-values.scss +++ /dev/null @@ -1,96 +0,0 @@ -@charset "UTF-8"; - -/// Directional-property mixins are shorthands for writing properties like the following -/// -/// @ignore You can also use `false` instead of `null`. -/// -/// @param {List} $vals -/// List of directional values -/// -/// @example scss - Usage -/// .element { -/// @include border-style(dotted null); -/// @include margin(null 0 10px); -/// } -/// -/// @example css - CSS Output -/// .element { -/// border-bottom-style: dotted; -/// border-top-style: dotted; -/// margin-bottom: 10px; -/// margin-left: 0; -/// margin-right: 0; -/// } -/// -/// @require {function} contains-falsy -/// -/// @return {List} - -@function collapse-directionals($vals) { - $output: null; - - $a: nth($vals, 1); - $b: if(length($vals) < 2, $a, nth($vals, 2)); - $c: if(length($vals) < 3, $a, nth($vals, 3)); - $d: if(length($vals) < 2, $a, nth($vals, if(length($vals) < 4, 2, 4))); - - @if $a == 0 { $a: 0; } - @if $b == 0 { $b: 0; } - @if $c == 0 { $c: 0; } - @if $d == 0 { $d: 0; } - - @if $a == $b and $a == $c and $a == $d { $output: $a; } - @else if $a == $c and $b == $d { $output: $a $b; } - @else if $b == $d { $output: $a $b $c; } - @else { $output: $a $b $c $d; } - - @return $output; -} - -/// Output directional properties, for instance `margin`. -/// -/// @access private -/// -/// @param {String} $pre -/// Prefix to use -/// @param {String} $suf -/// Suffix to use -/// @param {List} $vals -/// List of values -/// -/// @require {function} collapse-directionals -/// @require {function} contains-falsy - -@mixin directional-property($pre, $suf, $vals) { - // Property Names - $top: $pre + "-top" + if($suf, "-#{$suf}", ""); - $bottom: $pre + "-bottom" + if($suf, "-#{$suf}", ""); - $left: $pre + "-left" + if($suf, "-#{$suf}", ""); - $right: $pre + "-right" + if($suf, "-#{$suf}", ""); - $all: $pre + if($suf, "-#{$suf}", ""); - - $vals: collapse-directionals($vals); - - @if contains-falsy($vals) { - @if nth($vals, 1) { #{$top}: nth($vals, 1); } - - @if length($vals) == 1 { - @if nth($vals, 1) { #{$right}: nth($vals, 1); } - } @else { - @if nth($vals, 2) { #{$right}: nth($vals, 2); } - } - - @if length($vals) == 2 { - @if nth($vals, 1) { #{$bottom}: nth($vals, 1); } - @if nth($vals, 2) { #{$left}: nth($vals, 2); } - } @else if length($vals) == 3 { - @if nth($vals, 3) { #{$bottom}: nth($vals, 3); } - @if nth($vals, 2) { #{$left}: nth($vals, 2); } - } @else if length($vals) == 4 { - @if nth($vals, 3) { #{$bottom}: nth($vals, 3); } - @if nth($vals, 4) { #{$left}: nth($vals, 4); } - } - } @else { - #{$all}: $vals; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_font-source-declaration.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_font-source-declaration.scss deleted file mode 100644 index 7f17586c9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_font-source-declaration.scss +++ /dev/null @@ -1,43 +0,0 @@ -// Used for creating the source string for fonts using @font-face -// Reference: http://goo.gl/Ru1bKP - -@function font-url-prefixer($asset-pipeline) { - @if $asset-pipeline == true { - @return font-url; - } @else { - @return url; - } -} - -@function font-source-declaration( - $font-family, - $file-path, - $asset-pipeline, - $file-formats, - $font-url) { - - $src: (); - - $formats-map: ( - eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"), - woff2: "#{$file-path}.woff2" format("woff2"), - woff: "#{$file-path}.woff" format("woff"), - ttf: "#{$file-path}.ttf" format("truetype"), - svg: "#{$file-path}.svg##{$font-family}" format("svg") - ); - - @each $key, $values in $formats-map { - @if contains($file-formats, $key) { - $file-path: nth($values, 1); - $font-format: nth($values, 2); - - @if $asset-pipeline == true { - $src: append($src, font-url($file-path) $font-format, comma); - } @else { - $src: append($src, url($file-path) $font-format, comma); - } - } - } - - @return $src; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_gradient-positions-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_gradient-positions-parser.scss deleted file mode 100644 index 07d30b6cf..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_gradient-positions-parser.scss +++ /dev/null @@ -1,13 +0,0 @@ -@function _gradient-positions-parser($gradient-type, $gradient-positions) { - @if $gradient-positions - and ($gradient-type == linear) - and (type-of($gradient-positions) != color) { - $gradient-positions: _linear-positions-parser($gradient-positions); - } - @else if $gradient-positions - and ($gradient-type == radial) - and (type-of($gradient-positions) != color) { - $gradient-positions: _radial-positions-parser($gradient-positions); - } - @return $gradient-positions; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-angle-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-angle-parser.scss deleted file mode 100644 index e0401ed8d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-angle-parser.scss +++ /dev/null @@ -1,25 +0,0 @@ -// Private function for linear-gradient-parser -@function _linear-angle-parser($image, $first-val, $prefix, $suffix) { - $offset: null; - $unit-short: str-slice($first-val, str-length($first-val) - 2, str-length($first-val)); - $unit-long: str-slice($first-val, str-length($first-val) - 3, str-length($first-val)); - - @if ($unit-long == "grad") or - ($unit-long == "turn") { - $offset: if($unit-long == "grad", -100grad * 3, -0.75turn); - } - - @else if ($unit-short == "deg") or - ($unit-short == "rad") { - $offset: if($unit-short == "deg", -90 * 3, 1.6rad); - } - - @if $offset { - $num: _str-to-num($first-val); - - @return ( - webkit-image: -webkit- + $prefix + ($offset - $num) + $suffix, - spec-image: $image - ); - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-gradient-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-gradient-parser.scss deleted file mode 100644 index 48a8f77f9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-gradient-parser.scss +++ /dev/null @@ -1,41 +0,0 @@ -@function _linear-gradient-parser($image) { - $image: unquote($image); - $gradients: (); - $start: str-index($image, "("); - $end: str-index($image, ","); - $first-val: str-slice($image, $start + 1, $end - 1); - - $prefix: str-slice($image, 1, $start); - $suffix: str-slice($image, $end, str-length($image)); - - $has-multiple-vals: str-index($first-val, " "); - $has-single-position: unquote(_position-flipper($first-val) + ""); - $has-angle: is-number(str-slice($first-val, 1, 1)); - - @if $has-multiple-vals { - $gradients: _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals); - } - - @else if $has-single-position != "" { - $pos: unquote($has-single-position + ""); - - $gradients: ( - webkit-image: -webkit- + $image, - spec-image: $prefix + "to " + $pos + $suffix - ); - } - - @else if $has-angle { - // Rotate degree for webkit - $gradients: _linear-angle-parser($image, $first-val, $prefix, $suffix); - } - - @else { - $gradients: ( - webkit-image: -webkit- + $image, - spec-image: $image - ); - } - - @return $gradients; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-positions-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-positions-parser.scss deleted file mode 100644 index 96d6a6d45..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-positions-parser.scss +++ /dev/null @@ -1,61 +0,0 @@ -@function _linear-positions-parser($pos) { - $type: type-of(nth($pos, 1)); - $spec: null; - $degree: null; - $side: null; - $corner: null; - $length: length($pos); - // Parse Side and corner positions - @if ($length > 1) { - @if nth($pos, 1) == "to" { // Newer syntax - $side: nth($pos, 2); - - @if $length == 2 { // eg. to top - // Swap for backwards compatibility - $degree: _position-flipper(nth($pos, 2)); - } - @else if $length == 3 { // eg. to top left - $corner: nth($pos, 3); - } - } - @else if $length == 2 { // Older syntax ("top left") - $side: _position-flipper(nth($pos, 1)); - $corner: _position-flipper(nth($pos, 2)); - } - - @if ("#{$side} #{$corner}" == "left top") or ("#{$side} #{$corner}" == "top left") { - $degree: _position-flipper(#{$side}) _position-flipper(#{$corner}); - } - @else if ("#{$side} #{$corner}" == "right top") or ("#{$side} #{$corner}" == "top right") { - $degree: _position-flipper(#{$side}) _position-flipper(#{$corner}); - } - @else if ("#{$side} #{$corner}" == "right bottom") or ("#{$side} #{$corner}" == "bottom right") { - $degree: _position-flipper(#{$side}) _position-flipper(#{$corner}); - } - @else if ("#{$side} #{$corner}" == "left bottom") or ("#{$side} #{$corner}" == "bottom left") { - $degree: _position-flipper(#{$side}) _position-flipper(#{$corner}); - } - $spec: to $side $corner; - } - @else if $length == 1 { - // Swap for backwards compatibility - @if $type == string { - $degree: $pos; - $spec: to _position-flipper($pos); - } - @else { - $degree: -270 - $pos; //rotate the gradient opposite from spec - $spec: $pos; - } - } - $degree: unquote($degree + ","); - $spec: unquote($spec + ","); - @return $degree $spec; -} - -@function _position-flipper($pos) { - @return if($pos == left, right, null) - if($pos == right, left, null) - if($pos == top, bottom, null) - if($pos == bottom, top, null); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-side-corner-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-side-corner-parser.scss deleted file mode 100644 index 7a691253d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_linear-side-corner-parser.scss +++ /dev/null @@ -1,31 +0,0 @@ -// Private function for linear-gradient-parser -@function _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals) { - $val-1: str-slice($first-val, 1, $has-multiple-vals - 1); - $val-2: str-slice($first-val, $has-multiple-vals + 1, str-length($first-val)); - $val-3: null; - $has-val-3: str-index($val-2, " "); - - @if $has-val-3 { - $val-3: str-slice($val-2, $has-val-3 + 1, str-length($val-2)); - $val-2: str-slice($val-2, 1, $has-val-3 - 1); - } - - $pos: _position-flipper($val-1) _position-flipper($val-2) _position-flipper($val-3); - $pos: unquote($pos + ""); - - // Use old spec for webkit - @if $val-1 == "to" { - @return ( - webkit-image: -webkit- + $prefix + $pos + $suffix, - spec-image: $image - ); - } - - // Bring the code up to spec - @else { - @return ( - webkit-image: -webkit- + $image, - spec-image: $prefix + "to " + $pos + $suffix - ); - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-arg-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-arg-parser.scss deleted file mode 100644 index 56c6030b7..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-arg-parser.scss +++ /dev/null @@ -1,69 +0,0 @@ -@function _radial-arg-parser($g1, $g2, $pos, $shape-size) { - @each $value in $g1, $g2 { - $first-val: nth($value, 1); - $pos-type: type-of($first-val); - $spec-at-index: null; - - // Determine if spec was passed to mixin - @if type-of($value) == list { - $spec-at-index: if(index($value, at), index($value, at), false); - } - @if $spec-at-index { - @if $spec-at-index > 1 { - @for $i from 1 through ($spec-at-index - 1) { - $shape-size: $shape-size nth($value, $i); - } - @for $i from ($spec-at-index + 1) through length($value) { - $pos: $pos nth($value, $i); - } - } - @else if $spec-at-index == 1 { - @for $i from ($spec-at-index + 1) through length($value) { - $pos: $pos nth($value, $i); - } - } - $g1: null; - } - - // If not spec calculate correct values - @else { - @if ($pos-type != color) or ($first-val != "transparent") { - @if ($pos-type == number) - or ($first-val == "center") - or ($first-val == "top") - or ($first-val == "right") - or ($first-val == "bottom") - or ($first-val == "left") { - - $pos: $value; - - @if $pos == $g1 { - $g1: null; - } - } - - @else if - ($first-val == "ellipse") - or ($first-val == "circle") - or ($first-val == "closest-side") - or ($first-val == "closest-corner") - or ($first-val == "farthest-side") - or ($first-val == "farthest-corner") - or ($first-val == "contain") - or ($first-val == "cover") { - - $shape-size: $value; - - @if $value == $g1 { - $g1: null; - } - - @else if $value == $g2 { - $g2: null; - } - } - } - } - } - @return $g1, $g2, $pos, $shape-size; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-gradient-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-gradient-parser.scss deleted file mode 100644 index 5444d8085..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-gradient-parser.scss +++ /dev/null @@ -1,50 +0,0 @@ -@function _radial-gradient-parser($image) { - $image: unquote($image); - $gradients: (); - $start: str-index($image, "("); - $end: str-index($image, ","); - $first-val: str-slice($image, $start + 1, $end - 1); - - $prefix: str-slice($image, 1, $start); - $suffix: str-slice($image, $end, str-length($image)); - - $is-spec-syntax: str-index($first-val, "at"); - - @if $is-spec-syntax and $is-spec-syntax > 1 { - $keyword: str-slice($first-val, 1, $is-spec-syntax - 2); - $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); - $pos: append($pos, $keyword, comma); - - $gradients: ( - webkit-image: -webkit- + $prefix + $pos + $suffix, - spec-image: $image - ); - } - - @else if $is-spec-syntax == 1 { - $pos: str-slice($first-val, $is-spec-syntax + 3, str-length($first-val)); - - $gradients: ( - webkit-image: -webkit- + $prefix + $pos + $suffix, - spec-image: $image - ); - } - - @else if str-index($image, "cover") or str-index($image, "contain") { - @warn "Radial-gradient needs to be updated to conform to latest spec."; - - $gradients: ( - webkit-image: null, - spec-image: $image - ); - } - - @else { - $gradients: ( - webkit-image: -webkit- + $image, - spec-image: $image - ); - } - - @return $gradients; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-positions-parser.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-positions-parser.scss deleted file mode 100644 index 3c552ad79..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_radial-positions-parser.scss +++ /dev/null @@ -1,18 +0,0 @@ -@function _radial-positions-parser($gradient-pos) { - $shape-size: nth($gradient-pos, 1); - $pos: nth($gradient-pos, 2); - $shape-size-spec: _shape-size-stripper($shape-size); - - $pre-spec: unquote(if($pos, "#{$pos}, ", null)) - unquote(if($shape-size, "#{$shape-size},", null)); - $pos-spec: if($pos, "at #{$pos}", null); - - $spec: "#{$shape-size-spec} #{$pos-spec}"; - - // Add comma - @if ($spec != " ") { - $spec: "#{$spec},"; - } - - @return $pre-spec $spec; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_render-gradients.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_render-gradients.scss deleted file mode 100644 index 576567683..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_render-gradients.scss +++ /dev/null @@ -1,26 +0,0 @@ -// User for linear and radial gradients within background-image or border-image properties - -@function _render-gradients($gradient-positions, $gradients, $gradient-type, $vendor: false) { - $pre-spec: null; - $spec: null; - $vendor-gradients: null; - @if $gradient-type == linear { - @if $gradient-positions { - $pre-spec: nth($gradient-positions, 1); - $spec: nth($gradient-positions, 2); - } - } - @else if $gradient-type == radial { - $pre-spec: nth($gradient-positions, 1); - $spec: nth($gradient-positions, 2); - } - - @if $vendor { - $vendor-gradients: -#{$vendor}-#{$gradient-type}-gradient(#{$pre-spec} $gradients); - } - @else if $vendor == false { - $vendor-gradients: "#{$gradient-type}-gradient(#{$spec} #{$gradients})"; - $vendor-gradients: unquote($vendor-gradients); - } - @return $vendor-gradients; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_shape-size-stripper.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_shape-size-stripper.scss deleted file mode 100644 index ee5eda422..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_shape-size-stripper.scss +++ /dev/null @@ -1,10 +0,0 @@ -@function _shape-size-stripper($shape-size) { - $shape-size-spec: null; - @each $value in $shape-size { - @if ($value == "cover") or ($value == "contain") { - $value: null; - } - $shape-size-spec: "#{$shape-size-spec} #{$value}"; - } - @return $shape-size-spec; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_str-to-num.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_str-to-num.scss deleted file mode 100644 index 3ef1d873b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/helpers/_str-to-num.scss +++ /dev/null @@ -1,50 +0,0 @@ -//************************************************************************// -// Helper function for linear/radial-gradient-parsers. -// Source: http://sassmeister.com/gist/9647408 -//************************************************************************// -@function _str-to-num($string) { - // Matrices - $strings: "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"; - $numbers: 0 1 2 3 4 5 6 7 8 9; - - // Result - $result: 0; - $divider: 0; - $minus: false; - - // Looping through all characters - @for $i from 1 through str-length($string) { - $character: str-slice($string, $i, $i); - $index: index($strings, $character); - - @if $character == "-" { - $minus: true; - } - - @else if $character == "." { - $divider: 1; - } - - @else { - @if not $index { - $result: if($minus, $result * -1, $result); - @return _convert-units($result, str-slice($string, $i)); - } - - $number: nth($numbers, $index); - - @if $divider == 0 { - $result: $result * 10; - } - - @else { - // Move the decimal dot to the left - $divider: $divider * 10; - $number: $number / $divider; - } - - $result: $result + $number; - } - } - @return if($minus, $result * -1, $result); -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_asset-pipeline.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_asset-pipeline.scss deleted file mode 100644 index 4c6afc5bb..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_asset-pipeline.scss +++ /dev/null @@ -1,7 +0,0 @@ -@charset "UTF-8"; - -/// A global setting to enable or disable the `$asset-pipeline` variable for all functions that accept it. -/// -/// @type Bool - -$asset-pipeline: false !default; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_prefixer.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_prefixer.scss deleted file mode 100644 index 8c390514d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_prefixer.scss +++ /dev/null @@ -1,9 +0,0 @@ -@charset "UTF-8"; - -/// Global variables to enable or disable vendor prefixes - -$prefix-for-webkit: true !default; -$prefix-for-mozilla: true !default; -$prefix-for-microsoft: true !default; -$prefix-for-opera: true !default; -$prefix-for-spec: true !default; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_px-to-em.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_px-to-em.scss deleted file mode 100644 index f2f9a3e8d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/bourbon/settings/_px-to-em.scss +++ /dev/null @@ -1 +0,0 @@ -$em-base: 16px !default; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/_grid-settings.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/_grid-settings.scss deleted file mode 100644 index 794343496..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/_grid-settings.scss +++ /dev/null @@ -1,23 +0,0 @@ -// Import gridle : -@import 'gridle/gridle'; - -// setup the grid (required) : -@include gridle_setup(( - context : 12, - gutter-width : 20px, - debug : true -)); - -// register special columns : -@include gridle_register_column("1on5", 1, 5); - -// clear each classes : -@include gridle_register_clear_each(2, left); -@include gridle_register_clear_each(12, both); - -// register states : -@include gridle_register_default_states(); -@include gridle_register_state(ipad-landscape, ( - query : "only screen and (min-device-width : 768px) and (max-device-width : 1024px) and (orientation : landscape)", - gutter-width : 0 -)); \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid-bootstrap.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid-bootstrap.scss deleted file mode 100644 index 101ee15cd..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid-bootstrap.scss +++ /dev/null @@ -1,48 +0,0 @@ -// Import gridle : -@import 'gridle/gridle'; - - -// basic configuration : -@include gridle_setup( ( - context : 12, - gutter-width : 30px, - html-states-classes : true -) ); - -// register states : -@include gridle_register_default_mobile_first_states(); - -/* - * Optional : - * Change generation class names pattern (for example to match bootstrap naming conventions or generate with your own names) : - * Check documentation (http://gridle.org/documentation#name-pattern) for full list - * - * %- = separator sign (configurable by $gridle-class-separator) (no need to add separators if you doesn't want them) - * %state = the state name (mobile, ipad, etc...) - * %count = the column count (1, 2, 3, 4, etc...) - */ -$gridle-grid-name-pattern : ('col','%-','%state','%-','%count'); -$gridle-parent-name-pattern : ('row','%-','%state'); -$gridle-prefix-name-pattern : ('col','%-','%state','%-','offset','%-','%count'); -$gridle-push-name-pattern : ('col','%-','%state','%-','push','%-','%count'); -$gridle-pull-name-pattern : ('col','%-','%state','%-','pull','%-','%count'); -$gridle-show-name-pattern : ('visible','%-','%state'); -$gridle-hide-name-pattern : ('hidden','%-','%state'); - - -/** - * Mobile first approach : - */ -[class*="col-"] { - width:100%; // 100% by default -} - - -// Generate classes : -@include gridle_generate_classes(); - -// Max size : -.container { - margin:0 auto; - max-width:1200px; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid.scss deleted file mode 100644 index d638093c6..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/grid.scss +++ /dev/null @@ -1,24 +0,0 @@ -// Import grid settings : -@import 'grid-settings'; - -// Generate classes : -@include gridle_generate_classes(); - -// you can generate classes separately if you need : -// @include gridle_generate_classes(default); // default is the base state always registered -// @include gridle_generate_classes(mobile, (grid, push, pull)) // generate only the grid, push and pull classes for mobile -// etc... - -// generate a center custom class for all the states : -@include gridle_generate_custom_class( ('center','%-','%state') ) { - text-align:center; -} -// this will produces classes : center, center-mobile, center-tablet, center-ipad-landscape -// for separators, you can use the %- (replaced by the $gridle-class-separator option), or -, --, _, __ - -// Max size : -.container { - margin:0 auto; - max-width:960px; - @include gridle_grid_background(); -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_common-mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_common-mixins.scss deleted file mode 100644 index cd8d5ada0..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_common-mixins.scss +++ /dev/null @@ -1,124 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Common mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -@mixin _gridle_container_common( - $state : default -) { - @extend %gridle-simple-clearfix; - @extend %gridle-container-common; - // debug part - $debug : _gridle_get_var_value(debug, $state); - @if ($debug == true) { - #{$gridle-debug-selector} { - @extend %gridle-container-debug-common; - } - } -} -$_gridle-already-generated : (); -@mixin _gridle_grid_common() { - @extend %gridle-grid-common; - - // default values - $default-gutter-width : _gridle_get_var_value(gutter-width, default); - $default-direction : _gridle_get_var_value(direction, default); - - // loop on each states : - @each $stateName, $state in $_gridle-states - { - // selector key to be used in map - $key : "#{$stateName} #{&}"; - - // check if already generated classes - $already-generated : map-has-key($_gridle-already-generated, $key); - - // vars - $direction : _gridle_get_var_value(direction, $state); - $classes : _gridle_get_var_value(classes, $state); - $gutter-width : _gridle_get_var_value(gutter-width, $state); - $debug : _gridle_get_var_value(debug, $state); - - @if $already-generated != true and $classes and ( ($default-direction != $direction or $default-gutter-width != $gutter-width) or $stateName == default) - { - // set that we have already generated css for this selector - $_gridle-already-generated : map-set($_gridle-already-generated, $key, true) !global; - - // generate the css for this element - @include gridle_state($state) { - @if $direction != $default-direction or $stateName == default { - // content : "#{$key}"; - @if $direction == rtl { - float:right; - direction:rtl; - } @else { - float:left; - direction:ltr; - } - } - @if $gutter-width != $default-gutter-width or $stateName == default { - padding-left:$gutter-width/2; - padding-right:$gutter-width/2; - } - } - - @if $debug == true { - #{$gridle-debug-selector} { - @extend %gridle-grid-debug-common; - } - } - } - } -} -@mixin _gridle_parent_common() { - @extend %gridle-clearfix; - @extend %gridle-parent-common; -} -@mixin _gridle_push_common( - $state : default -) { - $debug : _gridle_get_var_value(debug, $state); - - // extend common : - @extend %gridle-push-pull-common; - @if $debug == true { - #{$gridle-debug-selector} { - @extend %gridle-push-pull-debug-background-common; - background-color:#f4efdf !important; - } - } -} -@mixin _gridle_pull_common( - $state : default -) { - $debug : _gridle_get_var_value(debug, $state); - - @extend %gridle-push-pull-common; - @if $debug == true { - #{$gridle-debug-selector} { - @extend %gridle-push-pull-debug-background-common; - background-color:#cfe4d5 !important; - } - } -} -@mixin _gridle_prefix_common( - $state : default -) { - $debug : _gridle_get_var_value(debug, $state); - @if $debug == true { - #{$gridle-debug-selector} { - @extend %gridle-prefix-debug-common; - } - } -} -@mixin _gridle_suffix_common( - $state : default -) { - $debug : _gridle_get_var_value(debug, $state); - @if $debug == true { - #{$gridle-debug-selector} { - @extend %gridle-suffix-debug-common; - } - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_default-states.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_default-states.scss deleted file mode 100644 index aeb007cdf..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_default-states.scss +++ /dev/null @@ -1,35 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Default states -// |------------------------------------------------------ -// |------------------------------------------------------ - -// retina -@include gridle_register_state("retina", ( - query : "(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 2dppx)", - classes : false -) ); - -// tv -@include gridle_register_state("tv", ( - query : "only tv", - classes : false -) ); - -// print -@include gridle_register_state("print", ( - query : "only print", - classes : false -) ); - -// portrait -@include gridle_register_state("portrait", ( - query : "only screen and (orientation: portrait)", - classes : false -) ); - -// landscape -@include gridle_register_state("landscape", ( - query : "only screen and (orientation: landscape)", - classes : false -) ); \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_functions.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_functions.scss deleted file mode 100644 index 9e6fc0e7e..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_functions.scss +++ /dev/null @@ -1,387 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Functions -// |------------------------------------------------------ -// |------------------------------------------------------ - -/** - * Str replace - * - * @param {string} $string String that you want to replace - * @param {string} $substr String that is to be replaced by `$newsubstr` - * @param {string} $newsubstr String that replaces `$substr` - * @param {number*} $all Flag for replaceing all (1+) or not (0) - * @return {string} - */ -@function str-replace($string, $substr, $newsubstr, $all: 0) { - $position-found: str-index($string, $substr); - $processed: (); - - @while ($position-found and $position-found > 0) { - $length-substr: str-length($substr); - $processed: append($processed, str-slice($string, 0, $position-found - 1)); - $processed: append($processed, $newsubstr); - $string: str-slice($string, $position-found + $length-substr); - - $position-found: 0; - - @if ($all > 0) { - $position-found: str-index($string, $substr); - } - } - - $processed: append($processed, $string); - $string: ""; - - @each $s in $processed { - $string: #{$string}#{$s}; - } - - @return $string; -} - -/** - * Map set - * - * @param Map $map The map to use - * @param String $key The key to update - * @param Mixed $value The new value - * @return Map The new map - */ -@function map-set($map, $key, $value) { - $new: ($key: $value); - @return map-merge($map, $new); -} - - -/** - * Get the column width in percent for the global or a specific context - * - * @param int $columns The number of columns to calculate - * @param int $context : $gridle-columns-count The context to use - * @return percentage The width in percent - */ -@function gridle_get_column_width( - $columns : 1, - $stateMap-or-stateName : null -) { - @return percentage(1 / $context * $columns); -} - - -/** - * Get a state map - * - * @param string $name The name of the state to get - * @return map A state map object - */ -@function _gridle_get_state( - $stateMap-or-stateName -) { - // check if has a state named like this - @if (type-of($stateMap-or-stateName) == string - and map-has-key($_gridle_states, unquote("#{$stateMap-or-stateName}"))) - { - @return map-get($_gridle_states, unquote("#{$stateMap-or-stateName}")); - } - - // a map is passed, so it's a state himself - @if $stateMap-or-stateName - and type-of($stateMap-or-stateName) == map - { - @return map-merge($_gridle-settings, $stateMap-or-stateName); - } - - // return the default one if exist - @if map-has-key($_gridle_states, default) - { - @return map-get($_gridle_states, default); - } - - // nothing finded, return the default state - @return $_gridle-settings; -} - - -/** - * Check if a state exist : - * - * @param string $name The name of the state to check - * @return Boolean true is exist - */ -@function _gridle_has_state( - $stateName -) { - @if map-has-key($_gridle_states, unquote("#{$stateName}")) { - @return true; - } @else { - @return false; - } -} - - -/** - * Get the media queries variables : - * - * @param int $index The media query indes - * @param String $var The media query variable name - * @return String|int The variable value - */ -@function _gridle_get_state_var( - $stateName, - $var : "name" -) { - - // get the state : - $state : _gridle_get_state($stateName); - - // check ig state and if has the variable : - @if $state - and map-has-key($state,unquote("#{$var}")) - { - @return map-get($state,unquote("#{$var}")); - } - - // nothing getted : - @return null; -} - - -/** - * Get a variable - * - * @param String $varName The variable name - * @param String $stateMap-or-stateName The state name or a map state value - * @return Mixed The finded value - */ -@function _gridle_get_var_value( - $varName, - $stateMap-or-stateName : null -) { - // if is a state : - $state : null; - - // get the state (if no state find, return the default one) : - $state : _gridle_get_state($stateMap-or-stateName); - - // extend default state with given state : - $props : map-merge($_gridle-settings, $state); - - @if map-has-key($props, unquote("#{$varName}")) { - @return map-get($state, unquote("#{$varName}")); - } - - // nothing finded : - @return null; -} - - -/** - * Set a variable in a state - * @param Mixed $stateName-or-stateIndex The state name of state index - * @param String $var Variable name to assign - * @param Mixed $newValue The new value to assign - * @return List The states list (full) - */ -@function _gridle_set_state_var( - $stateName, - $var, - $newValue -) { - // get the state : - $state : _gridle_get_state($stateName); - - // check ig state and if has the variable : - @if $state - and map-has-key($state,unquote("#{$var}")) - { - // set new value in state : - $state : map-set($state, unquote("#{$var}"), $newValue); - - // set states : - $_gridle_states : map-set($_gridle_states, unquote("#{$stateName}"), $state); - - // return new state : - @return $state; - } - - // nothing getted : - @return null; -} - - -/** - * Generate a column - * - * @param String $name The column name (often count) - * @param int $columns The column count that the column will take - * @param int $context The context on witch the with will be calculed - * @param Boolean $generateClasses Set if the column has to be generated in css - */ -@function _gridle_create_column( - $name, - $columns, - $context, - $name-multiplicator : 1 // used to extend the state on custom registered columns -) { - @return ( - name : $name, - columns : $columns, - context : $context, - name-multiplicator : $name-multiplicator - ); -} - - -/** - * Generate classname - * - * @param List $parrern The pattern to use to generate classname - * @param String $state The state - * @param int $count The column count - */ -@function _gridle_classname( - $pattern, - $state : null, - $count : null -) { - - // init selector : - $sel : "."; - - // delete default : - @if unquote("#{$state}") == default { - $state : null; - } - - // add class prefix : - @if $gridle-class-prefix and $gridle-class-prefix != '' { - $sel : "#{$sel}#{$gridle-class-prefix}"; - @if $gridle-class-separator { - $sel : "#{$sel}#{$gridle-class-separator}"; - } - } - - // construct class name : - $i : 1; - @each $var in $pattern { - - // replace tokens : - @if $var == '%state' and $state { - $sel : "#{$sel}#{$state}"; - } - @if $var == '%count' and $count { - $sel : "#{$sel}#{$count}"; - } - @if $var != '%state' and $var != '%count' and $var != '%-' and $var != '-' and $var != '--' and $var != '_' and $var != '__' and $var != '%prefix' { - $sel : "#{$sel}#{$var}"; - } - - // handle separators : - @if ($var == '%-' or $var == '-' or $var == '--' or $var == '_' or $var == '__') and $i < length($pattern) { - $index : $i + 1; - $value : nth($pattern, $index); - @if $value != '%state' and $value != '%count' and $value != '%-' and $value != '-' and $value != '--' and $value != '_' and $value != '__' and $value != '%prefix' { - @if $var == '%-' { - $sel : "#{$sel}#{$gridle-class-separator}"; - } @else { - $sel : "#{$sel}#{$var}"; - } - } - @if $value == '%state' and $state { - @if $var == '%-' { - $sel : "#{$sel}#{$gridle-class-separator}"; - } @else { - $sel : "#{$sel}#{$var}"; - } - } - @if $value == '%count' and $count { - @if $var == '%-' { - $sel : "#{$sel}#{$gridle-class-separator}"; - } @else { - $sel : "#{$sel}#{$var}"; - } - } - } - - // update i : - $i : $i + 1; - } - - // return generated class : - @return $sel; -} - - -/** - * Get the media query for a particular state, or with, etc... - * - * @param Mixed $state-or-min-width The state name of the min with - * @param Mixed $max-width The max width if first param is a min width - * @return String The media query string without the @media - */ -@function _gridle_get_media_query( - $state-or-settings -) { - // check if is a string : - $state : null; - @if type-of($state-or-settings) == string - { - $state : _gridle_get_state($state-or-settings); - } - @else if $state-or-settings == null - { - $state : $_gridle-settings; - } - @else - { - $state : map-merge($_gridle-settings, $state-or-settings); - } - - // if it's some settings or a state : - @if $state { - - // get vars : - $name : map-get($state, name); - $min-width : map-get($state, min-width); - $max-width : map-get($state, max-width); - $query : map-get($state, query); - - // direct query : - @if $query - { - @return $query; - } - @else if $min-width and $max-width - { - @return "screen and (min-width: #{$min-width}) and (max-width: #{$max-width})"; - } - @else if $min-width - { - @return "screen and (min-width: #{$min-width})"; - } - @else if $max-width - { - @return "screen and (max-width: #{$max-width})"; - } - @else - { - @return null; - } - - } - @else - { - @return null; - } -} - - -/** - * Get states count - * - * @return int The number of states defined - */ -@function _gridle_get_states_count() { - @return length($_gridle_states) / length($_gridle_states_vars_pattern); -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_generate-mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_generate-mixins.scss deleted file mode 100644 index d09a0e37c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_generate-mixins.scss +++ /dev/null @@ -1,624 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Generate mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - - -/** - * Generate a custom class for all the states - * - * @param list $pattern The name pattern of the class - * @param list $statesNames The states names to generate - */ -@mixin gridle_generate_custom_class( - $pattern, - $statesNames : null -) { - // manage states to generate : - $states : (); - @if $statesNames == null { - // loop on each states to generate names list : - @each $stateName, $state in $_gridle_states { - $states : append($states, $stateName); - } - } @else { - $states : $statesNames; - } - - // loop on each states : - @each $stateName in $states - { - // manage statename : - @if type-of($stateName) != string { - $stateName : map-get($stateName, name); - } - - // classes : - $classes : _gridle_get_var_value(classes, $stateName); - - // genrate the classname : - @if $classes - { - @include gridle_state($stateName, false) { - #{_gridle_classname($pattern, $stateName)} { - @content; - } - } - } - } -} - -// Generate all helpers classes -// All the classes generated are not wrapper in gridle_state -// in this mixin... Just the names are generated accordingly to the -// requested state -@mixin _gridle_generate_helper_classes ( - $state : null, - $what : null -) { - // helpers : - @if $what == null or index($what, float) or index($what, helpers) { - #{_gridle_classname($gridle-float-left-name-pattern, $state)} { - @include gridle_float(left); - } - #{_gridle_classname($gridle-float-right-name-pattern, $state)} { - @include gridle_float(right); - } - } - - @if $what == null or index($what, clear) or index($what, helpers) { - #{_gridle_classname($gridle-clear-name-pattern, $state)} { - @include gridle_clear(both); - } - #{_gridle_classname($gridle-clear-left-name-pattern, $state)} { - @include gridle_clear(left); - } - #{_gridle_classname($gridle-clear-right-name-pattern, $state)} { - @include gridle_clear(right); - } - } - - @if $what == null or index($what, no_gutter) or index($what, no_margin) or index($what, helpers) { - #{_gridle_classname($gridle-no-gutter-name-pattern, $state)}, - #{_gridle_classname($gridle-no-margin-name-pattern, $state)} { - @include gridle_no_margin(); - } - #{_gridle_classname($gridle-no-gutter-left-name-pattern, $state)}, - #{_gridle_classname($gridle-no-margin-left-name-pattern, $state)} { - @include gridle_no_margin(left); - } - #{_gridle_classname($gridle-no-gutter-right-name-pattern, $state)}, - #{_gridle_classname($gridle-no-margin-right-name-pattern, $state)} { - @include gridle_no_margin(right); - } - #{_gridle_classname($gridle-no-gutter-top-name-pattern, $state)}, - #{_gridle_classname($gridle-no-margin-top-name-pattern, $state)} { - @include gridle_no_margin(top); - } - #{_gridle_classname($gridle-no-gutter-bottom-name-pattern, $state)}, - #{_gridle_classname($gridle-no-margin-bottom-name-pattern, $state)} { - @include gridle_no_margin(bottom); - } - } - - @if $what == null or index($what, gutter) or index($what, margin) or index($what, helpers) { - #{_gridle_classname($gridle-gutter-name-pattern, $state)}, - #{_gridle_classname($gridle-margin-name-pattern, $state)} { - @include gridle_margin(left right); - } - #{_gridle_classname($gridle-gutter-left-name-pattern, $state)}, - #{_gridle_classname($gridle-margin-left-name-pattern, $state)} { - @include gridle_margin(left); - } - #{_gridle_classname($gridle-gutter-right-name-pattern, $state)}, - #{_gridle_classname($gridle-margin-right-name-pattern, $state)} { - @include gridle_margin(right); - } - #{_gridle_classname($gridle-gutter-top-name-pattern, $state)}, - #{_gridle_classname($gridle-margin-top-name-pattern, $state)} { - @include gridle_margin(top); - } - #{_gridle_classname($gridle-gutter-bottom-name-pattern, $state)}, - #{_gridle_classname($gridle-margin-bottom-name-pattern, $state)} { - @include gridle_margin(bottom); - } - } - - @if $what == null or index($what, auto_height) or index($what, helpers) { - #{_gridle_classname($gridle-auto-height-name-pattern, $state)} { - height:inherit; - } - } - - @if $what == null or index($what, centered) or index($what, helpers) { - #{_gridle_classname($gridle-centered-name-pattern, $state)} { - @include gridle_centered(null); - } - } - - @if $what == null or index($what, parent) or index($what, helpers) { - #{_gridle_classname($gridle-parent-name-pattern, $state)} { - @include _gridle_parent(); - } - } - - @if $what == null or index($what, vertical_align) or index($what, helpers) { - #{_gridle_classname($gridle-vertical-align-middle-name-pattern, $state)} { - @include _gridle_vertical_align(); - } - #{_gridle_classname($gridle-vertical-align-top-name-pattern, $state)} { - @include _gridle_vertical_align(top); - } - #{_gridle_classname($gridle-vertical-align-bottom-name-pattern, $state)} { - @include _gridle_vertical_align(bottom); - } - } - - /** - * Visible, hide, etc... - */ - @if $what == null or index($what, hide) or index($what, helpers) { - #{_gridle_classname($gridle-hide-name-pattern, $state)} { - @include gridle_hide(null); - } - } - - @if $what == null or index($what, not_visible) or index($what, helpers) { - #{_gridle_classname($gridle-not-visible-name-pattern, $state)} { - @include gridle_not_visible(null); - } - } - - @if $what == null or index($what, show) or index($what, helpers) { - #{_gridle_classname($gridle-show-name-pattern, $state)} { - @include gridle_show(null); - } - #{_gridle_classname($gridle-show-inline-name-pattern, $state)} { - @include gridle_show_inline(null); - } - } - - @if $what == null or index($what, visible) or index($what, helpers) { - #{_gridle_classname($gridle-visible-name-pattern, $state)} { - @include gridle_visible(null); - } - } - - /** - * Clear each class : - */ - @if $what == null or index($what, clear_each) or index($what, helpers) { - @each $clearName, $clearMap in $_gridle_clear_classes { - // get count : - $clearCount : map-get($clearMap, clearEach); - // what to clear : - $clearWhat : map-get($clearMap, clearWhat); - // generate the class : - #{_gridle_classname($gridle-clear-each-pattern, $state, $clearCount)} { - @include _gridle_clear_each($clearCount, $clearWhat); - } - } - } - - // debug colors : - $debug : _gridle_get_var_value(debug, $state); - @if $debug and ( $what == null or index($what, debug_colors) or index($what, helpers) ) { - // debug color classes : - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 1)} { - #{$gridle-debug-selector} { - background-color : #edeeb2; - } - } - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 2)} { - #{$gridle-debug-selector} { - background-color : #fae4a7; - } - } - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 3)} { - #{$gridle-debug-selector} { - background-color : #f5eacc; - } - } - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 4)} { - #{$gridle-debug-selector} { - background-color : #eebdb2; - } - } - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 5)} { - #{$gridle-debug-selector} { - background-color : #d4b2ee; - } - } - #{_gridle_classname($gridle-debug-color-name-pattern, $state, 6)} { - #{$gridle-debug-selector} { - background-color : #b2d8ee; - } - } - } -} - - -// generate settings json : -@mixin gridle_generate_json_settings() { - - // settings content : - $gridle-settings-states : "{"; - - // generate all classes for differents media queries : - $statesCount : length($_gridle_states); - $i : 0; - @each $stateName, $state in $_gridle_states { - - $name : $stateName; - - $gridle-settings-states : "#{$gridle-settings-states} \"#{$name}\":{"; - - @each $varName, $var in $state { - - $value : null; - @if $varName == "query" { - $value : _gridle_get_media_query($stateName); - } @else { - $value : map-get($state,$varName); - } - - @if $value == null { - $gridle-settings-states : "#{$gridle-settings-states} \"#{$varName}\" : null,"; - } @elseif type-of($value) == bool { - $gridle-settings-states : "#{$gridle-settings-states} \"#{$varName}\" : #{$value},"; - } @else { - $gridle-settings-states : "#{$gridle-settings-states} \"#{$varName}\" : \"#{$value}\","; - } - } - - $gridle-settings-states : "#{$gridle-settings-states} \"_gridle\" : true"; - - @if $i >= $statesCount - 1 { - $gridle-settings-states : "#{$gridle-settings-states} }"; - } @else { - $gridle-settings-states : "#{$gridle-settings-states} },"; - } - - // update i : - $i : $i + 1; - - } - - // generate settings json : - $gridle-settings-states : "#{$gridle-settings-states}}"; - $gridle-settings : "{"; - $gridle-settings : "#{$gridle-settings} \"version\" : \"#{$_gridle-version}\""; - - // states : - $gridle-settings : "#{$gridle-settings}, \"states\" : #{$gridle-settings-states}"; - - // debug devices : - $debug_devices : $_gridle_states_debug_devices; - @if length($_gridle_states_debug_devices) <= 0 { - $debug_devices : null; - } - // $gridle-settings : "#{$gridle-settings}, \"debugDevices\" : { #{$debug_devices} }"; - - // settings : - // $gridle-settings : "#{$gridle-settings}, \"classPrefix\" : \"#{$gridle-class-prefix}\""; - $gridle-settings : "#{$gridle-settings} }"; - #gridle-settings { - content : $gridle-settings; - } -} - - -// gridle mixin : -// Generate all the classes needed for a grid -@mixin gridle_generate_classes( - $stateName : null, - $what : null, - $scope : null -) { - // if the what parameter is not null, mean that we need to generate only certain classes in a certain order : - @if $what - { - // loop on each what item to generate the corresponding classes : - @each $w in $what - { - // check if a scope exist : - @if $scope { - // wrapp grid into scope : - .#{$scope} { - @include _gridle_generate_classes($stateName, ( $w ), true); - } - } @else { - // generate classes : - @include _gridle_generate_classes($stateName, ( $w ), false); - } - } - } - @else - { - // don't have any "what" parameter so generate all the classes - // check if a scope exist : - @if $scope { - // wrapp grid into scope : - .#{$scope} { - @include _gridle_generate_classes($stateName, null, true); - } - } @else { - // generate classes : - @include _gridle_generate_classes($stateName, null, false); - } - } -} -$_gridle_generateOnlyOnce : true; // keep track of generate once classes -@mixin _gridle_generate_classes( - $stateName : null, - $what : null, - $has-parent : false -) { - - // generate these classes only once : - @if $_gridle_generateOnlyOnce - { - - // update status : - $_gridle_generateOnlyOnce : false; - - // | ------------------------ - // | Windows 8 fix - // | ------------------------ - - // Windows 8 fix for snap mode : - @media screen and (max-width: 400px) { - @-ms-viewport { width: device-width; } - } - - - // | ------------------------ - // | Container - // | ------------------------ - - // generate container class : - @if $what == null or index($what, container) or index($what, default) - { - $container-selector : (); - $container-selector : append( $container-selector, unquote("#{_gridle_classname($gridle-container-name-pattern)}"), comma); - #{$container-selector} { - @include gridle_container(); - } - } - - - // | ------------------------ - // | Parent selector - // | ------------------------ - - // parent common css : - @if $what == null or index($what, parent) or index($what, default) - { - $parentSelector : _gridle_classname($gridle-parent-name-pattern,null,null); - #{$parentSelector} { - @extend %gridle-clearfix; - @extend %gridle-parent-common; - } - } - - - // // | ------------------------ - // // | JSON Settings - // // | ------------------------ - - // // generate json settings : - @if $gridle-generate-json-settings - { - @include gridle_generate_json_settings(); - } - - } - - - // | ------------------------ - // | Set the list of states to generate - // | ------------------------ - $states : $_gridle_states; - @if $stateName and _gridle_has_state($stateName) { - $states : map-set((), $stateName, _gridle_get_state($stateName)); - } - - - // | ------------------------ - // | Store all the generated common selectors - // | ------------------------ - - // generate all selector for extends : - $grid-common-selector : (); - $push-common-selector : (); - $pull-common-selector : (); - $prefix-common-selector : (); - $suffix-common-selector : (); - - - // | ------------------------ - // | Media queries classes common selectors - // | ------------------------ - - // generate all classes for media queries : - @each $stateName, $state in $states { - - // setup vars : - $media : $stateName; - $classes : map-get($state, classes); - $context : map-get($state, context); - $name-multiplicator : map-get($state, name-multiplicator); - $generate-push-classes : _gridle_get_var_value(generate-push-classes, $state); - $generate-pull-classes : _gridle_get_var_value(generate-pull-classes, $state); - $generate-prefix-classes : _gridle_get_var_value(generate-prefix-classes, $state); - $generate-suffix-classes : _gridle_get_var_value(generate-suffix-classes, $state); - - // generate classes : - @if $classes == true and $context { - - // get specials columns : - $columnsMap : map-merge((), $_gridle_columns); - - // register each default columns : - @for $j from 0 through $context { - - // name : - $columnName : "#{$j*$name-multiplicator}"; - $columnWidth : $j * $name-multiplicator; - - // // create a column : - $col : _gridle_create_column($columnName, $columnWidth, $context, $name-multiplicator); - - // // add column in columns map : - $columnsMap : map-set($columnsMap, $columnName, $col); - } - - // loop on each columns to generate common selector : - @each $columnName, $column in $columnsMap { - - // add selector : - @if $what == null or index($what, grid) or index($what, default) { - $grid-common-selector : append( $grid-common-selector, unquote("#{_gridle_classname($gridle-grid-name-pattern, $media, $columnName)}"), comma ); - } - @if $generate-push-classes and ($what == null or index($what, push) or index($what, default)) { - $push-common-selector : append( $push-common-selector, unquote("#{_gridle_classname($gridle-push-name-pattern, $media, $columnName)}"), comma ); - } - @if $generate-pull-classes and ($what == null or index($what, pull) or index($what, default)) { - $pull-common-selector : append( $pull-common-selector, unquote("#{_gridle_classname($gridle-pull-name-pattern, $media, $columnName)}"), comma ); - } - @if $generate-prefix-classes and ($what == null or index($what, prefix) or index($what, default)) { - $prefix-common-selector : append( $prefix-common-selector, unquote("#{_gridle_classname($gridle-prefix-name-pattern, $media, $columnName)}"), comma ); - } - @if $generate-suffix-classes and ($what == null or index($what, suffix) or index($what, default)) { - $suffix-common-selector : append( $suffix-common-selector, unquote("#{_gridle_classname($gridle-suffix-name-pattern, $media, $columnName)}"), comma ); - } - } - } - } - - // common css : - @if $what == null or index($what, grid) or index($what, default) { - #{$grid-common-selector} { - @include _gridle_grid_common(); - } - } - @if $what == null or index($what, push) or index($what, default) { - #{$push-common-selector} { - @include _gridle_push_common(); - } - } - @if $what == null or index($what, pull) or index($what, default) { - #{$pull-common-selector} { - @include _gridle_pull_common(); - } - } - @if $what == null or index($what, prefix) or index($what, default) { - #{$prefix-common-selector} { - @include _gridle_prefix_common(); - } - } - @if $what == null or index($what, suffix) or index($what, default) { - #{$suffix-common-selector} { - @include _gridle_suffix_common(); - } - } - - - // | ------------------------ - // | Media queries classes - // | ------------------------ - - // generate all classes for differents media queries : - @each $stateName, $state in $states { - - // setup vars : - $classes : _gridle_get_var_value(classes, $state); - $context : _gridle_get_var_value(context, $state); - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $generate-push-classes : _gridle_get_var_value(generate-push-classes, $state); - $generate-pull-classes : _gridle_get_var_value(generate-pull-classes, $state); - $generate-prefix-classes : _gridle_get_var_value(generate-prefix-classes, $state); - $generate-suffix-classes : _gridle_get_var_value(generate-suffix-classes, $state); - $generate-helpers-classes : _gridle_get_var_value(generate-helpers-classes, $state); - - // generate all media queries grid classes : - @if $classes == true { - - // parent common css : - $parentSelector : _gridle_classname($gridle-parent-name-pattern,$stateName,null); - #{$parentSelector} { - @extend %gridle-clearfix; - @extend %gridle-parent-common; - } - - // generate all the classes : - @include gridle_state($stateName, $has-parent) { - - // get specials columns : - $columnsMap : map-merge((), $_gridle_columns); - - // register each default columns : - @for $j from 0 through $context { - - // name : - $columnName : "#{$j*$name-multiplicator}"; - $columnWidth : $j * $name-multiplicator; - - // // create a column : - $col : _gridle_create_column($columnName, $columnWidth, $context, $name-multiplicator); - - // // add column in columns map : - $columnsMap : map-set($columnsMap, $columnName, $col); - } - - // generate all classes for columns : - @each $columnName, $column in $columnsMap { - - // variables : - $columnsCount : map-get($column, columns); - $columnsContext : map-get($column, context); - $columnsNameMultiplicator : map-get($column, name-multiplicator); - - // extend context in state (for columns) : - $extendedState : map-merge($state, ( - context : $columnsContext, - name-multiplicator : $columnsNameMultiplicator // inject the name multiplicator here getted from column to handle custom registered columns - )); - - // classes : - @if $what == null or index($what, grid) or index($what, default) { - #{_gridle_classname($gridle-grid-name-pattern, $stateName, $columnName)} { - @include _gridle($columnsCount, $extendedState); - } - } - @if $generate-push-classes == true and ($what == null or index($what, push) or index($what, default)) { - #{_gridle_classname($gridle-push-name-pattern, $stateName, $columnName)} { - @include _gridle_push($columnsCount, $extendedState); - } - } - @if $generate-pull-classes == true and ($what == null or index($what, pull) or index($what, default)) { - #{_gridle_classname($gridle-pull-name-pattern, $stateName, $columnName)} { - @include _gridle_pull($columnsCount, $extendedState); - } - } - @if $generate-prefix-classes == true and ($what == null or index($what, prefix) or index($what, default)) { - #{_gridle_classname($gridle-prefix-name-pattern, $stateName, $columnName)} { - @include _gridle_prefix($columnsCount, $extendedState); - } - } - @if $generate-suffix-classes == true and ($what == null or index($what, suffix) or index($what, default)) { - #{_gridle_classname($gridle-suffix-name-pattern, $stateName, $columnName)} { - @include _gridle_suffix($columnsCount, $extendedState); - } - } - } - - // media queries helpers classes : - @if $generate-helpers-classes == true { - @include _gridle_generate_helper_classes($stateName, $what); - } - } - } - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_gridle.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_gridle.scss deleted file mode 100644 index cddbe1376..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_gridle.scss +++ /dev/null @@ -1,141 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// Gridle (.scss) -// Gridle is an one and unique grid system file that allows you to generate almost all -// grid you've ever dreamt about. -// |------------------------------------------------------ -// |------------------------------------------------------ - -// |------------------------------------------------------ -// |------------------------------------------------------ -// Copyright (c) 2014 Olivier Bossel - -// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -// documentation files (the "Software"), to deal in the Software without restriction, including without limitation -// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all copies or substantial portions -// of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -// |------------------------------------------------------ -// |------------------------------------------------------ - -// |------------------------------------------------------ -// |------------------------------------------------------ -// @created 25.03.13 -// @updated 09.06.15 -// @author Olivier Bossel -// @version 1.3.40 -// |------------------------------------------------------ -// |------------------------------------------------------ - -$_gridle-version : "1.3.40"; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Variables -// |------------------------------------------------------ -// |------------------------------------------------------ - -$_gridle_settings : (); // the default settings -$_gridle_states : (); // the variable map for each states -$_gridle_clear_classes :(); // store each automatic clear count -$_gridle_columns : (); // store the registered special columns -$_gridle_states_debug_devices : (); // save the debug states devices - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Settings -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'settings'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Silent classes -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'silent-classes'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Common mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'common-mixins'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Functions -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'functions'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Settings mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'settings-mixins'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'mixins'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Generate mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'generate-mixins'; - - - - -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Default states -// |------------------------------------------------------ -// |------------------------------------------------------ - -@import 'default-states'; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_mixins.scss deleted file mode 100644 index b4e440443..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_mixins.scss +++ /dev/null @@ -1,831 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -// Helper to apply multiple config for a certain state with one mixin -@mixin gridle_set( - $settings, - $state : default -) { - - // loop on each settings - @each $settingName, $settingValue in $settings - { - $sn : unquote("#{$settingName}"); - $sv : $settingValue; - - // check if setting name is a state : - @if _gridle_has_state($sn) { - // process the state - @include gridle_set($sv, $sn); - } @else { - @if $sn == container { - @include gridle_container($state); - } @else if $sn == grid { - @include gridle($sv, $state); - } @else if $sn == push { - @include gridle_push($sv, $state); - } @else if $sn == pull { - @include gridle_pull($sv, $state); - } @else if $sn == prefix { - @include gridle_prefix($sv, $state); - } @else if $sn == suffix { - @include gridle_suffix($sv, $state); - } @else if $sn == pull { - @include gridle_pull($sv, $state); - } @else if $sn == clear_each { - @include gridle_clear_each(nth($sv,1), nth($sv,2), $state); - } @else if $sn == centered { - @include gridle_centered($state); - } @else if $sn == parent { - @include gridle_parent($state); - } @else if $sn == vertical_align { - @include gridle_vertical_align($sv, $state); - } @else if $sn == hide { - @if $sv == true { - @include gridle_hide($state); - } @else { - @include gridle_show($state); - } - } @else if $sn == show { - @if $sv == true { - @include gridle_show($state); - } @else { - @include gridle_hide($state); - } - } @else if $sn == visible { - @if $sv == true { - @include gridle_visible($state); - } @else { - @include gridle_not_visible($state); - } - } @else if $sn == not_visible { - @if $sv == true { - @include gridle_not_visible($state); - } @else { - @include gridle_visible($state); - } - } @else if $sn == show_inline { - @if $sv == true { - @include gridle_show_inline($state); - } @else { - @include gridle_hide($state); - } - } @else if $sn == float { - @include gridle_float($sv, $state); - } @else if $sn == clear { - @include gridle_clear($sv, $state); - } @else if $sn == no_gutter - or $sn == no_margin { - @include gridle_no_gutter($sv, $state); - } @else if $sn == gutter - or $sn == margin { - @include gridle_gutter($sv, $state); - } @else { - // we do nothing - } - } - } -} - -// Responsive helpers mixins : -@mixin gridle_state( - $states, - $has-parent : true -) { - - // check first param if is a state : - $firstState : nth($states,1); - @if _gridle_has_state($firstState) { - - // loop on each states : - @each $state in $states - { - // variables : - $html-states-classes : _gridle_get_var_value(html-states-classes, $state); - $debug : _gridle_get_var_value(debug, $state); - $stateName : _gridle_get_var_value(name, $state); - - // check if is a state : - @if ($html-states-classes or $debug) - and $stateName { - // html class : - @if $has-parent { - html#{_gridle_classname("#{$stateName}")} & { @content; } - } @else { - html#{_gridle_classname("#{$stateName}")} { @content; } - } - } - - // get the media query : - $q : _gridle_get_media_query($state); - - // make the media query if a query exist : - @if $q { - @media #{$q} { - @content; - } - } - @else - { - @content; - } - } - - } @else { - - // variables : - $html-states-classes : _gridle_get_var_value(html-states-classes, $states); - $debug : _gridle_get_var_value(debug, $states); - $stateName : _gridle_get_var_value(name, $states); - - // check if is a state : - @if ($html-states-classes or $debug) - and $stateName { - // html class : - @if $has-parent { - html#{_gridle_classname("#{$stateName}")} & { @content; } - } @else { - html#{_gridle_classname("#{$stateName}")} { @content; } - } - } - - // get the media query : - $q : _gridle_get_media_query($states); - - // make the media query if a query exist : - @if $q { - @media #{$q} { - @content; - } - } - @else - { - @content; - } - - } -} - - - -// Container mixin : -@mixin gridle_container( - $state : default -) { - @include _gridle_container_common($state); -} - - -// Grid mixin : -// Set the width of the specified grid column : -@mixin gridle( - $columns, - $state-or-context : default, - $state : default -) { - // manage state and context : - $context : null; - @if type-of($state-or-context) == number { - $context : $state-or-context; - } @else { - $state : $state-or-context; - } - - // common : - @include _gridle_grid_common(); - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle($columns, $state, $context); - } - } @else { - @include _gridle($columns, $state, $context); - } -} -@mixin _gridle( - $columns, - $state : default, - $context : null -) { - // vars : - $name : _gridle_get_var_value(name, $state); - @if type-of($context) != number { - $context : _gridle_get_var_value(context, $state); - } - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $gutter-width : _gridle_get_var_value(gutter-width, $state); - $ie7-support : _gridle_get_var_value(ie7-support, $state); - $debug : _gridle_get_var_value(debug, $state); - $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state); - - // manage columns - @if type-of($columns) != number and map-has-key($_gridle_columns, $columns) { - // the columns is a saved one, get the context and column value - $column : map-get($_gridle_columns, $columns); - $context : map-get($column, context); - $columns : map-get($column, columns); - } @else if type-of($columns) == number { - $columns : $columns / $name-multiplicator; - } @else { - @error "the column #{$columns} does not exist..."; - } - - // vars : - $width : percentage(1 / $context * $columns); - - // set value : - width:$width; - - // ie7 support : - @if $ie7-support == true { - *width: expression((this.parentNode.clientWidth/#{$context}*#{($columns / $name-multiplicator)} - parseInt(this.currentStyle['paddingLeft']) - parseInt(this.currentStyle['paddingRight'])) + 'px'); - } - - // debug : - @if $debug == true and $debug-show-class-names == true { - #{$gridle-debug-selector} { - &:before { - @if $name == default { - content:"grid-#{$name}-#{$columns}"; - } @else { - content:"grid-#{$name}-#{$columns}" !important; - } - } - &.parent:before { - @if $name == default { - content:"grid-parent-#{$name}-#{$columns}"; - } @else { - content:"grid-parent-#{$name}-#{$columns}" !important; - } - } - } - } -} - - -// push : -// Push the element of the count of column wanted -@mixin gridle_push( - $columns, - $state-or-context : default, - $state : default -) { - // manage state and context - $context : null; - @if type-of($state-or-context) == number { - $context : $state-or-context; - } @else { - $state : $state-or-context; - } - - // common : - @include _gridle_push_common($state); - - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_push($columns, $state, $context); - } - } @else { - @include _gridle_push($columns, $state, $context); - } -} -@mixin _gridle_push( - $columns, - $state : default, - $context : null -) { - // variables : - $name : _gridle_get_var_value(name, $state); - @if type-of($context) != number { - $context : _gridle_get_var_value(context, $state); - } - $direction : _gridle_get_var_value(direction, $state); - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $debug : _gridle_get_var_value(debug, $state); - $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state); - - // vars : - $width : percentage(1 / $context) * ($columns / $name-multiplicator); - @if $direction == rtl { $width : $width*-1; } - left:$width; - - // debug css : - @if $debug == true and $debug-show-class-names == true { - #{$gridle-debug-selector} { - &:after { - @if $name == default { - content:"push-#{$name}-#{$columns}"; - } @else { - content:"push-#{$name}-#{$columns}" !important; - } - } - } - } - -} - - -// pull : -// Pull the element of the count of column wanted -@mixin gridle_pull( - $columns, - $state : default -) { - // common : - @include _gridle_pull_common($state); - - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_pull($columns,$state); - } - } @else { - @include _gridle_pull($columns,$state); - } -} -@mixin _gridle_pull( - $columns, - $state : default -) { - // vars : - $name : _gridle_get_var_value(name, $state); - $context : _gridle_get_var_value(context, $state); - $direction : _gridle_get_var_value(direction, $state); - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $debug : _gridle_get_var_value(debug, $state); - $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state); - - // vars : - $width : percentage(1 / $context) * ($columns / $name-multiplicator); - @if $direction == rtl { $width : $width*-1; } - right:$width; - - // debug css : - @if $debug == true and $debug-show-class-names == true { - #{$gridle-debug-selector} { - &:after { - @if $name == default { - content:"pull-#{$name}-#{$columns}"; - } @else { - content:"pull-#{$name}-#{$columns}" !important; - } - } - } - } -} - - -// push : -// Push the element of the count of column wanted -@mixin gridle_prefix( - $columns, - $state : default -) { - // common : - @include _gridle_prefix_common($state); - - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_prefix($columns,$state); - } - } @else { - @include _gridle_prefix($columns,$state); - } -} -@mixin _gridle_prefix( - $columns, - $state : default -) { - // vars : - $name : _gridle_get_var_value(name, $state); - $context : _gridle_get_var_value(context, $state); - $direction : _gridle_get_var_value(direction, $state); - $gutter-width : _gridle_get_var_value(gutter-width, $state); - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $debug : _gridle_get_var_value(debug, $state); - $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state); - - // vars : - $width : percentage(1 / $context) * ($columns / $name-multiplicator); - - // set value : - @if $direction == rtl { margin-right:$width; } - @else { margin-left:$width; } - - // debug css : - @if $debug == true and $debug-show-class-names == true { - #{$gridle-debug-selector} { - &:after { - @if $name == default { - content:"prefix-#{$name}-#{$columns}"; - } @else { - content:"prefix-#{$name}-#{$columns}" !important; - } - } - } - } -} - - -// pull : -// Pull the element of the count of column wanted -@mixin gridle_suffix( - $columns, - $state : default -) { - // common : - @include _gridle_suffix_common($state); - - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_suffix($columns,$state); - } - } @else { - @include _gridle_suffix($columns,$state); - } -} -@mixin _gridle_suffix( - $columns, - $state : default -) { - // vars : - $name : _gridle_get_var_value(name, $state); - $context : _gridle_get_var_value(context, $state); - $direction : _gridle_get_var_value(direction, $state); - $gutter-width : _gridle_get_var_value(gutter-width, $state); - $name-multiplicator : _gridle_get_var_value(name-multiplicator, $state); - $debug : _gridle_get_var_value(debug, $state); - $debug-show-class-names : _gridle_get_var_value(debug-show-class-names, $state); - - // vars : - $width : percentage(1 / $context) * ($columns / $name-multiplicator); - - // set value : - @if $direction == rtl { margin-left:$width; } - @else { margin-right:$width; } - - // debug css : - @if $debug == true and $debug-show-class-names == true { - #{$gridle-debug-selector} { - &:after { - @if $name == default { - content:"suffix-#{$name}-#{$columns}"; - } @else { - content:"suffix-#{$name}-#{$columns}" !important; - } - } - } - } -} - - -// grid background : -// Display the grid background debug -@mixin gridle_grid_background( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_grid_background($state); - } - } @else { - @include _gridle_grid_background($state); - } -} -@mixin _gridle_grid_background( - $state : default -) { - - // variables : - $context : _gridle_get_var_value(context, $state); - - position:relative; - z-index:9999; - &:before { - content:''; - position:absolute; - top:0; left:0; - width:100%; height:100% !important; - // vars : - $width : percentage(1 / $context); - background: linear-gradient(to right, rgba(0,0,0,.01) 50% , rgba(0,0,0,.04) 50%); /* Standard syntax */ - background-size:($width*2) 100%; - // background-position:$gridle-gutter-width/2 0; - } -} - - -/** - * Parent clear each - */ -// Grid mixin : -// Set the width of the specified grid column : -@mixin gridle_clear_each( - $clearEach, - $clearWhat : both, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_clear_each($clearEach, $clearWhat); - } - } @else { - @include _gridle_clear_each($clearEach, $clearWhat); - } -} -@mixin _gridle_clear_each( - $clearEach, - $clearWhat -) { - > *:nth-child(#{$clearEach}n+1) { - clear : $clearWhat; - } -} - - -// Grid centered : -@mixin gridle_centered( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_centered(); - } - } @else { - @include _gridle_centered(); - } -} -@mixin _gridle_centered() { - display:block !important; - float:none !important; - margin-left:auto !important; - margin-right:auto !important; - clear:both !important; -} - - -// Grid parent : -@mixin gridle_parent( - $state : default -) { - // common : - @include _gridle_parent_common(); - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_parent(); - } - } @else { - @include _gridle_parent(); - } -} -@mixin _gridle_parent() { - @include gridle_no_gutter(); -} - - -/** - * Vertical align : - */ -@mixin gridle_vertical_align( - $align : middle, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_vertical_align($align); - } - } @else { - @include _gridle_vertical_align($align); - } -} -@mixin _gridle_vertical_align( - $align : middle -) { - font-size:0; - clear:both; - - > * { - display:inline-block; - float:none !important; - vertical-align:$align; - font-size:1rem; - } -} - - -// Hide on : -// @param String $media On what state -@mixin gridle_hide( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_hide(); - } - } @else { - @include _gridle_hide(); - } -} -@mixin _gridle_hide() { - display:none; -} - - -// Not visible on : -// @param String $media What to hide (one of the 3 state classes name) -@mixin gridle_not_visible( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_not_visible(); - } - } @else { - @include _gridle_not_visible(); - } -} -@mixin _gridle_not_visible() { - visibility:hidden; -} - - -// Show on -// @param String $media What to hide (one of the 3 state classes name) -@mixin gridle_show( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_show(); - } - } @else { - @include _gridle_show(); - } -} -@mixin _gridle_show() { - display:block; -} - - -/** - * Show inline - * - * @param String $state The state name - */ -@mixin gridle_show_inline( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_show_inline(); - } - } @else { - @include _gridle_show_inline(); - } -} -@mixin _gridle_show_inline() { - display:inline-block; -} - - -// Visible on : -// @param String $media On what state -@mixin gridle_visible( - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_visible(); - } - } @else { - @include _gridle_visible(); - } -} -@mixin _gridle_visible() { - visibility:visible; -} - - -// Gridle Right : -@mixin gridle_float( - $float-direction : left, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_float($float-direction); - } - } @else { - @include _gridle_float($float-direction); - } -} -@mixin _gridle_float( - $float-direction : left -) { - float:#{$float-direction}; -} - - -// Gridle clear : -// @param String $clear-direction The direction to clear -// @param String $state The state -@mixin gridle_clear( - $clear-direction : both, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_clear($clear-direction); - } - } @else { - @include _gridle_clear($clear-direction); - } -} -@mixin _gridle_clear( - $clear-direction : both -) { - clear:#{$clear-direction}; -} - - -// Gridle no gutter : -// @param String $side The side to clear -// @param String $state The state -@mixin gridle_no_gutter( - $side : left right, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_no_gutter($side); - } - } @else { - @include _gridle_no_gutter($side); - } -} -@mixin gridle_no_margin( - $side : left right, - $state : default -) { - @include gridle_no_gutter($side, $state); -} -@mixin _gridle_no_gutter( - $side : left right -) { - @each $s in $side { - padding-#{$s} : 0; - } -} - - -// Gridle gutter : -// @param String $side The side to clear -// @param String $state The state -@mixin gridle_gutter( - $side : left right, - $state : default -) { - // check if need media query : - @if $state { - @include gridle_state($state) { - @include _gridle_gutter($side); - } - } @else { - @include _gridle_gutter($side); - } -} -// shortcut : -@mixin gridle_margin( - $side : left right, - $state : default -) { - @include gridle_gutter($side, $state); -} -@mixin _gridle_gutter( - $side : left right, - $state : default -) { - $gutter-width : _gridle_get_var_value(gutter-width, $state); - @each $s in $side { - padding-#{$s} : $gutter-width / 2; - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings-mixins.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings-mixins.scss deleted file mode 100644 index bfd2df859..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings-mixins.scss +++ /dev/null @@ -1,139 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Settings mixins -// |------------------------------------------------------ -// |------------------------------------------------------ - -/** - * Setup - */ -@mixin gridle_setup( - $settings : () -) { - $_gridle-settings : map-merge(( - name : default, - min-width : null, - max-width : null, - query : null, - classes : true, - context : 12, - gutter-width : 20px, - direction : ltr, - name-multiplicator : 1, - debug : false, - debug-show-class-names : true, - ie7-support : false, - html-states-classes : false, - generate-push-classes : true, - generate-pull-classes : true, - generate-prefix-classes : true, - generate-suffix-classes : true, - generate-helpers-classes : true - ), $settings) !global; - - // register default state : - @include gridle_register_state(default, $_gridle-settings); - -} - -// Register an state : -@mixin gridle_register_state( - $name, - $settings -) { - // settings : - $settings : map-merge($_gridle-settings, $settings); - - // set name : - $settings : map-set($settings, name, $name); - - // add state in maps : - $_gridle_states : map-set($_gridle_states, $name, $settings) !global; -} - - -/** - * Register a clear each class - */ -@mixin gridle_register_clear_each( - $count, - $clearWhat -) { - // create the clear map : - $classMap : ( - clearEach : $count, - clearWhat : $clearWhat - ); - - // append to map : - $_gridle_clear_classes : map-set($_gridle_clear_classes, $count, $classMap) !global; -} - - -/** - * Register a special class - */ -@mixin gridle_register_column( - $name, - $columns, - $context -) { - // create a column : - $col : _gridle_create_column($name, $columns, $context); - - // add column in maps : - $_gridle_columns : map-set($_gridle_columns, $name, $col) !global; -} - - -/** - * Register default states - */ -@mixin gridle_register_default_states() { - @include gridle_register_state(mobile, ( - max-width : 480px - )); - @include gridle_register_state(tablet, ( - min-width : 481px, - max-width : 1024px - )); -} - - -/** - * Register default mobile first states : - */ -@mixin gridle_register_default_mobile_first_states() { - @include gridle_register_state(xs, ( - max-width : 768px - )); - @include gridle_register_state(sm, ( - min-width : 768px - )); - @include gridle_register_state(md, ( - min-width : 992px - )); - @include gridle_register_state(lg, ( - min-width : 1200px - )); -} - - -/** - * Set the debug device (not used for now) - * - * @param String $state The state to update - * @para m String $device The device to use (iphone, etc...) - */ -@mixin gridle_set_debug_device( - $state : default, - $device : null -) { - - // check params : - @if $state and $device { - // set the state device : - $_gridle_states_debug_devices : append($_gridle_states_debug_devices, unquote("\"#{$state}\" : \"#{$device}\""), comma); - } - -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings.scss deleted file mode 100644 index 991c35154..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_settings.scss +++ /dev/null @@ -1,69 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Settings -// |------------------------------------------------------ -// |------------------------------------------------------ - -$gridle-generate-json-settings : true !default; - -$gridle-debug-selector : ".gridle-debug &, &.gridle-debug" !default; - -$gridle-class-prefix : '' !default; -$gridle-class-separator : '-' !default; - -$gridle-container-name-pattern : ('container') !default; - -$gridle-grid-name-pattern : ('grid','%-','%state','%-','%count') !default; -$gridle-push-name-pattern : ('push','%-','%state','%-','%count') !default; -$gridle-pull-name-pattern : ('pull','%-','%state','%-','%count') !default; -$gridle-prefix-name-pattern : ('prefix','%-','%state','%-','%count') !default; -$gridle-suffix-name-pattern : ('suffix','%-','%state','%-','%count') !default; - -$gridle-parent-name-pattern : ('parent','%-','%state') !default; -$gridle-centered-name-pattern : ('centered','%-','%state') !default; - -$gridle-vertical-align-middle-name-pattern : ('vertical','%-','align','%-','%state','%-','middle') !default; -$gridle-vertical-align-top-name-pattern : ('vertical','%-','align','%-','%state','%-','top') !default; -$gridle-vertical-align-bottom-name-pattern : ('vertical','%-','align','%-','%state','%-','bottom') !default; - -$gridle-hide-name-pattern : ('hide','%-','%state') !default; -$gridle-show-name-pattern : ('show','%-','%state') !default; -$gridle-show-inline-name-pattern : ('show','%-','inline','%-','%state') !default; -$gridle-not-visible-name-pattern : ('not','%-','visible','%-','%state') !default; -$gridle-visible-name-pattern : ('visible','%-','%state') !default; - -$gridle-float-left-name-pattern : ('float','%-','%state','%-','left') !default; -$gridle-float-right-name-pattern : ('float','%-','%state','%-','right') !default; - -$gridle-clear-name-pattern : ('clear','%-','%state') !default; -$gridle-clear-left-name-pattern : ('clear','%-','%state','%-','left') !default; -$gridle-clear-right-name-pattern : ('clear','%-','%state','%-','right') !default; -$gridle-clear-each-pattern : ('clear','%-','each','%-','%state','%-','%count') !default; - -$gridle-no-gutter-name-pattern : ('no','%-','gutter','%-','%state') !default; -$gridle-no-gutter-left-name-pattern : ('no','%-','gutter','%-','%state','%-','left') !default; -$gridle-no-gutter-right-name-pattern : ('no','%-','gutter','%-','%state','%-','right') !default; -$gridle-no-gutter-top-name-pattern : ('no','%-','gutter','%-','%state','%-','top') !default; -$gridle-no-gutter-bottom-name-pattern : ('no','%-','gutter','%-','%state','%-','bottom') !default; - -$gridle-no-margin-name-pattern : ('no','%-','margin','%-','%state') !default; -$gridle-no-margin-left-name-pattern : ('no','%-','margin','%-','%state','%-','left') !default; -$gridle-no-margin-right-name-pattern : ('no','%-','margin','%-','%state','%-','right') !default; -$gridle-no-margin-top-name-pattern : ('no','%-','margin','%-','%state','%-','top') !default; -$gridle-no-margin-bottom-name-pattern : ('no','%-','margin','%-','%state','%-','bottom') !default; - -$gridle-gutter-name-pattern : ('gutter','%-','%state') !default; -$gridle-gutter-left-name-pattern : ('gutter','%-','%state','%-','left') !default; -$gridle-gutter-right-name-pattern : ('gutter','%-','%state','%-','right') !default; -$gridle-gutter-top-name-pattern : ('gutter','%-','%state','%-','top') !default; -$gridle-gutter-bottom-name-pattern : ('gutter','%-','%state','%-','bottom') !default; - -$gridle-margin-name-pattern : ('margins','%-','%state') !default; -$gridle-margin-left-name-pattern : ('margin','%-','%state','%-','left') !default; -$gridle-margin-right-name-pattern : ('margin','%-','%state','%-','right') !default; -$gridle-margin-top-name-pattern : ('margin','%-','%state','%-','top') !default; -$gridle-margin-bottom-name-pattern : ('margin','%-','%state','%-','bottom') !default; - -$gridle-auto-height-name-pattern : ('auto','%-','height','%-','%state') !default; - -$gridle-debug-color-name-pattern : ('debug','%-','color','%-','%state','%-','%count') !default; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_silent-classes.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_silent-classes.scss deleted file mode 100644 index da72abc58..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/gridle/_silent-classes.scss +++ /dev/null @@ -1,106 +0,0 @@ -// |------------------------------------------------------ -// |------------------------------------------------------ -// | Silent classes -// |------------------------------------------------------ -// |------------------------------------------------------ - -%gridle-pie-clearfix { - &:after { - content: "."; - display: block; - clear: both; - visibility: hidden; - line-height: 0; - height: 0; - } - - & { - display: inline-block; - } - - html[xmlns] & { - display: block; - } - - * html & { - height: 1%; - } -} -%gridle-simple-clearfix { - &:after { - content: ""; - display: table; - clear: both; - border-spacing:0; - } -} -%gridle-clearfix { - // For modern browser - &:before, - &:after { - content:""; - display:table; - border-spacing:0; - } - &:after { - clear:both; - } - // For IE 6/7 (trigger hasLayout - & { - zoom:1; - } -} -%gridle-push-pull-debug-background-common { - background-size:50px 90%; - background-position:0 50%; - background-repeat:repeat-x; -} -%gridle-push-pull-common { - position:relative; -} -%gridle-container-common { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -%gridle-parent-common { - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; -} -%gridle-container-debug-common { - background-color:#f5f5f5; -} -%gridle-grid-debug-common { - &:before, - &:after { - content:""; - display:block; - background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDowRkEzNzVFNTg1NjgxMUUyOUI4RjhEMzg4QzM4QjZFOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowRkEzNzVFNjg1NjgxMUUyOUI4RjhEMzg4QzM4QjZFOCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjBGQTM3NUUzODU2ODExRTI5QjhGOEQzODhDMzhCNkU4IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjBGQTM3NUU0ODU2ODExRTI5QjhGOEQzODhDMzhCNkU4Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8++5+BhQAAAA9JREFUeNpiYGBgkAIIMAAAHwAbZIBtGgAAAABJRU5ErkJggg==); - margin:10px 0; - padding:5px 0; - text-align:center; - color:white; - font-size:11px; - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - display:block !important; - } - background-color:#daeff5; -} -%gridle-grid-common { - display:inline-block; - min-height:1px; - - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - box-sizing: border-box; - -} -%gridle-prefix-debug-common { - background-color:#dae7e9 !important; -} -%gridle-suffix-debug-common { - background-color:#dae7e9 !important; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style-bootstrap.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style-bootstrap.scss deleted file mode 100644 index f2536ae07..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style-bootstrap.scss +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Bootstrap style : - */ -.row { - margin:20px 0; // adding margin to rows -} -.thumb { - background:#eee; - width:100%; height:0; - padding-bottom:56%; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style.scss deleted file mode 100644 index 6cc1f299b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/style.scss +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Imports : - */ -@import 'compass/reset'; - -/** - * Import grid settings : - * This to be able to use gridle mixins, etc... - */ -@import 'grid-settings'; - -/** - * Medias : - */ -ul#medias { - background:black; - text-align:center; - margin-bottom:30px; - - li { - display:inline-block; - height:50px; - line-height:50px; - padding:0 30px; - color:white; - font-size:16px; - cursor:pointer; - margin:0; - - &.active, - &:hover { - background:white; - color:black; - } - } - - @include gridle_state(( - max-width : 620px - )) { - display:none; - } -} - -/** - * Basic formatting : - */ -html { - font:11px/1.5 'Helvetica Neue', Verdana, sans-serif; -} -body { - @include gridle_state(mobile tablet) { - text-align:center; - } - - @include gridle_state(ipad-landscape) { - font-size:16px; - } -} - - -/** - * Gridle set sample : - */ -#myCoolItem { - @include gridle_set(( - grid : 8, - push : 2, - tablet : ( - grid : 12, - push : 0 - ), - mobile : ( - visible : false - ) - )); -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/tests.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/tests.scss deleted file mode 100644 index 970fca71b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/gridle/tests.scss +++ /dev/null @@ -1,280 +0,0 @@ -// Import grid settings : -@import 'grid-settings'; - -// standard grid mixins : -.grid-12 { - @include gridle(12); -} -.grid-1on5 { - @include gridle("1on5"); -} -.grid-12-on-100 { - @include gridle(12, 100); -} -.grid-15-on-100-on-mobile { - @include gridle(15, 100, mobile); -} -.grid-30-on-100-on-mobile-and-tablet { - @include gridle(30, 100); - @include gridle(30, 100, mobile tablet); -} - -// parent -.grid-parent { - @include gridle_parent(); -} -.grid-parent-set { - @include gridle_set(( - parent : true - )); -} - -// clear each -.clear-each-2 { - @include gridle_clear_each(2); -} -.clear-each-2-left { - @include gridle_clear_each(2, left); -} -.clear-each-2-left-mobile { - @include gridle_clear_each(2, left, mobile); -} -.clear-each-2-set { - @include gridle_set(( - clear_each : ( 2, left ) - )); -} - -// centered -.centered { - @include gridle_centered(); -} -.centered-mobile { - @include gridle_centered(mobile); -} - -// certical align -.vertical-align { - @include gridle_vertical_align(); -} -.vertical-align-bottom { - @include gridle_vertical_align(bottom); -} -.vertical-align-top-mobile { - @include gridle_vertical_align(top, mobile); -} -.vertical-align-set { - @include gridle_set(( - vertical_align : middle - )); -} - -// push -.push-6 { - @include gridle_push(6); -} -.push-12-mobile { - @include gridle_push(12, mobile); -} -.push-set { - @include gridle_set(( - push : 3 - )); -} - -// pull -.pull-6 { - @include gridle_pull(6); -} -.pull-12-mobile { - @include gridle_pull(12, mobile); -} -.pull-set { - @include gridle_set(( - pull : 3 - )); -} - -// prefix -.prefix-6 { - @include gridle_prefix(6); -} -.prefix-12-mobile { - @include gridle_prefix(12, mobile); -} -.prefix-set { - @include gridle_set(( - prefix : 3 - )); -} - -// suffix -.suffix-6 { - @include gridle_suffix(6); -} -.suffix-12-mobile { - @include gridle_suffix(12, mobile); -} -.suffix-set { - @include gridle_set(( - suffix : 3 - )); -} - -// hide -.hide { - @include gridle_hide(); -} -.hide-mobile { - @include gridle_hide(mobile); -} -.hide-set { - @include gridle_set(( - hide : true - )); -} - -// show -.show { - @include gridle_show(); -} -.show-mobile { - @include gridle_show(mobile); -} -.show-set { - @include gridle_set(( - show : false - )); -} - -// show_inline -.show_inline { - @include gridle_show_inline(); -} -.show_inline-mobile { - @include gridle_show_inline(mobile); -} -.show_inline-set { - @include gridle_set(( - show_inline : true - )); -} - -// not_visible -.not_visible { - @include gridle_not_visible(); -} -.not_visible-mobile { - @include gridle_not_visible(mobile); -} -.not_visible-set { - @include gridle_set(( - not_visible : true - )); -} - -// visible -.visible { - @include gridle_visible(); -} -.visible-mobile { - @include gridle_visible(mobile); -} -.visible-set { - @include gridle_set(( - visible : false - )); -} - -// gridle state -.gridle-state { - background: red; - - @include gridle_state(mobile tablet) { - background: pink; - } - @include gridle_state(( - query : "only print" - )) { - background: yellow; - } - @include gridle_state(( - max-width : 200px - )) { - background: green; - } -} - -// gridle set -.gridle-set { - @include gridle_set(( - grid : 6, - push : 2, - tablet : ( - grid : 8, - push : 0, - ), - clear : left, - mobile : ( - grid : 12, - push : 0, - pull : 0 - ) - )); -} -.gridle-set-multiple { - @include gridle_set(( - grid : 6 - )); - @include gridle_set(( - grid : 12 - ), mobile tablet); -} - -// float-right -.float-right { - @include gridle_float(right); -} -.float-left-mobile { - @include gridle_float(left, mobile); -} -.float-set { - @include gridle_set(( - float : right - )); -} - -// clear -.clear { - @include gridle_clear(); -} -.clear-left-mobile { - @include gridle_clear(left, mobile); -} -.clear-set { - @include gridle_set(( - clear : left - )); -} - -// gutters -.gutters { - @include gridle_gutter(); -} -.gutters-left { - @include gridle_gutter(left); -} -.gutters-side-mobile { - @include gridle_gutter(left right, mobile); -} - -// no-gutter -.no-gutter { - @include gridle_no_gutter(); -} -.no-gutter-left { - @include gridle_no_gutter(left); -} -.no-gutter-side-mobile { - @include gridle_no_gutter(left right, mobile); -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/normalize/_normalize.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/normalize/_normalize.scss deleted file mode 100644 index 5e5e3c898..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/contrib/normalize/_normalize.scss +++ /dev/null @@ -1,424 +0,0 @@ -/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */ - -/** - * 1. Set default font family to sans-serif. - * 2. Prevent iOS and IE text size adjust after device orientation change, - * without disabling user zoom. - */ - -html { - font-family: sans-serif; /* 1 */ - -ms-text-size-adjust: 100%; /* 2 */ - -webkit-text-size-adjust: 100%; /* 2 */ -} - -/** - * Remove default margin. - */ - -body { - margin: 0; -} - -/* HTML5 display definitions - ========================================================================== */ - -/** - * Correct `block` display not defined for any HTML5 element in IE 8/9. - * Correct `block` display not defined for `details` or `summary` in IE 10/11 - * and Firefox. - * Correct `block` display not defined for `main` in IE 11. - */ - -article, -aside, -details, -figcaption, -figure, -footer, -header, -hgroup, -main, -menu, -nav, -section, -summary { - display: block; -} - -/** - * 1. Correct `inline-block` display not defined in IE 8/9. - * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. - */ - -audio, -canvas, -progress, -video { - display: inline-block; /* 1 */ - vertical-align: baseline; /* 2 */ -} - -/** - * Prevent modern browsers from displaying `audio` without controls. - * Remove excess height in iOS 5 devices. - */ - -audio:not([controls]) { - display: none; - height: 0; -} - -/** - * Address `[hidden]` styling not present in IE 8/9/10. - * Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22. - */ - -[hidden], -template { - display: none; -} - -/* Links - ========================================================================== */ - -/** - * Remove the gray background color from active links in IE 10. - */ - -a { - background-color: transparent; -} - -/** - * Improve readability of focused elements when they are also in an - * active/hover state. - */ - -a:active, -a:hover { - outline: 0; -} - -/* Text-level semantics - ========================================================================== */ - -/** - * Address styling not present in IE 8/9/10/11, Safari, and Chrome. - */ - -abbr[title] { - border-bottom: 1px dotted; -} - -/** - * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. - */ - -b, -strong { - font-weight: bold; -} - -/** - * Address styling not present in Safari and Chrome. - */ - -dfn { - font-style: italic; -} - -/** - * Address variable `h1` font-size and margin within `section` and `article` - * contexts in Firefox 4+, Safari, and Chrome. - */ - -h1 { - font-size: 2em; - margin: 0.67em 0; -} - -/** - * Address styling not present in IE 8/9. - */ - -mark { - background: #ff0; - color: #000; -} - -/** - * Address inconsistent and variable font size in all browsers. - */ - -small { - font-size: 80%; -} - -/** - * Prevent `sub` and `sup` affecting `line-height` in all browsers. - */ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sup { - top: -0.5em; -} - -sub { - bottom: -0.25em; -} - -/* Embedded content - ========================================================================== */ - -/** - * Remove border when inside `a` element in IE 8/9/10. - */ - -img { - border: 0; -} - -/** - * Correct overflow not hidden in IE 9/10/11. - */ - -svg:not(:root) { - overflow: hidden; -} - -/* Grouping content - ========================================================================== */ - -/** - * Address margin not present in IE 8/9 and Safari. - */ - -figure { - margin: 1em 40px; -} - -/** - * Address differences between Firefox and other browsers. - */ - -hr { - box-sizing: content-box; - height: 0; -} - -/** - * Contain overflow in all browsers. - */ - -pre { - overflow: auto; -} - -/** - * Address odd `em`-unit font size rendering in all browsers. - */ - -code, -kbd, -pre, -samp { - font-family: monospace, monospace; - font-size: 1em; -} - -/* Forms - ========================================================================== */ - -/** - * Known limitation: by default, Chrome and Safari on OS X allow very limited - * styling of `select`, unless a `border` property is set. - */ - -/** - * 1. Correct color not being inherited. - * Known issue: affects color of disabled elements. - * 2. Correct font properties not being inherited. - * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. - */ - -button, -input, -optgroup, -select, -textarea { - color: inherit; /* 1 */ - font: inherit; /* 2 */ - margin: 0; /* 3 */ -} - -/** - * Address `overflow` set to `hidden` in IE 8/9/10/11. - */ - -button { - overflow: visible; -} - -/** - * Address inconsistent `text-transform` inheritance for `button` and `select`. - * All other form control elements do not inherit `text-transform` values. - * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. - * Correct `select` style inheritance in Firefox. - */ - -button, -select { - text-transform: none; -} - -/** - * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` - * and `video` controls. - * 2. Correct inability to style clickable `input` types in iOS. - * 3. Improve usability and consistency of cursor style between image-type - * `input` and others. - */ - -button, -html input[type="button"], /* 1 */ -input[type="reset"], -input[type="submit"] { - -webkit-appearance: button; /* 2 */ - cursor: pointer; /* 3 */ -} - -/** - * Re-set default cursor for disabled elements. - */ - -button[disabled], -html input[disabled] { - cursor: default; -} - -/** - * Remove inner padding and border in Firefox 4+. - */ - -button::-moz-focus-inner, -input::-moz-focus-inner { - border: 0; - padding: 0; -} - -/** - * Address Firefox 4+ setting `line-height` on `input` using `!important` in - * the UA stylesheet. - */ - -input { - line-height: normal; -} - -/** - * It's recommended that you don't attempt to style these elements. - * Firefox's implementation doesn't respect box-sizing, padding, or width. - * - * 1. Address box sizing set to `content-box` in IE 8/9/10. - * 2. Remove excess padding in IE 8/9/10. - */ - -input[type="checkbox"], -input[type="radio"] { - box-sizing: border-box; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Fix the cursor style for Chrome's increment/decrement buttons. For certain - * `font-size` values of the `input`, it causes the cursor style of the - * decrement button to change from `default` to `text`. - */ - -input[type="number"]::-webkit-inner-spin-button, -input[type="number"]::-webkit-outer-spin-button { - height: auto; -} - -/** - * 1. Address `appearance` set to `searchfield` in Safari and Chrome. - * 2. Address `box-sizing` set to `border-box` in Safari and Chrome. - */ - -input[type="search"] { - -webkit-appearance: textfield; /* 1 */ - box-sizing: content-box; /* 2 */ -} - -/** - * Remove inner padding and search cancel button in Safari and Chrome on OS X. - * Safari (but not Chrome) clips the cancel button when the search input has - * padding (and `textfield` appearance). - */ - -input[type="search"]::-webkit-search-cancel-button, -input[type="search"]::-webkit-search-decoration { - -webkit-appearance: none; -} - -/** - * Define consistent border, margin, and padding. - */ - -fieldset { - border: 1px solid #c0c0c0; - margin: 0 2px; - padding: 0.35em 0.625em 0.75em; -} - -/** - * 1. Correct `color` not being inherited in IE 8/9/10/11. - * 2. Remove padding so people aren't caught out if they zero out fieldsets. - */ - -legend { - border: 0; /* 1 */ - padding: 0; /* 2 */ -} - -/** - * Remove default vertical scrollbar in IE 8/9/10/11. - */ - -textarea { - overflow: auto; -} - -/** - * Don't inherit the `font-weight` (applied by a rule above). - * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. - */ - -optgroup { - font-weight: bold; -} - -/* Tables - ========================================================================== */ - -/** - * Remove most spacing between table cells. - */ - -table { - border-collapse: collapse; - border-spacing: 0; -} - -td, -th { - padding: 0; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_address.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_address.scss deleted file mode 100644 index afe4e573f..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_address.scss +++ /dev/null @@ -1,20 +0,0 @@ -div.chill_address { - div.chill_address_address { - margin: 0.7em 0; - font-size: 98%; - font-variant: small-caps; - - p { - display: inline-block; - margin: 0 0 0 1.5em; - text-indent: -1.5em; - } - - &.chill_address_address--multiline { - p { - display: block; - } - } - - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_box.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_box.scss deleted file mode 100644 index aa539f6a1..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_box.scss +++ /dev/null @@ -1,24 +0,0 @@ -.chill__box { - font-variant: small-caps; - display: inline; - padding: .2em .6em .3em; - font-size: 0.88rem; - font-weight: bold; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: .25em; - color: white; - - &.green { - background-color: var(--chill-green); - color: white; - } - - &.red { - background-color: var(--chill-red); - color: white; - } -} - diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_custom-fields.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_custom-fields.scss deleted file mode 100644 index e71c75ea6..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_custom-fields.scss +++ /dev/null @@ -1,14 +0,0 @@ -/* the cf title will look like a `form legend h2` */ -span.cf-title { - display: block; - font-weight: 700; - border-bottom: 3px solid $light-grey; - margin-bottom: 1em; -} - -span.cf-subtitle { - display: block; - font-weight: 600; - border-bottom: 1px solid $light-grey; - margin-bottom: 1em; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_flash_messages.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_flash_messages.scss deleted file mode 100644 index 62f875dfa..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_flash_messages.scss +++ /dev/null @@ -1,14 +0,0 @@ -.flash_message { - margin-top: 2.5em; -} - -// note that other level are defined in modules/_alerts.scss - -// .alert { -// // override in modules/_alerts.scss -// @include alert($red); -// } -// -// .warning { -// @include alert($orange); -// } diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_fonts.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_fonts.scss deleted file mode 100644 index 973e7c27b..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_fonts.scss +++ /dev/null @@ -1,2 +0,0 @@ - -@import '../../../fonts/OpenSans/OpenSans'; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_pagination.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_pagination.scss deleted file mode 100644 index 0c125df04..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_pagination.scss +++ /dev/null @@ -1,32 +0,0 @@ -.pagination { - display: flex; - justify-content: center; - text-align: center; - margin-top: 1em; - - .link { - background-color: white; - display: inline-block; - } - - .link:nth-of-type(1n+2) { - border-left: 1px solid $chill-light-gray; - } - - .link.current { - font-weight: bold; - color: white; - background-color: #334d5c; - padding: 0.4em 0.8em; - } - - .link a { - display: block; - padding: 0.4em 0.8em; - } - .link a:hover { - color: white; - font-weight: bold; - background-color: $chill-green; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_person.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_person.scss deleted file mode 100644 index 6d92923a9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_person.scss +++ /dev/null @@ -1,3 +0,0 @@ -.person { - color: $chill-blue; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_record_actions.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_record_actions.scss deleted file mode 100644 index ccbc5912a..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_record_actions.scss +++ /dev/null @@ -1,58 +0,0 @@ -// Symfony records actions -/*ul.record_actions { - padding-left: 0; -} -ul.record_actions li { - display: inline-block; -}*/ - -ul.record_actions, ul.record_actions_column { - display: flex; - justify-content: flex-end; - - &.record_actions--left { - justify-content: flex-start; - } - - padding: 0.5em 0; - flex-wrap: wrap-reverse; - - li { - display: inline-block; - list-style-type: none; - margin-right: 1em; - order: 99; - - &:last-child { - margin-right: 0; - } - } - - - li.cancel { - order: 1; - margin-right: auto; - } - -} - -ul.record_actions { - flex-direction: row; -} - -ul.record_actions_column { - flex-direction: column; -} - -ul.record_actions.sticky-form-buttons { - padding-left: 1em; - padding-right: 1em; -} - -// inside table, little space between elements -td ul.record_actions, - ul.record_actions_small { - li { - margin-right: 0.2em; - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_report.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_report.scss deleted file mode 100644 index dc7e48623..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_report.scss +++ /dev/null @@ -1,3 +0,0 @@ -.report { - color: $chill-red; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_timeline.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_timeline.scss deleted file mode 100644 index b347cde75..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/_timeline.scss +++ /dev/null @@ -1,53 +0,0 @@ -/* -Chill is a software for social workers -Copyright (C) 2015 Champs Libres - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program. If not, see . -*/ - -div.timeline-item { - padding: 0.5em; - overflow: auto; - margin-bottom: 1.5em; - - &.odd { - background-color: $chill-llight-gray; - - .summary { - background-color: $white; - } - } - - &.even { - background-color: $white; - - .summary { - background-color: $chill-llight-gray; - } - } - - .summary { - margin: 1em; - overflow: auto; - } - - h3 { - margin-top: 0em; - font-size: 1em; - - &.single-line { - margin-bottom: 0em; - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_colors.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_colors.scss deleted file mode 100644 index 91e4ebae0..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_colors.scss +++ /dev/null @@ -1,65 +0,0 @@ - -$chill-blue: #334d5c; -$chill-green: #43b29d; -$chill-green-dark: #328474; -$chill-yellow: #eec84a; -$chill-orange: #e2793d; -$chill-red: #df4949; -$chill-gray: #ececec; -$chill-beige: #cabb9f; -$chill-pink: #dd506d; -$chill-dark-gray: #333333; -$chill-light-gray: #b2b2b2; -$chill-llight-gray: #e6e6e6; - -$dark-grey: $chill-dark-gray; - -$color-name: "blue" "green" "green-dark" "yellow" "orange" "red" "gray" "beige" "pink" "dark-gray" "light-gray"; -$color-code: #334d5c #43b29d #328474 #eec84a #e2793d #df4949 #ececec #cabb9f #dd506d #333333 #b2b2b2; - -@for $i from 1 through length($color-name) { - .chill-#{nth($color-name, $i)} { - color: nth($color-code, $i); - } -} - -$orange: $chill-orange; -$red: $chill-red; -$green: $chill-green; -$blue: $chill-blue; -$yellow: $chill-yellow; - -$black: #111111; -$white: #ffffff; -$light-grey: $chill-light-gray; - -/* - due to a bug in sass, we must re-declare the variable in css - (use of a sass variable after -- does not work) -*/ -:root { - --chill-blue: #334d5c; - --chill-green: #43b29d; - --chill-green-dark: #328474; - --chill-yellow: #eec84a; - --chill-orange: #e2793d; - --chill-red: #df4949; - --chill-gray: #ececec; - --chill-beige: #cabb9f; - --chill-pink: #dd506d; - --chill-dark-gray: #333333; - --chill-light-gray: #b2b2b2; - --chill-llight-gray: #e6e6e6; - - --dark-grey: #333333; - - --orange: #e2793d; - --red: #df4949; - --green: #43b29d; - --blue: #334d5c; - --yellow: #eec84a; - - --black: #111111; - --white: #ffffff; - --light-grey: #b2b2b2; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_variables.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_variables.scss deleted file mode 100644 index 994a5a4e9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/config/_variables.scss +++ /dev/null @@ -1,45 +0,0 @@ -// General -$base-border-radius: 0; -$form-border-radius: 0; -$navigation-border-radius: 0; - -// Footer -$footer-vertical-padding: 10px; -$footer-background: $chill-dark-gray; -$footer-disclaimer-color: white; - -// Navigation -$navigation-background: $dark-grey; -$navigation-first-padding-top: 0; -$navigation-last-padding-bottom: 0; -$navigation-color: white; -$navigation-color-hover: white; -$navigation-search-padding: 17px 0 0; -$navigation-border-bottom: none; - -// Form -$form-border-color: $black; -$form-border-color-hover: $black; -$form-border-color-focus: $black; -$form-border-size: 1px; - -// Table -$table-head-bg-color: unset; -$table-head-text-color: $chill-blue; - -$table-body-tr-bg-color-even: $chill-llight-gray; -$table-body-tr-bg-color-odd: $white; -$table-body-td-border: 1px solid $black; -$table-body-td-text-align: left; - -// Tabs -$tabs-nav-margin-bottom: 0.2em; -$tabs-nav-bg-color: $yellow; -$tabs-nav-bg-color-light: lighten($yellow, 10%); -$tabs-nav-text-color: $blue; -$tabs-new-border: none; -$tabs-nav-hover-border: none; -$tabs-nav-hover-text-color: $blue; -$tabs-nav-font-family: 'Open Sans'; -$tabs-nav-font-weight: bold; -$tabs-nav-padding: 0.3em 0.3em 0.3em 0.6em; diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/mixins/entity.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/mixins/entity.scss deleted file mode 100644 index 28cc74d06..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/mixins/entity.scss +++ /dev/null @@ -1,16 +0,0 @@ -@mixin entity($background-color, $color: white) { - font-variant: small-caps; - display: inline-block; - padding: .2em .6em .3em; - font-size: 88%; - font-weight: bold; - line-height: 1; - text-align: center; - white-space: nowrap; - vertical-align: baseline; - border-radius: .25em; - color: $color; - background-color: $background-color; - margin: 0.5em; -} - diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_buttons.scss deleted file mode 100644 index 7c332818d..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_buttons.scss +++ /dev/null @@ -1,175 +0,0 @@ -.sc-button { - margin-bottom: 0.5rem; - - &.bt-submit, &.bt-save, &.bt-create, &.bt-new, &.bt-duplicate, &.bt-not-duplicate { - @include button($green, $white); - } - - &.bt-reset, &.bt-delete, &.bt-remove { - @include button($red, $white); - } - - &.bt-action, &.bt-edit, &.bt-update { - @include button($orange, $white); - } - - &.bt-show, &.bt-view { - @include button($blue, $white); - } - - &:not(.change-icon) { - - // icons using font-awesome "old way" - &.bt-create::before, - &.bt-save::before, - &.bt-new::before, - &.bt-delete::before, - &.bt-remove::before, - &.bt-update::before, - &.bt-edit::before, - &.bt-cancel::before, - &.bt-view::before, - &.bt-show::before { - font: normal normal normal 14px/1 ForkAwesome; - margin-right: 0.5em; - } - - // icons using font-awesome "new svg way" - &.bt-not-duplicate::before, - &.bt-duplicate::before { - display: inline-block; - width: 1em; - margin-right: 0.5em; - vertical-align: middle; - } - - &.bt-save::before { - // add a floppy - content: ""; - } - - &.bt-create::before, &.bt-new::before { - // add a plus - content: ""; - } - - &.bt-delete::before { - // add a trash - content: ""; - } - - &.bt-remove::before { - // add a times - content: ""; - } - - &.bt-edit::before, &.bt-update::before { - // add a pencil - content: ""; - } - - &.bt-cancel::before { - // add an arrow left - content: ""; - } - - &.bt-show::before, &.bt-view::before { - content: ""; - } - - &.bt-duplicate::before { - content: url("./copy-solid.svg"); - } - - &.bt-not-duplicate::before { /* - content: url("./users-slash-solid.svg"); */ - } - } - - > i.fa { - margin-right: 0.5em; - } - - &.has-hidden, - &:empty { - > i.fa { - margin-right: 0; - } - &:not(.change-icon) { - &.bt-create::before, - &.bt-save::before, - &.bt-new::before, - &.bt-delete::before, - &.bt-remove::before, - &.bt-update::before, - &.bt-edit::before, - &.bt-cancel::before, - &.bt-view::before, - &.bt-show::before { - margin-right: 0; - } - } - } - - &.has-hidden > span.show-on-hover { - display: none; - } - - &.has-hidden:hover { - - > span.show-on-hover { - display: inline-block; - } - - > i.fa { - margin-right: 0.5em; - } - - &:not(.change-icon) { - &.bt-create::before, - &.bt-save::before, - &.bt-new::before, - &.bt-delete::before, - &.bt-remove::before, - &.bt-update::before, - &.bt-edit::before, - &.bt-cancel::before, - &.bt-view::before, - &.bt-show::before { - margin-right: 0.5em; - } - } - } - - &.button-small { - font-size: 80%; - padding: 6px 8px; - } -} - - - -// Sticky form buttons -.sticky-form-buttons { - margin-top:1em; - background-color:$chill-beige; - position:sticky; - bottom:0.5em; - text-align:center; - padding:0.5em; - border-radius: $base-border-radius; - - -} - - - -.sticky-form-buttons .margin-5 { - margin-left: 5%; - margin-right: 5%; -} - -.sticky-form-buttons .margin-10 { - margin-left: 10%; - margin-right: 10%; -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_forms.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_forms.scss deleted file mode 100644 index 0e5099ef0..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_forms.scss +++ /dev/null @@ -1,28 +0,0 @@ -// For cutomizing the form elements - -textarea { - height: 12em; -} - -span.force-inline-label label { - display: inline; -} - - -.chill-form-money { - display: flex; - flex-direction: row; - justify-content: flex-end; - - span.chill-form-money__money { - align-self: center; - margin-left: 1em; - } -} - - -.chill-form__errors { - .chill-form_errors__entry.chill-form__errors__entry--warning { - color: var(--chill-green-dark); - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_navigation.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_navigation.scss deleted file mode 100644 index be28d0348..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/_navigation.scss +++ /dev/null @@ -1,88 +0,0 @@ -.navigation { - background-color: $chill-blue; - - - a.more:after { - color: $chill-dark-gray; - } - - li.nav-link2 { - a { - margin-bottom: 2px; - } - - &.lang-selection { - color: $chill-light-gray; - font-size: 0.7em; - - a.more:after { - color: $chill-light-gray; - } - } - - ul { - top: 58px; - - a { - padding-left: 0; - } - } - } - - div.nav, div.navigation-search { - float: right; - - input[type=search] { - padding: 0.2em; - float: left; - - border: none; - } - - button { - color: $chill-light-gray; - background-color: $chill-blue; - padding: 0 0 0 7px; - top: inherit; - font-size: 1.2em; - position: unset; - float: left; - } - } - - li.user-menu { - min-width: 14rem; - } - - ul.user-menu-list { - - li.user-menu__entry { - display: block; - background-color: $chill-dark-gray; - border-bottom: 1px solid #FFF; - padding-top: 0; - padding-bottom: 0; - line-height: 2; - } - - li.user-menu__entry--warning-entry { - background-color: $chill-red; - font-weight: 700; - } - } - - span.notification-counter { - display: inline-block; - padding: .25em .6em .25rem .6em; - font-size: 100%; - line-height: 1; - text-align: center; - white-space: nowrap; - - border-radius: 10rem; - background-color: $chill-red; - color: $white; - font-weight: 700; - margin-left: .5rem; - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/copy-solid.svg b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/copy-solid.svg deleted file mode 100644 index 6acdf87cd..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/copy-solid.svg +++ /dev/null @@ -1,4 +0,0 @@ - \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/users-slash-solid.svg b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/users-slash-solid.svg deleted file mode 100644 index 5bd2883cc..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/custom/modules/users-slash-solid.svg +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/index.js b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/index.js deleted file mode 100644 index 6396103fc..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/index.js +++ /dev/null @@ -1 +0,0 @@ -require('./scratch.scss'); diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_alerts.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_alerts.scss deleted file mode 100644 index d7d4d62ab..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_alerts.scss +++ /dev/null @@ -1,7 +0,0 @@ -@mixin alert($color) { - background: transparentize($color,0.8); - color: $color; - font-weight: bold; - margin-bottom: 0.75em; - padding: 0.75em; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_buttons.scss deleted file mode 100644 index 603856e23..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/mixins/_buttons.scss +++ /dev/null @@ -1,34 +0,0 @@ -@mixin button($button-background-color, $button-text-color) { - color: $button-text-color; - background: $button-background-color; - border: medium none; - box-shadow: none; - padding: $button-padding; - text-decoration: none; - text-align: center; - display: inline-block; - vertical-align: middle; - white-space: nowrap; - line-height: normal; - @include border-top-radius($base-border-radius); - @include border-bottom-radius($base-border-radius); - - &:hover, - &:active { - background: darken($button-background-color, 5%); - color: $button-text-color; // force text color for anchor tags - text-decoration: none; // remove underline on anchor tags - } - - &:focus { - background: darken($button-background-color, 5%); - } - - &[disabled] { - background: transparentize($button-background-color,0.4); - color: darken($button-background-color, 10%); - &:hover { - box-shadow: none; - } - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_alerts.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_alerts.scss deleted file mode 100644 index 03ed6b5cd..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_alerts.scss +++ /dev/null @@ -1,15 +0,0 @@ -.success { - @include alert($green); -} - -.error { - @include alert($red); -} - -.alert { - @include alert($orange); -} - -.notice { - @include alert($blue); -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_buttons.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_buttons.scss deleted file mode 100644 index 9e0036de5..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_buttons.scss +++ /dev/null @@ -1,12 +0,0 @@ -.sc-button { - @include button($grey-15, $button-text-color); - - &.blue { @include button($blue, $white); } - &.green { @include button($green, $white); } - &.orange { @include button($orange, $white); } - &.red { @include button($red, $white); } - &.black { @include button($grey-90, $white); } - &.white { @include button($white, $text-color); } -} - -@import "../custom/modules/buttons"; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_content.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_content.scss deleted file mode 100644 index 49be33d38..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_content.scss +++ /dev/null @@ -1,7 +0,0 @@ -html, body { - height: 100%; -} - -.content { - min-height: 85%; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_footer.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_footer.scss deleted file mode 100644 index 1193f4c30..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_footer.scss +++ /dev/null @@ -1,65 +0,0 @@ -.footer { - background: $footer-background; - padding-top: $footer-vertical-padding; - padding-bottom: $footer-vertical-padding; - width: 100%; - - .footer-logo { - text-align: center; - margin-bottom: 2em; - - img { - height: 3em; - } - } - - .footer-links { - @include gridle_clear(both); - - margin-bottom: $base-spacing; - @include gridle(8); - @include gridle_centered(); - } - - ul { - margin-bottom: $base-spacing*2; - @include gridle (4); - list-style-type: none; - } - - li { - text-align: center; - } - - li a { - color: $footer-link-color; - - &:hover { - color: transparentize($footer-color, 0); - } - } - - li h3 { - color: $footer-color; - font-size: 1em; - font-weight: 800; - margin-bottom: .4em; - } - - hr { - @include gridle_clear(both); - border: 1px solid transparentize($footer-disclaimer-color, .3); - margin: 0 auto $base-spacing; - width: 12em; - } - - p { - @include gridle_clear(both); - color: $footer-disclaimer-color; - font-size: .9em; - line-height: 1.5em; - margin: auto; - max-width: 35em; - text-align: center; - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_forms.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_forms.scss deleted file mode 100644 index dcffddec9..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_forms.scss +++ /dev/null @@ -1,156 +0,0 @@ -fieldset { - border: none; - margin: 0 0 ($base-spacing / 2) 0; - padding: $base-spacing; -} - -input,label, select { - display: block; - /* font-family: $form-font-family; - font-size: $form-font-size; */ -} - -label { - padding-top: $base-spacing / 3; - padding-bottom: $base-spacing / 3; - font-weight: bold; - margin-bottom: $base-spacing / 4; - - &.required:after { - content: "*"; - color: $red; - font-weight: 900; - } - - abbr { - display: none; - } - - // mark the label for empty placeholder - &[for$="_placeholder"] { - font-style: italic; - } -} - -.inline-choice { - white-space:nowrap; - display: inline-block; - - label { - white-space:normal; - display: inline; - line-height: 1 + ((2 * $base-spacing) / 3); - margin-right: 1em; - font-weight: normal; - } -} - -div.choice-widget-expanded { - margin-top: 0.5em; - margin-bottom: 0.5em; -} - -textarea, -//input, -#{$all-text-inputs}, -select[multiple=multiple] { - //@include box-sizing(border-box); - //@include transition(border-color); - background-color: white; - @include border-top-radius($form-border-radius); - @include border-bottom-radius($form-border-radius); - border: $form-border-size solid $form-border-color; - box-shadow: none; - //box-shadow: $form-box-shadow; - /*font-family: $form-font-family; - font-size: $form-font-size; */ - margin-bottom: $base-spacing / 4; - padding: ($base-spacing / 3) ($base-spacing / 3); - width: 100%; - - &:hover { - border-color: $form-border-color-hover; - } - - &:focus { - border-color: $form-border-color-focus; - box-shadow: $form-box-shadow-focus; - outline: none; - } -} - -textarea { - resize: vertical; -} - -input[type="search"] { - //@include appearance(none); -} - -input[type="checkbox"], -input[type="radio"] { - display: inline; - margin-right: $base-spacing / 4; -} - -input[type="file"] { - padding-bottom: $base-spacing / 2; - width: 100%; -} - -select { - margin-bottom: $base-spacing / 4; - padding-top: ($base-spacing / 5); - padding-bottom: ($base-spacing / 5); - width: 100%; -} - -form { - p { - &.tip { - font-size: .875em; - position: relative; - text-align: center; - margin-top: -.3em; - } - - &.label { - padding: 0; - //margin: 0; - //color: $text-color; - white-space: normal; - } - } - - fieldset { - border: none; - margin-bottom: 1.5em; - padding: 0; - margin: 0; - - legend { - font-size: 1.438em; - font-weight: 700; - width: 100%; - border-bottom: 3px solid #ddd; - margin-bottom: 1em; - - & + * { - -webkit-margin-top-collapse: separate; // webkit hack that makes the legend margins work like they should - } - - h2 { - margin-bottom: 0; - } - } - } - - li { - label { - display: inline-block; - } - } -} - -@import "../custom/modules/forms"; - diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_navigation.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_navigation.scss deleted file mode 100644 index 789707f6a..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_navigation.scss +++ /dev/null @@ -1,299 +0,0 @@ -.navigation { - //$navigation-nav-button-background: $base-accent-color; - //$navigation-nav-button-background-hover: lighten($navigation-background, 10); - //$navigation-nav-button-border: 1px solid lighten($navigation-nav-button-background, 20); - //$navigation-search-background: lighten($navigation-background, 5); - //$navigation-search-border: 1px solid darken($navigation-background, 5); - //$horizontal-bar-mode: $large-screen; - - background-color: $navigation-background; - border-bottom: $navigation-border-bottom; - height: $navigation-height; - //width: 100%; - z-index: 999; - - .logo-container { - height: $navigation-height; - - &:before { /* create a full-height inline block pseudo=element */ - content: ' '; - display: inline-block; - vertical-align: middle; /* vertical alignment of the inline element */ - height: 100%; - } - - img.logo { - max-width: 89%; - max-height: $navigation-height - 10px; - display: inline-block; - vertical-align: middle; - } - } - - // Nav menu - .nav { - z-index: 9999999; - height: $navigation-height; - //float: none; - } - - ul.navigation-menu { - -webkit-transform-style: preserve-3d; // stop webkit flicker - clear: both; - display: none; - margin: 0 auto; - overflow: visible; - padding: 0; - width: 100%; - z-index: 9999; - - //@include media ($horizontal-bar-mode) { - display: inline-block; - margin: 0; - padding: 0; - //} - } - - // The nav items - ul li.nav-link { - background: $navigation-background; - display: block; - line-height: $navigation-height; - overflow: hidden; - padding-right: .8em; - text-align: right; - width: 100%; - z-index: 9999; - - // @include media ($horizontal-bar-mode) { - background: transparent; - display: inline; - line-height: $navigation-height; - text-decoration: none; - width: auto; - // } - - a { - color: $navigation-color; - display: inline-block; - font-weight: 400; - - //@include media ($horizontal-bar-mode) { - padding-right: 1em; - //} - - &:hover { - color: $navigation-color-hover; - } - } - } - - .active-nav-item a { - border-bottom: 1px solid $navigation-active-link-color; - padding-bottom: 3px; - } - - // Sub menus - li.more.nav-link { - padding-right: 0; - - // @include media($large-screen) { - padding-right: $navigation-submenu-padding; - // } - - > ul > li:first-child a { - padding-top: $navigation-first-padding-top; - } - - a { - margin-right: $navigation-submenu-padding; - } - - > a { - padding-right: 0.6em; - } - - > a:after { - @include position(absolute, auto -.4em auto auto); - content: $navigation-more-pin; - color: $navigation-more-pin-color; - } - } - - li.more { - overflow: visible; - padding-right: 0; - - a { - padding-right: .8em; - } - - > a { - padding-right: 1.6em; - position: relative; - - //@include media($large-screen) { - margin-right: $navigation-submenu-padding; - //} - - &:after { - content: '›'; - font-size: 1.2em; - position: absolute; - right: $navigation-submenu-padding / 2; - } - } - - &:hover > .submenu { - display: block; - } - - //@include media($horizontal-bar-mode) { - padding-right: .8em; - position: relative; - //} - } - - ul.submenu { - display: none; - padding-left: $navigation-ul-submenu-padding-left; - //@include media($horizontal-bar-mode) { - left: -$navigation-submenu-padding; - position: absolute; - top: $navigation-ul-submenu-top; - //} - - .submenu { - //@include media($horizontal-bar-mode) { - left: $navigation-submenu-width - .2em; - top: 0; - //} - } - - li { - display: block; - padding-right: 0; - - //@include media($horizontal-bar-mode) { - line-height: $navigation-height / 1.3; - - &:first-child > a { - border-top-left-radius: $navigation-border-radius; - border-top-right-radius: $navigation-border-radius; - } - - &:last-child > a { - border-bottom-left-radius: $navigation-border-radius; - border-bottom-right-radius: $navigation-border-radius; - padding-bottom: $navigation-last-padding-bottom; - } - //} - - a { - background-color: darken($navigation-background, 3); - display: inline-block; - text-align: right; - width: 100%; - - //@include media($horizontal-bar-mode) { - background-color: $navigation-background; - padding-left: $navigation-submenu-padding; - text-align: left; - //width: $navigation-submenu-width; - //} - } - } - } - - // Elements on the far right - .navigation-search { - padding: $navigation-search-padding; - position: relative; - - input[type=search] { - //background: $navigation-search-background; - //border: $navigation-search-border; - padding: .6em .55em; - padding-right: 3.5em; - width: calc(100% - 4.5em); - //padding: .6em .8em; - //padding: 0 30px 0 10px; - font-size: .9em; - //color: $navigation-color; - //border-radius: $navigation-border-radius * 2; - margin: 0; - } - - button { - padding: 7px 12px; - position: absolute; - top: .99em; - right: 1em; - } - } - - ul li.nav-link2 { - position: relative; - padding-right: 2em; - text-align: left; - line-height: $navigation-height; - z-index: 9999; - float: left; - list-style: none; - - & div.li-content { - display: inline-block; - line-height: normal; - vertical-align: middle; - - a.more:after { - content: $navigation-more-pin; - color: $navigation-more-pin-color; - padding-left: 0.4em; - font-size: 1.2em; - } - } - - ul { - display: none; - position: absolute; - line-height: normal; - list-style: none; - background-color: #333; - padding-right: 1.5em; - padding-left: 1.5em; - width: 100%; - } - - ul { - li { - padding-top:0.7em; - padding-bottom:0.7em; - - &:first-child { - padding-top: $navigation-first-padding-top; - } - - &:last-child { - padding-bottom: $navigation-first-padding-top; - } - } - } - - &:hover ul { - display: block; - } - - a { - width: 100%; - color: $navigation-color; - font-weight: 400; - - &:hover { - color: $navigation-color-hover; - } - } - } -} - -@import "../custom/modules/navigation"; \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_table.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_table.scss deleted file mode 100644 index 14389580a..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_table.scss +++ /dev/null @@ -1,33 +0,0 @@ -table { - width: $table-width; - - thead { - background-color: $table-head-bg-color; - - tr th { - border: $table-head-td-border; - text-align: $table-head-td-text-align; - padding: $table-head-td-padding; - color: $table-head-text-color; - } - } - - tbody { - tr { - td { - border: $table-body-td-border; - text-align: $table-body-td-text-align; - padding: $table-body-td-padding; - color: $table-body-text-color; - } - - &:nth-of-type(even) { - background-color: $table-body-tr-bg-color-even; - } - - &:nth-of-type(odd) { - background-color: $table-body-tr-bg-color-odd; - } - } - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_tabs.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_tabs.scss deleted file mode 100644 index 2f57e0ae7..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_tabs.scss +++ /dev/null @@ -1,54 +0,0 @@ -/* Tabs */ -$navigation-color: $red; -$gutter : 4; -$norm: 5; -$body-font-color: $white; -$default-color: $green; -$global-bg-color: $yellow; - -.tab-nav { - margin: 0.5em 0; - padding: 0; - - > li { - font-family: $tabs-nav-font-family; - display: inline-block; - width: 100%; - cursor: default; - @include border-top-radius($base-border-radius); - @include border-bottom-radius($base-border-radius); - margin-bottom: $tabs-nav-margin-bottom; - - &.title { - padding: $tabs-nav-title-padding; - font-weight: 900; - background-color: $tabs-nav-title-bg-color; - color: $tabs-nav-title-text-color; - } - - &.sub-menu { - padding-left: 20px; - > a { - background-color: $tabs-nav-bg-color-light; - } - } - > a { - display: block; - width: auto; - padding: $tabs-nav-padding; - margin: 0; - color: $tabs-nav-text-color; - cursor: pointer; - border: $tabs-new-border; - background-color: $tabs-nav-bg-color; - @include border-top-radius($base-border-radius); - @include border-bottom-radius($base-border-radius); - - &:hover, &:active { - border: $tabs-nav-hover-border; - color: $tabs-nav-hover-text-color; - text-decoration: none; - } - } - } -} diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_typography.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_typography.scss deleted file mode 100644 index dce6d75a6..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/modules/_typography.scss +++ /dev/null @@ -1,23 +0,0 @@ -ul { - &.unstyled { - list-style: none; - padding-left: 0em; - - ul { - list-style:disc outside; - } - } -} - -a { - color: $base-link-color; - text-decoration: none; - - &:hover { - color: $hover-link-color; - } -} - -.text-right { - text-align: right; -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/scratch.scss b/src/Bundle/ChillMainBundle/Resources/public/module/scratch/scratch.scss deleted file mode 100644 index 78f9b393c..000000000 --- a/src/Bundle/ChillMainBundle/Resources/public/module/scratch/scratch.scss +++ /dev/null @@ -1,46 +0,0 @@ -@charset "UTF-8"; - -@import "contrib/normalize/normalize"; -@import "contrib/bourbon/bourbon"; - -@import "config/colors"; -@import "config/variables"; -@import "config/buttons"; - -/* etrange pour les forms */ -* { box-sizing: inherit; } -html { box-sizing: border-box; } - -@import "mixins/buttons"; -@import "mixins/alerts"; - -@import "contrib/gridle/gridle/gridle"; - -@include gridle_setup(( - context : 12, - gutter-width : 20px, - direction : ltr, -)); - -@include gridle_register_state(mobile , ( - max-width : 400px -)); - -@include gridle_register_state(tablet, ( - min-width : 401px, - max-width : 767px, -)); - -@include gridle_generate_classes(); - -@import "modules/typography"; -@import "modules/navigation"; -@import "modules/content"; -@import "modules/footer"; -@import "modules/alerts"; -@import "modules/forms"; -@import "modules/buttons"; -@import "modules/tabs"; -@import "modules/table"; - -@import "custom"; \ No newline at end of file From 97e8b3c9c14ab2e8ec1cb6cacf4e3a6ab17488a6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 09:56:15 +0200 Subject: [PATCH 042/191] fix yarn/webpack error when compiling (correction on commit 340310be626fd2d0870687d6bd1af7fe68d34ae0) --- src/Bundle/ChillMainBundle/Resources/public/chill/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js index dda7b7e67..d60ebdff8 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/index.js @@ -46,7 +46,6 @@ require('../lib/collection/index.js'); require('../lib/breadcrumb/index.js'); require('../lib/download-report/index.js'); require('../lib/select_interactive_loading/index.js'); -require('../lib/export-list/index.js'); //require('../lib/show_hide/index.js'); //require('../lib/tabs/index.js'); From bf0ca7b777e0931a78d98e70c44e400c3a657467 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 11:51:23 +0200 Subject: [PATCH 043/191] exports: fix logic in userScope and userJob filter --- .../Export/Filter/SocialIssueFilter.php | 6 ++- .../Export/Filter/UserJobFilter.php | 52 ++++++++----------- .../Export/Filter/UserScopeFilter.php | 46 ++++++++-------- .../translations/messages.fr.yml | 6 +-- 4 files changed, 48 insertions(+), 62 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php index b26e523eb..c6a031134 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -61,7 +61,9 @@ class SocialIssueFilter implements FilterInterface { $issues = []; - foreach ($data['accepted_socialissue'] as $i) { + $socialissues = $this->addParentIssues($data['accepted_socialissue']); + + foreach ($socialissues as $i) { if ('null' === $i) { $issues[] = $this->translator->trans('Not given'); } else { @@ -71,7 +73,7 @@ class SocialIssueFilter implements FilterInterface return [ 'Filtered by socialissues: only %socialissues%', [ - '%socialissues%' => implode(', ', $issues) + '%socialissues%' => implode(', ou ', $issues) ]]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php index a3fe907b1..d641d9a74 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php @@ -22,6 +22,7 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; class UserJobFilter implements FilterInterface @@ -31,6 +32,8 @@ class UserJobFilter implements FilterInterface */ protected $translator; + private Security $security; + /** * @var TranslatableStringHelper */ @@ -38,27 +41,22 @@ class UserJobFilter implements FilterInterface public function __construct( TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper + TranslatableStringHelper $translatableStringHelper, + Security $security ) { $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; + $this->security = $security; } public function describeAction($data, $format = 'string') { - $jobs = []; - - foreach ($data['accepted_userjob'] as $j) { - if ('null' === $j) { - $jobs[] = $this->translator->trans('Not given'); - } else { - $jobs[] = $this->translatableStringHelper->localize($j->getLabel()); - } - } - return [ - 'Filtered by user jobs: only %jobs%', - ['%jobs%' => implode(', ', $jobs)], + 'Filtered by user job: only %job%', [ + '%job%' => $this->translatableStringHelper->localize( + $this->getUserJob()->getLabel() + ) + ], ]; } @@ -69,13 +67,8 @@ class UserJobFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('acp.user', 'u') - ->join('u.userJob', 'j') - ; - $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('u.userJob', ':userjob'); + $clause = $qb->expr()->eq('acp.job', ':userjob'); if ($where instanceof Andx) { $where->add($clause); @@ -84,8 +77,7 @@ class UserJobFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('userjob', $data['accepted_userjob']); - + $qb->setParameter('userjob', $this->getUserJob()); } public function applyOn() @@ -95,20 +87,18 @@ class UserJobFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder - ->add('accepted_userjob', EntityType::class, [ - 'class' => UserJob::class, - 'choice_label' => function(UserJob $j) { - return $this->translatableStringHelper->localize($j->getLabel()); - }, - 'multiple' => true, - 'expanded' => true, - ]) - ; } public function getTitle() { return 'Filter by user job'; } + + private function getUserJob():UserJob + { + /** @var User $user */ + $user = $this->security->getUser(); + + return $user->getUserJob(); + } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php index f235d9b86..bc7a1b9d3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php @@ -21,6 +21,7 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; class UserScopeFilter implements FilterInterface @@ -30,6 +31,8 @@ class UserScopeFilter implements FilterInterface */ protected $translator; + private Security $security; + /** * @var TranslatableStringHelper */ @@ -37,27 +40,22 @@ class UserScopeFilter implements FilterInterface public function __construct( TranslatorInterface $translator, - TranslatableStringHelper $translatableStringHelper + TranslatableStringHelper $translatableStringHelper, + Security $security ) { $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; + $this->security = $security; } public function describeAction($data, $format = 'string') { - $scopes = []; - - foreach ($data['accepted_userscope'] as $s) { - if ('null' === $s) { - $scopes[] = $this->translator->trans('Not given'); - } else { - $scopes[] = $this->translatableStringHelper->localize($s->getName()); - } - } - return [ - 'Filtered by user scopes: only %scopes%', - ['%scopes%' => implode(', ', $scopes)], + 'Filtered by user main scope: only %scope%', [ + '%scope%' => $this->translatableStringHelper->localize( + $this->getUserMainScope()->getName() + ) + ] ]; } @@ -71,7 +69,7 @@ class UserScopeFilter implements FilterInterface $qb->join('acp.scopes', 's'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('s.id', ':userscope'); + $clause = $qb->expr()->eq('s.id', ':userscope'); if ($where instanceof Andx) { $where->add($clause); @@ -80,7 +78,7 @@ class UserScopeFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('userscope', $data['accepted_userscope']); + $qb->setParameter('userscope', $this->getUserMainScope()); } @@ -91,20 +89,18 @@ class UserScopeFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder - ->add('accepted_userscope', EntityType::class, [ - 'class' => Scope::class, - 'choice_label' => function(Scope $s) { - return $this->translatableStringHelper->localize($s->getName()); - }, - 'multiple' => true, - 'expanded' => true, - ]) - ; } public function getTitle() { return 'Filter by user scope'; } + + private function getUserMainScope():Scope + { + /** @var User $user */ + $user = $this->security->getUser(); + + return $user->getMainScope(); + } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 690936ae4..ed82fdae6 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -377,12 +377,10 @@ Having an accompanying period closed after this date: Ayant une période d'accom "Filtered by accompanying period: persons having an accompanying period closed between the %date_from% and %date_to%": "Filtrer par période d'accompagnement: ayant une période fermée entre le %date_from% et le %date_to%" Filter by user scope: Filtrer par service du référent -Accepted userscope: Services -"Filtered by user scopes: only %scopes%": "Filtré par service du référent: uniquement %scopes%" +"Filtered by user main scope: only %scope%": "Filtré par service du référent: uniquement %scope%" Filter by user job: Filtrer par métier du référent -Accepted userjob: Métiers -"Filtered by user jobs: only %jobs%": "Filtré par métier du référent: uniquement %jobs%" +"Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" Filter by social issue: Filtrer par problématiques sociales Accepted socialissue: Problématiques sociales From 04ca61be818b0f8effab5460a58e884e4e49a54d Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 12:35:35 +0200 Subject: [PATCH 044/191] rename data attribute --- .../Export/Filter/SocialIssueFilter.php | 10 +++++----- .../ChillPersonBundle/Export/Filter/StepFilter.php | 6 +++--- .../ChillPersonBundle/translations/messages.fr.yml | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php index c6a031134..27f01cb86 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -42,7 +42,7 @@ class SocialIssueFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_socialissue', EntityType::class, [ + $builder->add('accepted_socialissues', EntityType::class, [ 'class' => SocialIssue::class, 'choice_label' => function ($socialIssue) { return $this->socialIssueRender->renderString($socialIssue, []); @@ -61,7 +61,7 @@ class SocialIssueFilter implements FilterInterface { $issues = []; - $socialissues = $this->addParentIssues($data['accepted_socialissue']); + $socialissues = $this->addParentIssues($data['accepted_socialissues']); foreach ($socialissues as $i) { if ('null' === $i) { @@ -82,7 +82,7 @@ class SocialIssueFilter implements FilterInterface return null; } - public function alterQuery(QueryBuilder $qb, $data) + public function alterQuery(QueryBuilder $qb, $data): QueryBuilder { $qb->join('acp.socialIssues', 'si'); @@ -97,7 +97,7 @@ class SocialIssueFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('socialissues', - $this->addParentIssues($data['accepted_socialissue']) + $this->addParentIssues($data['accepted_socialissues']) ); } @@ -110,7 +110,7 @@ class SocialIssueFilter implements FilterInterface * @param $accepted_issues * @return array */ - private function addParentIssues($accepted_issues) + private function addParentIssues($accepted_issues): array { $array = []; foreach ($accepted_issues as $i) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php index ac47be949..e3fbc19d5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php @@ -37,7 +37,7 @@ class StepFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_step', ChoiceType::class, [ + $builder->add('accepted_steps', ChoiceType::class, [ 'choices' => self::STEPS, 'multiple' => false, 'expanded' => true, @@ -53,7 +53,7 @@ class StepFilter implements FilterInterface public function describeAction($data, $format = 'string') { - $step = array_flip(self::STEPS)[$data['accepted_step']]; + $step = array_flip(self::STEPS)[$data['accepted_steps']]; return ["Filtered by steps: only %step%", [ '%step%' => $this->translator->trans($step) @@ -77,7 +77,7 @@ class StepFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('step', $data['accepted_step']); + $qb->setParameter('step', $data['accepted_steps']); } public function applyOn() diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index ed82fdae6..8e532dd35 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -383,11 +383,11 @@ Filter by user job: Filtrer par métier du référent "Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" Filter by social issue: Filtrer par problématiques sociales -Accepted socialissue: Problématiques sociales +Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" Filter by step: Filtrer par statut du parcours -Accepted step: Statuts +Accepted steps: Statuts "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" ## aggregators From e56520f4b1297a0fc37728625750728d15aac185 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 12:36:22 +0200 Subject: [PATCH 045/191] exports: create origin filter --- .../Export/Filter/OriginFilter.php | 95 +++++++++++++++++++ .../config/services/exports.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 106 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php new file mode 100644 index 000000000..01cbdfb89 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php @@ -0,0 +1,95 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_origins', EntityType::class, [ + 'class' => Origin::class, + 'choice_label' => function (Origin $o) { + return $this->translatableStringHelper->localize($o->getLabel()); + }, + 'multiple' => false, + 'expanded' => true + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by origin'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by origins: only %origin%', [ + '%origin%' => $this->translatableStringHelper->localize( + $data['accepted_origins']->getLabel()) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.origin', ':origin'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('origin', $data['accepted_origins']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 2a02707ed..093b7315b 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -86,6 +86,13 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: accompanyingcourse_step_filter } + + chill.person.export.filter_origin: + class: Chill\PersonBundle\Export\Filter\OriginFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 8e532dd35..54fe34d1b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -390,6 +390,10 @@ Filter by step: Filtrer par statut du parcours Accepted steps: Statuts "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" +Filter by origin: Filtrer par origine du parcours +Accepted origins: Origines +"Filtered by origins: only %origin%": "Filtré par origine du parcours: uniquement %origin%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From 057617c1cbf145f3a6ffdc904c5e77e04875617f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 14:04:12 +0200 Subject: [PATCH 046/191] separate accompanying_period exports in yaml service definition --- .../ChillPersonExtension.php | 1 + .../config/services/exports.yaml | 50 +--------------- .../services/exports_accompanying_period.yaml | 57 ++++++++++++++++++- 3 files changed, 58 insertions(+), 50 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index d7037c1d2..e2e2fbc97 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -95,6 +95,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/doctrineEventListener.yaml'); $loader->load('services/accompanyingPeriodConsistency.yaml'); + // if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') { $loader->load('services/exports_accompanying_period.yaml'); } diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 093b7315b..f50674e19 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -1,4 +1,5 @@ services: + chill.person.export.count_person: class: Chill\PersonBundle\Export\Export\CountPerson arguments: @@ -26,20 +27,6 @@ services: tags: - { name: chill.export, alias: list_person_duplicate } - chill.person.export.count_accompanyingcourse: - class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse - arguments: - - "@doctrine.orm.entity_manager" - tags: - - { name: chill.export, alias: count_accompanyingcourse } - - chill.person.export.avg_accompanyingcourse_duration: - class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration - arguments: - - '@Chill\PersonBundle\Repository\AccompanyingPeriodRepository' - tags: - - { name: chill.export, alias: avg_accompanyingcourse_duration } - chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter arguments: @@ -58,41 +45,6 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_nationality_filter } - - chill.person.export.filter_userscope: - class: Chill\PersonBundle\Export\Filter\UserScopeFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } - - chill.person.export.filter_userjob: - class: Chill\PersonBundle\Export\Filter\UserJobFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } - - chill.person.export.filter_socialissue: - class: Chill\PersonBundle\Export\Filter\SocialIssueFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_socialissue_filter } - - chill.person.export.filter_step: - class: Chill\PersonBundle\Export\Filter\StepFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_step_filter } - - chill.person.export.filter_origin: - class: Chill\PersonBundle\Export\Filter\OriginFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 6126af6d6..36544abde 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -1,4 +1,6 @@ -services: +services: + + ## chill.person.export.filter_accompanying_period: class: Chill\PersonBundle\Export\Filter\AccompanyingPeriodFilter tags: @@ -13,3 +15,56 @@ services: class: Chill\PersonBundle\Export\Filter\AccompanyingPeriodClosingFilter tags: - { name: chill.export_filter, alias: person_acc_pe_cl_filter } + + ## Indicators + chill.person.export.count_accompanyingcourse: + class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_accompanyingcourse } + + chill.person.export.avg_accompanyingcourse_duration: + class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: avg_accompanyingcourse_duration } + + ## Filters + chill.person.export.filter_userscope: + class: Chill\PersonBundle\Export\Filter\UserScopeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } + + chill.person.export.filter_userjob: + class: Chill\PersonBundle\Export\Filter\UserJobFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } + + chill.person.export.filter_socialissue: + class: Chill\PersonBundle\Export\Filter\SocialIssueFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_socialissue_filter } + + chill.person.export.filter_step: + class: Chill\PersonBundle\Export\Filter\StepFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_step_filter } + + chill.person.export.filter_origin: + class: Chill\PersonBundle\Export\Filter\OriginFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } + + ## Aggregators \ No newline at end of file From ef5b3b24e4db9ab9e082b12eb660b85352d4e5e8 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 14:44:03 +0200 Subject: [PATCH 047/191] exports: create closingmotive filter --- .../Export/Filter/ClosingMotiveFilter.php | 95 +++++++++++++++++++ .../Export/Filter/SocialIssueFilter.php | 2 +- .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 4 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php new file mode 100644 index 000000000..b4fc3f94d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php @@ -0,0 +1,95 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_closingmotives', EntityType::class, [ + 'class' => ClosingMotive::class, + 'choice_label' => function (ClosingMotive $cm) { + return $this->translatableStringHelper->localize($cm->getName()); + }, + 'multiple' => false, + 'expanded' => false + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by closing motive'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + return [ + 'Filtered by closingmotive: only %closingmotive%', [ + '%closingmotive%' => $this->translatableStringHelper->localize( + $data['accepted_closingmotives']->getName()) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.closingMotive', ':closingmotive'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('closingmotive', $data['accepted_closingmotives']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php index 27f01cb86..092982d41 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialIssueFilter.php @@ -82,7 +82,7 @@ class SocialIssueFilter implements FilterInterface return null; } - public function alterQuery(QueryBuilder $qb, $data): QueryBuilder + public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acp.socialIssues', 'si'); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 36544abde..d34512220 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -67,4 +67,11 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } + chill.person.export.filter_closingmotive: + class: Chill\PersonBundle\Export\Filter\ClosingMotiveFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_closingmotive_filter } + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 54fe34d1b..51ca82ce6 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -394,6 +394,10 @@ Filter by origin: Filtrer par origine du parcours Accepted origins: Origines "Filtered by origins: only %origin%": "Filtré par origine du parcours: uniquement %origin%" +Filter by closing motive: Filtrer par motif de fermeture +Accepted closingmotives: Motifs de clôture +"Filtered by closingmotive: only %closingmotive%": "Filtré par motif de clôture: uniquement %closingmotive%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From 43bedc41a7cd228032a81de12faa2806c33c1f74 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 15:42:51 +0200 Subject: [PATCH 048/191] exports: create confidential filter --- .../Export/Filter/ConfidentialFilter.php | 87 +++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 6 ++ 3 files changed, 100 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php new file mode 100644 index 000000000..f33ce9c1e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php @@ -0,0 +1,87 @@ + false, + 'is confidential' => true, + ]; + + private CONST DEFAULT_CHOICE = false; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_confidentials', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Filter by confidential'; + } + + public function describeAction($data, $format = 'string'): array + { + dump($data, self::CHOICES); + //$choice = //array_flip(self::CHOICES)[$data['accepted_confidentials']]; + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_confidentials']) { + $choice = $k; + } + } + + return [ + 'Filtered by confidential: only %confidential%', [ + '%confidential%' => $this->translator->trans($choice) + ] + ]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.confidential', ':confidential'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('confidential', $data['accepted_confidentials']); + } + + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index d34512220..abaeffd8a 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -74,4 +74,11 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_closingmotive_filter } + chill.person.export.filter_confidential: + class: Chill\PersonBundle\Export\Filter\ConfidentialFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_confidential_filter } + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 51ca82ce6..75da040d0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -398,6 +398,12 @@ Filter by closing motive: Filtrer par motif de fermeture Accepted closingmotives: Motifs de clôture "Filtered by closingmotive: only %closingmotive%": "Filtré par motif de clôture: uniquement %closingmotive%" +Filter by confidential: Filtrer par confidentialité +Accepted confidentials: Choix possibles +is confidential: le parcours est confidentiel +is not confidential: le parcours n'est pas confidentiel +"Filtered by confidential: only %confidential%": "Filtré par confidentialité: uniquement si %confidential%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From ddac410b2e5be2db7542dc92f89c5d0d4baf3ce7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 16:19:54 +0200 Subject: [PATCH 049/191] exports: fix choice forms builder with multiple selections --- .../Export/Filter/ClosingMotiveFilter.php | 17 +++++++++++------ .../Export/Filter/OriginFilter.php | 15 ++++++++++----- .../Export/Filter/StepFilter.php | 18 +++++++++++------- .../translations/messages.fr.yml | 6 +++--- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php index b4fc3f94d..7ff78d41b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ClosingMotiveFilter.php @@ -34,8 +34,8 @@ class ClosingMotiveFilter implements FilterInterface 'choice_label' => function (ClosingMotive $cm) { return $this->translatableStringHelper->localize($cm->getName()); }, - 'multiple' => false, - 'expanded' => false + 'multiple' => true, + 'expanded' => true, ]); } @@ -52,10 +52,15 @@ class ClosingMotiveFilter implements FilterInterface */ public function describeAction($data, $format = 'string'): array { + $motives = []; + + foreach ($data['accepted_closingmotives'] as $k => $v) { + $motives[] = $this->translatableStringHelper->localize($v->getName()); + } + return [ - 'Filtered by closingmotive: only %closingmotive%', [ - '%closingmotive%' => $this->translatableStringHelper->localize( - $data['accepted_closingmotives']->getName()) + 'Filtered by closingmotive: only %closingmotives%', [ + '%closingmotives%' => implode(', ou ', $motives) ]]; } @@ -73,7 +78,7 @@ class ClosingMotiveFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('acp.closingMotive', ':closingmotive'); + $clause = $qb->expr()->in('acp.closingMotive', ':closingmotive'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php index 01cbdfb89..936767009 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/OriginFilter.php @@ -35,7 +35,7 @@ class OriginFilter implements FilterInterface 'choice_label' => function (Origin $o) { return $this->translatableStringHelper->localize($o->getLabel()); }, - 'multiple' => false, + 'multiple' => true, 'expanded' => true ]); } @@ -53,9 +53,14 @@ class OriginFilter implements FilterInterface */ public function describeAction($data, $format = 'string'): array { - return ['Filtered by origins: only %origin%', [ - '%origin%' => $this->translatableStringHelper->localize( - $data['accepted_origins']->getLabel()) + $origins = []; + + foreach ($data['accepted_origins'] as $v) { + $origins[] = $this->translatableStringHelper->localize($v->getLabel()); + } + + return ['Filtered by origins: only %origins%', [ + '%origins%' => implode(', ou ', $origins) ]]; } @@ -73,7 +78,7 @@ class OriginFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('acp.origin', ':origin'); + $clause = $qb->expr()->in('acp.origin', ':origin'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php index e3fbc19d5..98d496714 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php @@ -39,10 +39,8 @@ class StepFilter implements FilterInterface { $builder->add('accepted_steps', ChoiceType::class, [ 'choices' => self::STEPS, - 'multiple' => false, + 'multiple' => true, 'expanded' => true, - 'empty_data' => self::DEFAULT_CHOICE, - 'data' => self::DEFAULT_CHOICE, ]); } @@ -53,10 +51,16 @@ class StepFilter implements FilterInterface public function describeAction($data, $format = 'string') { - $step = array_flip(self::STEPS)[$data['accepted_steps']]; + $steps = []; - return ["Filtered by steps: only %step%", [ - '%step%' => $this->translator->trans($step) + foreach ($data['accepted_steps'] as $v) { + $steps[] = $this->translator->trans( + array_flip(self::STEPS)[$v] + ); + } + + return ["Filtered by steps: only %steps%", [ + '%steps%' => implode(', ou ', $steps) ]]; } @@ -68,7 +72,7 @@ class StepFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('acp.step', ':step'); + $clause = $qb->expr()->in('acp.step', ':step'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 75da040d0..c755126de 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -388,15 +388,15 @@ Accepted socialissues: Problématiques sociales Filter by step: Filtrer par statut du parcours Accepted steps: Statuts -"Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" +"Filtered by steps: only %steps%": "Filtré par statut du parcours: uniquement %steps%" Filter by origin: Filtrer par origine du parcours Accepted origins: Origines -"Filtered by origins: only %origin%": "Filtré par origine du parcours: uniquement %origin%" +"Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" Filter by closing motive: Filtrer par motif de fermeture Accepted closingmotives: Motifs de clôture -"Filtered by closingmotive: only %closingmotive%": "Filtré par motif de clôture: uniquement %closingmotive%" +"Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%" Filter by confidential: Filtrer par confidentialité Accepted confidentials: Choix possibles From da224ea4bc7f20e21d003b16cc232997edd277ca Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 16:35:11 +0200 Subject: [PATCH 050/191] exports: create emergency filter --- .../Export/Filter/ConfidentialFilter.php | 2 +- .../Export/Filter/EmergencyFilter.php | 87 +++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 8 +- 4 files changed, 102 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php index f33ce9c1e..7e043c131 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ConfidentialFilter.php @@ -45,7 +45,7 @@ class ConfidentialFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { dump($data, self::CHOICES); - //$choice = //array_flip(self::CHOICES)[$data['accepted_confidentials']]; + foreach (self::CHOICES as $k => $v) { if ($v === $data['accepted_confidentials']) { $choice = $k; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php new file mode 100644 index 000000000..4e292977a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php @@ -0,0 +1,87 @@ + false, + 'is emergency' => true, + ]; + + private CONST DEFAULT_CHOICE = false; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_emergencies', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Filter by emergency'; + } + + public function describeAction($data, $format = 'string'): array + { + dump($data, self::CHOICES); + + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_emergencies']) { + $choice = $k; + } + } + + return [ + 'Filtered by emergency: only %emergency%', [ + '%emergency%' => $this->translator->trans($choice) + ] + ]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.emergency', ':emergency'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('emergency', $data['accepted_emergencies']); + } + + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index abaeffd8a..ff79a1617 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -81,4 +81,11 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_confidential_filter } + chill.person.export.filter_emergency: + class: Chill\PersonBundle\Export\Filter\EmergencyFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_emergency_filter } + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index c755126de..1b6f96a9a 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -399,11 +399,17 @@ Accepted closingmotives: Motifs de clôture "Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%" Filter by confidential: Filtrer par confidentialité -Accepted confidentials: Choix possibles +Accepted confidentials: '' is confidential: le parcours est confidentiel is not confidential: le parcours n'est pas confidentiel "Filtered by confidential: only %confidential%": "Filtré par confidentialité: uniquement si %confidential%" +Filter by emergency: Filtrer par urgence +Accepted emergencies: '' +is emergency: le parcours est urgent +is not emergency: le parcours n'est pas urgent +"Filtered by emergency: only %emergency%": "Filtré par urgence: uniquement si %emergency%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From e728c00671140d889eca0a3e290a8243d56131e6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 16:49:57 +0200 Subject: [PATCH 051/191] exports: create intensity filter --- .../Export/Filter/EmergencyFilter.php | 2 - .../Export/Filter/IntensityFilter.php | 85 +++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 9 ++ 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/IntensityFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php index 4e292977a..f09d117f4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EmergencyFilter.php @@ -44,8 +44,6 @@ class EmergencyFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { - dump($data, self::CHOICES); - foreach (self::CHOICES as $k => $v) { if ($v === $data['accepted_emergencies']) { $choice = $k; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/IntensityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/IntensityFilter.php new file mode 100644 index 000000000..b55e7f399 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/IntensityFilter.php @@ -0,0 +1,85 @@ + 'occasional', + 'is regular' => 'regular', + ]; + + private CONST DEFAULT_CHOICE = 'occasional'; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_intensities', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Filter by intensity'; + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_intensities']) { + $choice = $k; + } + } + + return [ + 'Filtered by intensity: only %intensity%', [ + '%intensity%' => $this->translator->trans($choice) + ] + ]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('acp.intensity', ':intensity'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('intensity', $data['accepted_intensities']); + } + + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index ff79a1617..72fa1ad80 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -88,4 +88,11 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_emergency_filter } + chill.person.export.filter_intensity: + class: Chill\PersonBundle\Export\Filter\IntensityFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 1b6f96a9a..288793af0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -410,6 +410,15 @@ is emergency: le parcours est urgent is not emergency: le parcours n'est pas urgent "Filtered by emergency: only %emergency%": "Filtré par urgence: uniquement si %emergency%" +Filter by intensity: Filtrer par intensité +Accepted intensities: '' +is occasional: le parcours est ponctuel +is regular: le parcours est régulier +"Filtered by intensity: only %intensity%": "Filtré par intensité: uniquement si %intensity%" + + + + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From ef827a132254ac889e8e9330d77256669dd1bb42 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 25 Jul 2022 18:24:24 +0200 Subject: [PATCH 052/191] revert stepFilter to uniq selection (cfr ddac410b2e5be2db7542dc92f89c5d0d4baf3ce7) --- .../Export/Filter/StepFilter.php | 18 +++++++----------- .../translations/messages.fr.yml | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php index 98d496714..e3fbc19d5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/StepFilter.php @@ -39,8 +39,10 @@ class StepFilter implements FilterInterface { $builder->add('accepted_steps', ChoiceType::class, [ 'choices' => self::STEPS, - 'multiple' => true, + 'multiple' => false, 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, ]); } @@ -51,16 +53,10 @@ class StepFilter implements FilterInterface public function describeAction($data, $format = 'string') { - $steps = []; + $step = array_flip(self::STEPS)[$data['accepted_steps']]; - foreach ($data['accepted_steps'] as $v) { - $steps[] = $this->translator->trans( - array_flip(self::STEPS)[$v] - ); - } - - return ["Filtered by steps: only %steps%", [ - '%steps%' => implode(', ou ', $steps) + return ["Filtered by steps: only %step%", [ + '%step%' => $this->translator->trans($step) ]]; } @@ -72,7 +68,7 @@ class StepFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('acp.step', ':step'); + $clause = $qb->expr()->eq('acp.step', ':step'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 288793af0..4c5ca1dcf 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -388,7 +388,7 @@ Accepted socialissues: Problématiques sociales Filter by step: Filtrer par statut du parcours Accepted steps: Statuts -"Filtered by steps: only %steps%": "Filtré par statut du parcours: uniquement %steps%" +"Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" Filter by origin: Filtrer par origine du parcours Accepted origins: Origines From a06a2c9592f65e742cc7e06d06ae4f4af27f73de Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 10:41:24 +0200 Subject: [PATCH 053/191] start of social actions export --- .../ChillPersonBundle/Export/Declarations.php | 2 + .../Export/Export/CountSocialActions.php | 107 ++++++++++++++++++ .../SocialWork/SocialActionRepository.php | 6 + .../config/services/exports.yaml | 25 ++-- .../translations/messages.fr.yml | 2 + 5 files changed, 132 insertions(+), 10 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index bb892a69c..8cc82e7ea 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -21,4 +21,6 @@ abstract class Declarations public const PERSON_TYPE = 'person'; public const ACP_TYPE = 'accompanying_period'; + + public const SOCIAL_ACTION_TYPE = 'social_actions'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php new file mode 100644 index 000000000..b9c2dd746 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php @@ -0,0 +1,107 @@ +socialActionRepository = $socialActionRepository; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // TODO: Implement buildForm() method. + } + + public function getTitle(): string + { + return 'Count social actions'; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'Count social actions by various parameters'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_count_social_actions' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + $labels = array_combine($values, $values); + $labels['_header'] = $this->getTitle(); + + return static function ($value) use ($labels) { + return $labels[$value]; + }; + } + + public function getQueryKeys($data): array + { + return ['export_count_social_actions']; + } + + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::SOCIAL_ACTION_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $qb = $this + ->socialActionRepository + ->createQueryBuilder('sa') + ->select('COUNT(sa.id) as export_count_social_actions'); + + return $qb; + } + + public function requiredRole(): string + { + return AccompanyingPeriodVoter::STATS; + } + + public function supportsModifiers(): array + { + return [Declarations::SOCIAL_ACTION_TYPE]; + } + + public function getGroup(): string + { + return 'Exports of social actions'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php index fdf9d3b3f..4d9597f83 100644 --- a/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/SocialWork/SocialActionRepository.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Repository\SocialWork; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; final class SocialActionRepository implements ObjectRepository @@ -25,6 +26,11 @@ final class SocialActionRepository implements ObjectRepository $this->repository = $entityManager->getRepository(SocialAction::class); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id, ?int $lockMode = null, ?int $lockVersion = null): ?SocialAction { return $this->repository->find($id, $lockMode, $lockVersion); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 4cf752870..9c5638431 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -27,18 +27,23 @@ services: - { name: chill.export, alias: list_person_duplicate } chill.person.export.count_accompanyingcourse: - class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse - arguments: - - "@doctrine.orm.entity_manager" - tags: - - { name: chill.export, alias: count_accompanyingcourse } + class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse + arguments: + - "@doctrine.orm.entity_manager" + tags: + - { name: chill.export, alias: count_accompanyingcourse } chill.person.export.avg_accompanyingcourse_duration: - class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration - arguments: - - '@Chill\PersonBundle\Repository\AccompanyingPeriodRepository' - tags: - - { name: chill.export, alias: avg_accompanyingcourse_duration } + class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration + arguments: + - '@Chill\PersonBundle\Repository\AccompanyingPeriodRepository' + tags: + - { name: chill.export, alias: avg_accompanyingcourse_duration } + + chill.person.export.count_social_actions: + class: Chill\PersonBundle\Export\Export\CountSocialActions + autowire: true + autoconfigure: true chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 122571198..c764817b3 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -340,7 +340,9 @@ Create a list of duplicate people: Créer la liste des personnes détectées com Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours +Count social actions: Nombre d'actions d'accompagnement Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres. +Count social actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. Accompanying courses duration: Durée moyenne des parcours Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré From 5ba8c4babc6d993e61eb5089ef66abbe7263d4f7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 11:22:17 +0200 Subject: [PATCH 054/191] fixes to make count social actions export work --- .../Export/Export/CountSocialActions.php | 8 +++++--- src/Bundle/ChillPersonBundle/config/services/exports.yaml | 2 ++ src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php index b9c2dd746..a41f4a6d2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php @@ -21,8 +21,9 @@ use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use LogicException; +use Symfony\Component\Security\Core\Role\Role; -class CountSocialAction implements ExportInterface, GroupedExportInterface +class CountSocialActions implements ExportInterface, GroupedExportInterface { protected SocialActionRepository $socialActionRepository; @@ -90,9 +91,10 @@ class CountSocialAction implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole(): string + public function requiredRole(): Role { - return AccompanyingPeriodVoter::STATS; + //TODO change to string, but changes needed also in exportManager and possibly other locations. + return new Role(AccompanyingPeriodVoter::STATS); } public function supportsModifiers(): array diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index 9c5638431..4780a9aad 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -44,6 +44,8 @@ services: class: Chill\PersonBundle\Export\Export\CountSocialActions autowire: true autoconfigure: true + tags: + - { name: chill.export, alias: count_social_actions } chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index c764817b3..af7c213b4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -340,7 +340,7 @@ Create a list of duplicate people: Créer la liste des personnes détectées com Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours -Count social actions: Nombre d'actions d'accompagnement +Count social actions: Nombre d'actions Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres. Count social actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. Accompanying courses duration: Durée moyenne des parcours From 9798cb8a0934a8621cbad52a1135fdf39c8bd074 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 26 Jul 2022 11:41:16 +0200 Subject: [PATCH 055/191] due to excel limit, title can not exceed 31 characters --- .../ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php index a2bce1201..86c304508 100644 --- a/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php +++ b/src/Bundle/ChillMainBundle/Export/Formatter/SpreadSheetFormatter.php @@ -449,7 +449,9 @@ class SpreadSheetFormatter implements FormatterInterface protected function getTitle() { - return $this->translator->trans($this->export->getTitle()); + $title = $this->translator->trans($this->export->getTitle()); + + return substr($title, 0, 30) . '…'; } protected function initializeCache($key) From 5f329101e1c6f9ad8045981c28fbf1f9fb96a0c8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 11:44:20 +0200 Subject: [PATCH 056/191] title changed back to longer version --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index af7c213b4..15ec509a8 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -340,13 +340,15 @@ Create a list of duplicate people: Créer la liste des personnes détectées com Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours -Count social actions: Nombre d'actions Count accompanying courses by various parameters: Compte le nombre de parcours en fonction de différents filtres. -Count social actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. Accompanying courses duration: Durée moyenne des parcours Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré +Exports of social actions: Exports des actions d'accompangement +Count social actions: Nombre d'actions d'accompagnement +Count social actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. + ## filters Filter by person gender: Filtrer par genre de la personne Accepted genders: Genres acceptés From b12e5e78b6b2fc4422ec9909aa22ff879f1b33e6 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 13:18:15 +0200 Subject: [PATCH 057/191] reorganize into separate config file --- .../DependencyInjection/ChillPersonExtension.php | 2 +- src/Bundle/ChillPersonBundle/config/services/exports.yaml | 7 ------- .../config/services/exports_social_actions.yaml | 7 +++++++ 3 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index e2e2fbc97..e5b5b4e10 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -76,6 +76,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services.yaml'); $loader->load('services/widgets.yaml'); $loader->load('services/exports.yaml'); + $loader->load('services/exports_social_actions.yaml'); $loader->load('services/fixtures.yaml'); $loader->load('services/controller.yaml'); $loader->load('services/search.yaml'); @@ -95,7 +96,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/doctrineEventListener.yaml'); $loader->load('services/accompanyingPeriodConsistency.yaml'); - // if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') { $loader->load('services/exports_accompanying_period.yaml'); } diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index a946905c9..f50674e19 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -26,13 +26,6 @@ services: - '%chill_main.notifications%' tags: - { name: chill.export, alias: list_person_duplicate } - - chill.person.export.count_social_actions: - class: Chill\PersonBundle\Export\Export\CountSocialActions - autowire: true - autoconfigure: true - tags: - - { name: chill.export, alias: count_social_actions } chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml new file mode 100644 index 000000000..1892e9962 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -0,0 +1,7 @@ +services: + chill.person.export.count_social_actions: + class: Chill\PersonBundle\Export\Export\CountSocialActions + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_social_actions } \ No newline at end of file From d5d38053cd036bac44e9533def2114dd7a0b123f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 14:43:21 +0200 Subject: [PATCH 058/191] renaming of export to avoid confusion + start of agent traitant filter --- .../ChillPersonBundle/Export/Declarations.php | 2 +- ...Actions.php => CountSocialWorkActions.php} | 30 ++++---- .../Export/Filter/ReferrerFilter.php | 77 +++++++++++++++++++ .../AccompanyingPeriodWorkRepository.php | 5 ++ .../services/exports_social_actions.yaml | 14 +++- .../translations/messages.fr.yml | 6 +- 6 files changed, 112 insertions(+), 22 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Export/{CountSocialActions.php => CountSocialWorkActions.php} (70%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index 8cc82e7ea..dc5c3f971 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -22,5 +22,5 @@ abstract class Declarations public const ACP_TYPE = 'accompanying_period'; - public const SOCIAL_ACTION_TYPE = 'social_actions'; + public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php similarity index 70% rename from src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php rename to src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index a41f4a6d2..a7086271a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -15,7 +15,7 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations; -use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; +use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; @@ -23,23 +23,23 @@ use Symfony\Component\Form\FormBuilderInterface; use LogicException; use Symfony\Component\Security\Core\Role\Role; -class CountSocialActions implements ExportInterface, GroupedExportInterface +class CountSocialWorkActions implements ExportInterface, GroupedExportInterface { - protected SocialActionRepository $socialActionRepository; + protected AccompanyingPeriodWorkRepository $socialActionRepository; - public function __construct(SocialActionRepository $socialActionRepository) + public function __construct(AccompanyingPeriodWorkRepository $socialActionRepository) { $this->socialActionRepository = $socialActionRepository; } public function buildForm(FormBuilderInterface $builder): void { - // TODO: Implement buildForm() method. + // No form necessary? } public function getTitle(): string { - return 'Count social actions'; + return 'Count social work actions'; } public function getAllowedFormattersTypes(): array @@ -49,12 +49,12 @@ class CountSocialActions implements ExportInterface, GroupedExportInterface public function getDescription(): string { - return 'Count social actions by various parameters'; + return 'Count social work actions by various parameters'; } public function getLabels($key, array $values, $data) { - if ('export_count_social_actions' !== $key) { + if ('export_count_social_work_actions' !== $key) { throw new LogicException("the key {$key} is not used by this export"); } @@ -68,7 +68,7 @@ class CountSocialActions implements ExportInterface, GroupedExportInterface public function getQueryKeys($data): array { - return ['export_count_social_actions']; + return ['export_count_social_work_actions']; } public function getResult($qb, $data) @@ -78,32 +78,32 @@ class CountSocialActions implements ExportInterface, GroupedExportInterface public function getType(): string { - return Declarations::SOCIAL_ACTION_TYPE; + return Declarations::SOCIAL_WORK_ACTION_TYPE; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { $qb = $this ->socialActionRepository - ->createQueryBuilder('sa') - ->select('COUNT(sa.id) as export_count_social_actions'); + ->createQueryBuilder('acpw') + ->select('COUNT(acpw.id) as export_count_social_work_actions'); return $qb; } public function requiredRole(): Role { - //TODO change to string, but changes needed also in exportManager and possibly other locations. + //TODO change to string, but changes needed also in ExportManager and possibly other locations. return new Role(AccompanyingPeriodVoter::STATS); } public function supportsModifiers(): array { - return [Declarations::SOCIAL_ACTION_TYPE]; + return [Declarations::SOCIAL_WORK_ACTION_TYPE]; } public function getGroup(): string { - return 'Exports of social actions'; + return 'Exports of social work actions'; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php new file mode 100644 index 000000000..678feee80 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -0,0 +1,77 @@ +userRender = $userRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('users', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function getTitle(): string + { + return 'Filter by referrers'; + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['users'] as $u) { + $users[] = $u->getUsername(); + } + + return ['Filtered by users: only %users%', [ + '%user%' => implode(', ou ', $users) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('acpw.referrers', ':users'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('users', $data['users']); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php index dd27cf434..c2826485e 100644 --- a/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/AccompanyingPeriod/AccompanyingPeriodWorkRepository.php @@ -35,6 +35,11 @@ final class AccompanyingPeriodWorkRepository implements ObjectRepository $this->repository = $entityManager->getRepository(AccompanyingPeriodWork::class); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function countByAccompanyingPeriod(AccompanyingPeriod $period): int { return $this->repository->countByAccompanyingPeriod($period); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 1892e9962..8936af9b9 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -1,7 +1,15 @@ services: - chill.person.export.count_social_actions: - class: Chill\PersonBundle\Export\Export\CountSocialActions + + chill.person.export.count_social_work_actions: + class: Chill\PersonBundle\Export\Export\CountSocialWorkActions autowire: true autoconfigure: true tags: - - { name: chill.export, alias: count_social_actions } \ No newline at end of file + - { name: chill.export, alias: count_social_work_actions } + + chill.person.export.filter_referrers: + class: Chill\PersonBundle\Export\Filter\ReferrerFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_actions_referrer_filter } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 616f02366..ca7a27e1c 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -345,9 +345,9 @@ Accompanying courses duration: Durée moyenne des parcours Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré -Exports of social actions: Exports des actions d'accompangement -Count social actions: Nombre d'actions d'accompagnement -Count social actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. +Exports of social work actions: Exports des actions d'accompangement +Count social work actions: Nombre d'actions d'accompagnement +Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. ## filters Filter by person gender: Filtrer par genre de la personne From cb42b68c33e538505e89cb1fcc288cc0c8210e95 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 26 Jul 2022 15:46:16 +0200 Subject: [PATCH 059/191] filter for agents traitants --- .../Export/Filter/ReferrerFilter.php | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php index 678feee80..d79027035 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -22,10 +22,10 @@ class ReferrerFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('users', EntityType::class, [ + $builder->add('referrers', EntityType::class, [ 'class' => User::class, 'choice_label' => function (User $u) { - $this->userRender->renderString($u, []); + return $this->userRender->renderString($u, []); }, 'multiple' => true, 'expanded' => true @@ -39,14 +39,14 @@ class ReferrerFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { - $users = []; + $referrers = []; - foreach ($data['users'] as $u) { - $users[] = $u->getUsername(); + foreach ($data['referrers'] as $r) { + $referrers[] = $this->userRender->renderString($r, []); } - return ['Filtered by users: only %users%', [ - '%user%' => implode(', ou ', $users) + return ['Filtered by referrers: only %referrers%', [ + '%referrers%' => implode(', ou ', $referrers) ]]; } @@ -57,8 +57,10 @@ class ReferrerFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { + $qb->join('acpw.referrers', 'r'); + $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('acpw.referrers', ':users'); + $clause = $qb->expr()->in('r', ':referrers'); if ($where instanceof Andx) { $where->add($clause); @@ -67,7 +69,7 @@ class ReferrerFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('users', $data['users']); + $qb->setParameter('referrers', $data['referrers']); } public function applyOn(): string From 232cf96cb2ab5f579c2804690344f8499ef00f10 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 27 Jul 2022 10:39:09 +0200 Subject: [PATCH 060/191] tests: write a simple Filter test for EmergencyFilter --- .../Export/Filter/EmergencyFilterTest.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php new file mode 100644 index 000000000..80b4be149 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php @@ -0,0 +1,55 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_emergency'); + } + + public function getFilter() + { + return $this->filter; + } + + public function getFormData() + { + return [ + ['accepted_emergencies' => true], + ['accepted_emergencies' => false] + ]; + } + + public function getQueryBuilders() + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file From 3dabd031f4b04d5c37321676b43342a25478acaf Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 26 Jul 2022 20:42:35 +0200 Subject: [PATCH 061/191] fix tests failed in exports --- .../ChillMainBundle/Test/Export/AbstractAggregatorTest.php | 1 + src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php | 3 +++ .../ChillPersonBundle/Tests/Export/Export/CountPersonTest.php | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php index 1a91d4629..cf5fe5c31 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractAggregatorTest.php @@ -166,6 +166,7 @@ abstract class AbstractAggregatorTest extends KernelTestCase $this->assertContainsOnly( 'string', $queryKeys, + true, 'test that the query keys returned by `getQueryKeys` are only strings' ); $this->assertGreaterThanOrEqual( diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index d7da05aa7..a80753a46 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -140,6 +140,7 @@ abstract class AbstractExportTest extends WebTestCase $this->assertContainsOnly( 'string', $formattersTypes, + true, 'Test that the method `getAllowedFormattersTypes` returns an array of string' ); } @@ -174,6 +175,7 @@ abstract class AbstractExportTest extends WebTestCase $this->assertContainsOnly( 'string', $queryKeys, + true, 'test that the query keys returned by `getQueryKeys` are only strings' ); $this->assertGreaterThanOrEqual( @@ -395,6 +397,7 @@ abstract class AbstractExportTest extends WebTestCase $this->assertContainsOnly( 'string', $export->supportsModifiers(), + true, 'Test that the `supportsModifiers` method returns only strings' ); } elseif ($query instanceof NativeQuery) { diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php index 831de2933..fe7d91753 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountPersonTest.php @@ -30,7 +30,7 @@ final class CountPersonTest extends AbstractExportTest { self::bootKernel(); - $this->export = self::$container->get('chill.person.export.export_count_person'); + $this->export = self::$container->get('chill.person.export.count_person'); } public function getExport() From 8bbca124879adb93e11b186eaec9651a8fc067c1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 27 Jul 2022 12:11:51 +0200 Subject: [PATCH 062/191] fix ProphecyTrait in AbstractFilter to use it with each filter --- .../ChillMainBundle/Test/Export/AbstractFilterTest.php | 7 +++++-- .../Tests/Export/Filter/EmergencyFilterTest.php | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index 4355687e1..34869c30b 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -13,6 +13,7 @@ namespace Chill\MainBundle\Test\Export; use Doctrine\ORM\QueryBuilder; use Exception; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use function count; @@ -27,14 +28,16 @@ use function is_string; */ abstract class AbstractFilterTest extends KernelTestCase { + use ProphecyTrait; + /** * @var \Prophecy\Prophet */ - protected $prophet; + private $prophet; protected function setUp(): void { - $this->prepareProphet(); + $$this->prophet = $this->getProphet(); } public function dataProviderAlterQuery() diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php index 80b4be149..0a0f2ae86 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php @@ -14,11 +14,9 @@ class EmergencyFilterTest extends AbstractFilterTest self::bootKernel(); // add a fake request with a default locale (used in translatable string) - $prophet = new \Prophecy\Prophet(); - $request = $prophet->prophesize(); + $request = $this->prophesize(); $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); - $request->getLocale()->willReturn('fr'); $this->filter = self::$container->get('chill.person.export.filter_emergency'); From 287d8f546b26e99b4d83b3fcdf9b0eb4d68c2260 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 26 Jul 2022 17:53:53 +0200 Subject: [PATCH 063/191] add simple test file for each new filter --- .../Export/Filter/ClosingMotiveFilterTest.php | 75 +++++++++++++++++ .../Export/Filter/ConfidentialFilterTest.php | 63 ++++++++++++++ .../Export/Filter/EmergencyFilterTest.php | 7 +- .../Export/Filter/IntensityFilterTest.php | 63 ++++++++++++++ .../Tests/Export/Filter/OriginFilterTest.php | 75 +++++++++++++++++ .../Export/Filter/SocialIssueFilterTest.php | 82 +++++++++++-------- .../Tests/Export/Filter/StepFilterTest.php | 64 +++++++++++++++ .../Tests/Export/Filter/UserJobFilterTest.php | 60 ++++++++++++++ .../Export/Filter/UserScopeFilterTest.php | 61 ++++++++++++++ 9 files changed, 512 insertions(+), 38 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php new file mode 100644 index 000000000..cbfa1c306 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ClosingMotiveFilterTest.php @@ -0,0 +1,75 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_closingmotive'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(ClosingMotive::class, 'm') + ->select('m') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $m) { + $data[] = ['accepted_closingmotives' => $m]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php new file mode 100644 index 000000000..1d8573916 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ConfidentialFilterTest.php @@ -0,0 +1,63 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_confidential'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + ['accepted_confidentials' => true], + ['accepted_confidentials' => false] + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php index 0a0f2ae86..0533a604a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EmergencyFilterTest.php @@ -4,6 +4,7 @@ namespace Chill\PersonBundle\Tests\Export\Filter; use Chill\MainBundle\Test\Export\AbstractFilterTest; use Chill\PersonBundle\Export\Filter\EmergencyFilter; +use Doctrine\ORM\EntityManagerInterface; class EmergencyFilterTest extends AbstractFilterTest { @@ -27,7 +28,7 @@ class EmergencyFilterTest extends AbstractFilterTest return $this->filter; } - public function getFormData() + public function getFormData(): array { return [ ['accepted_emergencies' => true], @@ -35,14 +36,14 @@ class EmergencyFilterTest extends AbstractFilterTest ]; } - public function getQueryBuilders() + public function getQueryBuilders(): array { if (null === self::$kernel) { self::bootKernel(); } - $em = self::$container->get('doctrine.orm.entity_manager'); + $em = self::$container->get(EntityManagerInterface::class); return [ $em->createQueryBuilder() diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php new file mode 100644 index 000000000..c39602cf8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/IntensityFilterTest.php @@ -0,0 +1,63 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_intensity'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + ['accepted_intensities' => 'occasional'], + ['accepted_intensities' => 'regular'] + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php new file mode 100644 index 000000000..7aa1f1c7a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OriginFilterTest.php @@ -0,0 +1,75 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_origin'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(Origin::class, 'o') + ->select('o') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $l) { + $data[] = ['accepted_origins' => $l]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php index ed520e90b..ac092884b 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialIssueFilterTest.php @@ -1,63 +1,75 @@ filter = self::$container->get('chill.person.export.filter_socialissue'); - } catch (ServiceNotFoundException $e) { - $this->markTestSkipped('Filter service is not found'); - } + // add a fake request with a default locale (used in translatable string) + $request = $this->prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_socialissue'); } + /** + * @inheritDoc + */ public function getFilter() { return $this->filter; } - public function getFormData() + /** + * @inheritDoc + */ + public function getFormData(): array { - return [ - ['accepted_socialissue' => [ + $em = self::$container->get(EntityManagerInterface::class); - ]], - ['accepted_socialissue' => [ + $array = $em->createQueryBuilder() + ->from(SocialIssue::class, 'si') + ->select('si') + ->getQuery() + ->getResult(); - ]], - ['accepted_socialissue' => [ + $data = []; - ]], - ]; + foreach($array as $i) { + $data[] = ['accepted_socialissues' => $i]; + } + + return $data; } - public function getQueryBuilders() + /** + * @inheritDoc + */ + public function getQueryBuilders(): array { - // TODO: Implement getQueryBuilders() method. - } + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php new file mode 100644 index 000000000..1a8dfd2ff --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/StepFilterTest.php @@ -0,0 +1,64 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_step'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + ['accepted_steps' => AccompanyingPeriod::STEP_DRAFT], + ['accepted_steps' => AccompanyingPeriod::STEP_CONFIRMED], + ['accepted_steps' => AccompanyingPeriod::STEP_CLOSED], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php new file mode 100644 index 000000000..452728384 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserJobFilterTest.php @@ -0,0 +1,60 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_userjob'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return []; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php new file mode 100644 index 000000000..fd22ded6e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/UserScopeFilterTest.php @@ -0,0 +1,61 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_userscope'); + + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return []; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acp.id') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp'), + ]; + } +} \ No newline at end of file From ab2b2bc235975fef31e0c6d7f82d6c1fc062c3c0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 15:50:56 +0200 Subject: [PATCH 064/191] some advancements on dynamic socialaction filter --- .../Export/Filter/SocialWorkTypeFilter.php | 227 ++++++++++++++++++ .../services/exports_social_actions.yaml | 9 +- 2 files changed, 235 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php new file mode 100644 index 000000000..8f8d70349 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php @@ -0,0 +1,227 @@ +socialActionRender = $socialActionRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + /** + * EXAMPLE CODE TO INSPIRE + */ + // parent::buildForm($builder, $options); + // //other fields + + // $builder->add('country', 'entity', array( + // 'class' => 'Orfos\CoreBundle\Entity\Country', + // 'property' => $locale . 'name', + // 'label' => 'register.country.label', + // 'query_builder' => function(EntityRepository $er) { + // return $er->createQueryBuilder('c') + // ->select('c', 't') + // ->join('c.translations', 't'); + // }, + // )); + + // $factory = $builder->getFormFactory(); + // $refreshRegion = function ($form, $country) use ($factory, $locale) { + // $form->add($factory->createNamed('entity', 'region', null, array( + // 'class' => 'Orfos\CoreBundle\Entity\Region', + // 'property' => $locale . 'name', + // 'label' => 'register.region.label', + // 'query_builder' => function (EntityRepository $repository) use ($country) { + // $qb = $repository->createQueryBuilder('region') + // ->select('region', 'translation') + // ->innerJoin('region.country', 'country') + // ->join('region.translations', 'translation'); + + // if ($country instanceof Country) { + // $qb = $qb->where('region.country = :country') + // ->setParameter('country', $country); + // } elseif (is_numeric($country)) { + // $qb = $qb->where('country.id = :country_id') + // ->setParameter('country_id', $country); + // } else { + // $qb = $qb->where('country.id = 1'); + // } + + // return $qb; + // } + // ))); + // }; + // $factory = $builder->getFormFactory(); + // $refreshCity = function($form, $region) use ($factory, $locale) { + // $form->add($factory->createNamed('entity', 'city', null, array( + // 'class' => 'Orfos\CoreBundle\Entity\City', + // 'property' => $locale . 'name', + // 'label' => 'register.city.label', + // 'query_builder' => function (EntityRepository $repository) use ($region) { + // $qb = $repository->createQueryBuilder('city') + // ->select('city', 'translation') + // ->innerJoin('city.region', 'region') + // ->innerJoin('city.translations', 'translation'); + + // if ($region instanceof Region) { + // $qb = $qb->where('city.region = :region') + // ->setParameter('region', $region); + // } elseif (is_numeric($region)) { + // $qb = $qb->where('region.id = :region_id') + // ->setParameter('region_id', $region); + // } else { + // $qb = $qb->where('region.id = 1'); + // } + + // return $qb; + // } + // ))); + // }; + + // $builder->addEventListener(FormEvents::PRE_SET_DATA, function (DataEvent $event) use ($refreshRegion, $refreshCity) { + // $form = $event->getForm(); + // $data = $event->getData(); + + // if ($data == null){ + // $refreshRegion($form, null); + // $refreshCity($form, null); + // } + + // if ($data instanceof Country) { + // $refreshRegion($form, $data->getCountry()->getRegions()); + // $refreshCity($form, $data->getRegion()->getCities()); + // } + // }); + + // $builder->addEventListener(FormEvents::PRE_BIND, function (DataEvent $event) use ($refreshRegion, $refreshCity) { + // $form = $event->getForm(); + // $data = $event->getData(); + + // if (array_key_exists('country', $data)) { + // $refreshRegion($form, $data['country']); + // } + // if (array_key_exists('region', $data)) { + // $refreshCity($form, $data['region']); + // } + // }); + + + $builder->add('actionType', EntityType::class, [ + 'class' => SocialAction::class, + 'choice_label' => function (SocialAction $sa) { + return $this->socialActionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + + $refreshGoals = function ($form, $actionType) { + $form->add('goal', EntityType::class, [ + 'class' => Goal::class, + 'choice_label' => function (Goal $g) { + return $g->getTitle(); + }, + 'query_builder' => function (EntityRepository $repository) use ($actionType) { + $qb = $repository->createQueryBuilder('g') + ->select('g') + ->join('g.socialActions', 'socialActions'); + + if ($actionType instanceof SocialAction) { + $qb = $qb->where( + $qb->expr()->andX( + $qb->expr()->in('g', ':socialActions') + )) + ->setParameter('country', $actionType); + } + + dump($qb->getQuery()->getResult()); + + return $qb; + } + ]); + }; + + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) use ($refreshGoals) { + $form = $event->getForm(); + $data = $event->getData(); + + if ($data == null){ + $refreshGoals($form, null); + } + + if ($data instanceof SocialAction) { + $refreshGoals($form, $data->getGoals()); + // $refreshCity($form, $data->getRegion()->getCities()); + } + }); + } + + public function getTitle(): string + { + return 'Filter by type of action, objectives and results'; + } + + public function describeAction($data, $format = 'string'): array + { + $actionTypes = []; + $objectives = []; + $results = []; + + foreach ($data['actionType'] as $at) { + $actionTypes[] = $at->getTitle(); + } + foreach ($data['objectives'] as $o) { + $objectives[] = $o->getTitle(); + } + foreach ($data['results'] as $r) { + $results[] = $r->getTitle(); + } + + return ['Filtered by referrers: only %actionTypes%', [ + '%actionTypes%' => implode(', ou ', $actionTypes) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('r', ':referrers'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('referrers', $data['referrers']); + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 8936af9b9..cdf4f50d4 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -12,4 +12,11 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_referrer_filter } \ No newline at end of file + - { name: chill.export_filter, alias: social_work_actions_referrer_filter } + + chill.person.export.filter_social_work_type: + class: Chill\PersonBundle\Export\Filter\SocialWorkTypeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_type_filter } \ No newline at end of file From 357c7db5f14e15e3241edb43a619239b1714e343 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 16:02:11 +0200 Subject: [PATCH 065/191] rename filters to avoid confusion --- .../Export/Filter/{UserJobFilter.php => CurrentUserJobFilter.php} | 0 .../Filter/{UserScopeFilter.php => CurrentUserScopeFilter.php} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserJobFilter.php => CurrentUserJobFilter.php} (100%) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserScopeFilter.php => CurrentUserScopeFilter.php} (100%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php similarity index 100% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php similarity index 100% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php From a40e2de91d2aed6a2e3d61389173258d3a1fec4a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 16:02:11 +0200 Subject: [PATCH 066/191] rename filters to avoid confusion --- ...{UserJobFilter.php => CurrentUserJobFilter.php} | 14 +++----------- ...rScopeFilter.php => CurrentUserScopeFilter.php} | 2 +- .../services/exports_accompanying_period.yaml | 12 ++++++------ 3 files changed, 10 insertions(+), 18 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserJobFilter.php => CurrentUserJobFilter.php} (88%) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserScopeFilter.php => CurrentUserScopeFilter.php} (97%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php similarity index 88% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php index d641d9a74..72dd39a0f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php @@ -11,8 +11,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter; -use Chill\CustomFieldsBundle\Form\Type\ChoicesType; -use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\FilterInterface; @@ -20,23 +18,17 @@ use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; -use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; -class UserJobFilter implements FilterInterface +class CurrentUserJobFilter implements FilterInterface { - /** - * @var TranslatorInterface - */ - protected $translator; + + protected TranslatorInterface $translator; private Security $security; - /** - * @var TranslatableStringHelper - */ private TranslatableStringHelper $translatableStringHelper; public function __construct( diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php index bc7a1b9d3..aaa38f420 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php @@ -24,7 +24,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; -class UserScopeFilter implements FilterInterface +class CurrentUserScopeFilter implements FilterInterface { /** * @var TranslatorInterface diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 72fa1ad80..262d07a82 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -32,19 +32,19 @@ services: - { name: chill.export, alias: avg_accompanyingcourse_duration } ## Filters - chill.person.export.filter_userscope: - class: Chill\PersonBundle\Export\Filter\UserScopeFilter + chill.person.export.filter_current_userscope: + class: Chill\PersonBundle\Export\Filter\CurrentUserScopeFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: accompanyingcourse_userscope_filter } + - { name: chill.export_filter, alias: accompanyingcourse_current_userscope_filter } - chill.person.export.filter_userjob: - class: Chill\PersonBundle\Export\Filter\UserJobFilter + chill.person.export.filter_current_userjob: + class: Chill\PersonBundle\Export\Filter\CurrentUserJobFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: accompanyingcourse_userjob_filter } + - { name: chill.export_filter, alias: accompanyingcourse_current_userjob_filter } chill.person.export.filter_socialissue: class: Chill\PersonBundle\Export\Filter\SocialIssueFilter From 5c82ccc49ddb97201ca857ffa62d2fda6367a316 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 17:08:50 +0200 Subject: [PATCH 067/191] user scope and job filter on socialwork actions --- .../Export/Filter/UserJobFilter.php | 100 ++++++++++++++++++ .../Export/Filter/UserScopeFilter.php | 99 +++++++++++++++++ .../services/exports_social_actions.yaml | 21 +++- 3 files changed, 217 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php new file mode 100644 index 000000000..32991aad6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php @@ -0,0 +1,100 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('userjob', EntityType::class, [ + 'class' => UserJob::class, + 'choice_label' => function (UserJob $j) { + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function describeAction($data, $format = 'string') + { + $userjobs = []; + + foreach ($data['userjob'] as $j) { + $userjobs[] = $this->translatableStringHelper->localize( + $j->getLabel()); + } + + return ['Filtered by the following jobs: only %userjobs%', [ + '%userjobs%' => implode(', ou ', $userjobs) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'r'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('r.userJob', ':userjob'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('userjob', $data['userjob']); + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + + public function getTitle() + { + return 'Filter by job'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php new file mode 100644 index 000000000..dd16bbf74 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php @@ -0,0 +1,99 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('scope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function describeAction($data, $format = 'string') + { + $scopes = []; + + foreach ($data['scope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName()); + } + + return ['Filtered by the following scopes: only %scope%', [ + '%scope%' => implode(', ou ', $scopes) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'r'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('r.mainScope', ':scope'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('scope', $data['scope']); + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + + public function getTitle() + { + return 'Filter by scope'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index cdf4f50d4..a6b7963c0 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -7,6 +7,7 @@ services: tags: - { name: chill.export, alias: count_social_work_actions } + ## FILTERS chill.person.export.filter_referrers: class: Chill\PersonBundle\Export\Filter\ReferrerFilter autowire: true @@ -14,9 +15,23 @@ services: tags: - { name: chill.export_filter, alias: social_work_actions_referrer_filter } - chill.person.export.filter_social_work_type: - class: Chill\PersonBundle\Export\Filter\SocialWorkTypeFilter + # chill.person.export.filter_social_work_type: + # class: Chill\PersonBundle\Export\Filter\SocialWorkTypeFilter + # autowire: true + # autoconfigure: true + # tags: + # - { name: chill.export_filter, alias: social_work_type_filter } + + chill.person.export.filter_userscope: + class: Chill\PersonBundle\Export\Filter\UserScopeFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_type_filter } \ No newline at end of file + - { name: chill.export_filter, alias: social_work_actions_userscope_filter } + + chill.person.export.filter_userjob: + class: Chill\PersonBundle\Export\Filter\UserJobFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_actions_userjob_filter } \ No newline at end of file From b9186ed6e01cf8af6a29e8a49ad553c769f35f8c Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 27 Jul 2022 18:39:58 +0200 Subject: [PATCH 068/191] tests: write a simple Export test for new indicators + fix depreciation with BrowserKit client cfr: https://symfony.com/doc/4.4/components/browser_kit.html#creating-a-client --- .../Test/Export/AbstractExportTest.php | 6 ++- .../Export/CountAccompanyingCourseTest.php | 43 +++++++++++++++++++ .../StatAccompanyingCourseDurationTest.php | 36 ++++++++++++++++ 3 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php index a80753a46..60d539573 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractExportTest.php @@ -16,6 +16,7 @@ use Doctrine\ORM\NativeQuery; use Doctrine\ORM\QueryBuilder; use RuntimeException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; +use Symfony\Component\BrowserKit\HttpBrowser; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Security\Core\Role\Role; use Traversable; @@ -332,8 +333,9 @@ abstract class AbstractExportTest extends WebTestCase */ public function testListExportPage() { - /** @var \Symfony\Component\BrowserKit\Client $client */ - $client = $this->getClient(); + /** @var HttpBrowser $client */ + $client = new HttpBrowser(); + $export = $this->getExport(); $prophet = new \Prophecy\Prophet(); $container = static::$kernel->getContainer(); diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php new file mode 100644 index 000000000..d6fa9a843 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountAccompanyingCourseTest.php @@ -0,0 +1,43 @@ +export = self::$container->get('chill.person.export.count_accompanyingcourse'); + } + + /** + * @inheritDoc + */ + public function getExport() + { + return $this->export; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [[]]; + } + + /** + * @inheritDoc + */ + public function getModifiersCombination() + { + return [[Declarations::ACP_TYPE]]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php new file mode 100644 index 000000000..7c1420c86 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/StatAccompanyingCourseDurationTest.php @@ -0,0 +1,36 @@ +export = self::$container->get('chill.person.export.avg_accompanyingcourse_duration'); + } + + public function getExport() + { + return $this->export; + } + + public function getFormData(): array + { + return [ + ['closingdate' => \DateTime::createFromFormat('Y-m-d', '2022-06-30')], + ]; + } + + public function getModifiersCombination() + { + return [[Declarations::ACP_TYPE]]; + } +} \ No newline at end of file From 30501a68e38e9f0bed481fab5cc9798bb012d384 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 21:07:05 +0200 Subject: [PATCH 069/191] referrer aggregator --- .../Export/Aggregator/ReferrerAggregator.php | 86 +++++++++++++++++++ .../services/exports_social_actions.yaml | 18 ++-- 2 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php new file mode 100644 index 000000000..3dbc4b820 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php @@ -0,0 +1,86 @@ +userRepository = $userRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('r.id as referrer_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('referrer_aggregator'); + } else { + $qb->groupBy('referrer_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + dump($values); + return function ($value): string { + if ('_header' === $value) { + return 'Referrer'; + } + + $r = $this->userRepository->find($value); + + return $r->getUsername(); + }; + } + + public function getQueryKeys($data) + { + return ['referrer_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by referrers'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index a6b7963c0..96e14d99a 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -30,8 +30,16 @@ services: - { name: chill.export_filter, alias: social_work_actions_userscope_filter } chill.person.export.filter_userjob: - class: Chill\PersonBundle\Export\Filter\UserJobFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: social_work_actions_userjob_filter } \ No newline at end of file + class: Chill\PersonBundle\Export\Filter\UserJobFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_actions_userjob_filter } + + ## AGGREGATORS + chill.person.export.aggregator_referrer: + class: Chill\PersonBundle\Export\Aggregator\ReferrerAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator } From 562a5678ef03d501fcfae50c909c2e37c379bfcd Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 21:19:13 +0200 Subject: [PATCH 070/191] referrer job aggregator for social work actions --- .../Aggregator/ReferrerJobAggregator.php | 86 +++++++++++++++++++ .../services/exports_social_actions.yaml | 7 ++ 2 files changed, 93 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php new file mode 100644 index 000000000..672ede59a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php @@ -0,0 +1,86 @@ +userJobRepository = $userJobRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('IDENTITY(r.userJob) as referrer_job_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('referrer_job_aggregator'); + } else { + $qb->groupBy('referrer_job_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'User job'; + } + + $j = $this->userJobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel()); + }; + } + + public function getQueryKeys($data) + { + return ['referrer_job_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by referrer job'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 96e14d99a..5ac5a0afa 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -43,3 +43,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator } + + chill.person.export.aggregator_referrer_job: + class: Chill\PersonBundle\Export\Aggregator\ReferrerJobAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_referrer_job_aggregator } From 8085fe2c177de5b0373640f8ee85ae9138693b11 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 27 Jul 2022 21:25:13 +0200 Subject: [PATCH 071/191] referrer scope aggregator for social work actions --- .../Aggregator/ReferrerScopeAggregator.php | 86 +++++++++++++++++++ .../services/exports_social_actions.yaml | 7 ++ 2 files changed, 93 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php new file mode 100644 index 000000000..b6dc3a71d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php @@ -0,0 +1,86 @@ +scopeRepository = $scopeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('IDENTITY(r.mainScope) as referrer_scope_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('referrer_scope_aggregator'); + } else { + $qb->groupBy('referrer_scope_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'User scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName()); + }; + } + + public function getQueryKeys($data) + { + return ['referrer_scope_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by referrer scope'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 5ac5a0afa..66dddc583 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -50,3 +50,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_referrer_job_aggregator } + + chill.person.export.aggregator_referrer_scope: + class: Chill\PersonBundle\Export\Aggregator\ReferrerScopeAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_referrer_scope_aggregator } From 5c7513acd7bb5aedfc8dcdce6ffa2f513b5e859a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 28 Jul 2022 10:53:54 +0200 Subject: [PATCH 072/191] rename translations chains --- .../translations/messages+intl-icu.fr.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml index 0e825aa72..50cb9f0e6 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml +++ b/src/Bundle/ChillPersonBundle/translations/messages+intl-icu.fr.yaml @@ -119,14 +119,14 @@ periods: show closed periods: >- {nb_items, plural, =0 {Aucun parcours clôturé} - one {Montrer un parcours clôturé} - many {Montrer # parcours clôturés} - other {Montrer # parcours clôturés} + one {Montrer un parcours clôturé ou un ancien parcours} + many {Montrer # parcours clôturés ou anciens parcours} + other {Montrer # parcours clôturés ou anciens parcours} } hide closed periods: >- {nb_items, plural, =0 {Aucun parcours clôturé} - one {Masquer un parcours clôturé} - many {Masquer # parcours clôturés} - other {Masquer # parcours clôturés} + one {Masquer un parcours clôturé ou un ancien parcours} + many {Masquer # parcours clôturés ou anciens parcours} + other {Masquer # parcours clôturés ou anciens parcours} } From 13b15f50575ea946f0c00570a421e72c90435aaa Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 28 Jul 2022 11:24:36 +0200 Subject: [PATCH 073/191] renaming of class to avoid confusion --- .../{UserJobFilter.php => ReferrerJobFilter.php} | 2 +- .../{UserScopeFilter.php => ReferrerScopeFilter.php} | 2 +- .../config/services/exports_social_actions.yaml | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserJobFilter.php => ReferrerJobFilter.php} (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{UserScopeFilter.php => ReferrerScopeFilter.php} (97%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php similarity index 98% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php index 32991aad6..cce0a9318 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; -class UserJobFilter implements FilterInterface +class ReferrerJobFilter implements FilterInterface { protected TranslatorInterface $translator; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php index dd16bbf74..c895276f1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/UserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php @@ -21,7 +21,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class UserScopeFilter implements FilterInterface +class ReferrerScopeFilter implements FilterInterface { protected TranslatorInterface $translator; diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 66dddc583..beefb0756 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -23,18 +23,18 @@ services: # - { name: chill.export_filter, alias: social_work_type_filter } chill.person.export.filter_userscope: - class: Chill\PersonBundle\Export\Filter\UserScopeFilter + class: Chill\PersonBundle\Export\Filter\referrerScopeFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_userscope_filter } + - { name: chill.export_filter, alias: social_work_actions_referrerscope_filter } - chill.person.export.filter_userjob: - class: Chill\PersonBundle\Export\Filter\UserJobFilter + chill.person.export.filter_referrerjob: + class: Chill\PersonBundle\Export\Filter\referrerJobFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_userjob_filter } + - { name: chill.export_filter, alias: social_work_actions_referrerjob_filter } ## AGGREGATORS chill.person.export.aggregator_referrer: From d6b3ba48c00bfeaba31344bb5b4ad7994c54b4f8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 28 Jul 2022 12:05:42 +0200 Subject: [PATCH 074/191] fix the possibility to filter with multiple jobs or scopes --- .../ChillPersonBundle/Export/Filter/ReferrerJobFilter.php | 2 +- .../ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php index cce0a9318..fe9e51b27 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php @@ -75,7 +75,7 @@ class ReferrerJobFilter implements FilterInterface $qb->join('acpw.referrers', 'r'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('r.userJob', ':userjob'); + $clause = $qb->expr()->in('r.userJob', ':userjob'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php index c895276f1..0d4a22532 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php @@ -74,7 +74,7 @@ class ReferrerScopeFilter implements FilterInterface $qb->join('acpw.referrers', 'r'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('r.mainScope', ':scope'); + $clause = $qb->expr()->in('r.mainScope', ':scope'); if ($where instanceof Andx) { $where->add($clause); From e6b66216aea67d3eac5669b60731e81b557e42f5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 28 Jul 2022 15:44:17 +0200 Subject: [PATCH 075/191] actiontype, goal, and result aggregators created --- .../Aggregator/ActionTypeAggregator.php | 85 +++++++++++++++++++ .../Export/Aggregator/GoalAggregator.php | 81 ++++++++++++++++++ .../Export/Aggregator/ResultAggregator.php | 81 ++++++++++++++++++ .../services/exports_social_actions.yaml | 21 +++++ 4 files changed, 268 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php new file mode 100644 index 000000000..df6a9f98f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php @@ -0,0 +1,85 @@ +socialActionRepository = $socialActionRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.socialAction', 'sa'); + $qb->addSelect('sa.id as action_type_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('action_type_aggregator'); + } else { + $qb->groupBy('action_type_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + //TODO certain social actions have the same title as other, but are linked to different social issues, should we make a visual distinction? + return function ($value): string { + if ('_header' === $value) { + return 'Social Action Type'; + } + + $sa = $this->socialActionRepository->find($value); + + return $sa->getTitle()['fr']; + }; + } + + public function getQueryKeys($data) + { + return ['action_type_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by action type'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php new file mode 100644 index 000000000..bc26a113d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php @@ -0,0 +1,81 @@ +goalRepository = $goalRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.goals', 'g'); + $qb->addSelect('g.id as goal_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('goal_aggregator'); + } else { + $qb->groupBy('goal_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Goal Type'; + } + + $g = $this->goalRepository->find($value); + + return $g->getTitle()['fr']; + }; + } + + public function getQueryKeys($data) + { + return ['goal_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by goal'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php new file mode 100644 index 000000000..ef5740a00 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php @@ -0,0 +1,81 @@ +resultRepository = $resultRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.results', 'r'); + $qb->addSelect('r.id as result_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('result_aggregator'); + } else { + $qb->groupBy('result_aggregator'); + } + + } + + public function applyOn() + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Result Type'; + } + + $g = $this->resultRepository->find($value); + + return $g->getTitle()['fr']; + }; + } + + public function getQueryKeys($data) + { + return ['result_aggregator']; + } + + public function getTitle() + { + return 'Group social work actions by result'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index beefb0756..9ea903758 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -57,3 +57,24 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_referrer_scope_aggregator } + + chill.person.export.aggregator_action_type: + class: Chill\PersonBundle\Export\Aggregator\ActionTypeAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_action_type_aggregator } + + chill.person.export.aggregator_goal: + class: Chill\PersonBundle\Export\Aggregator\GoalAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_goal_aggregator } + + chill.person.export.aggregator_result: + class: Chill\PersonBundle\Export\Aggregator\ResultAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_result_aggregator } From 635fe819a681476e35f4b86c77436e20d7cefbee Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 28 Jul 2022 15:57:02 +0200 Subject: [PATCH 076/191] rename more generic for use in other exports --- .../Filter/{ReferrerJobFilter.php => JobFilter.php} | 4 ++-- .../{ReferrerScopeFilter.php => ScopeFilter.php} | 2 +- .../config/services/exports_social_actions.yaml | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{ReferrerJobFilter.php => JobFilter.php} (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ReferrerScopeFilter.php => ScopeFilter.php} (97%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php index fe9e51b27..b9aaabb6f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php @@ -22,7 +22,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; use Symfony\Contracts\Translation\TranslatorInterface; -class ReferrerJobFilter implements FilterInterface +class JobFilter implements FilterInterface { protected TranslatorInterface $translator; @@ -95,6 +95,6 @@ class ReferrerJobFilter implements FilterInterface public function getTitle() { - return 'Filter by job'; + return 'Filter by user job'; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php index 0d4a22532..d4f4524b3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php @@ -21,7 +21,7 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; -class ReferrerScopeFilter implements FilterInterface +class ScopeFilter implements FilterInterface { protected TranslatorInterface $translator; diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 9ea903758..bf47c8978 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -22,19 +22,19 @@ services: # tags: # - { name: chill.export_filter, alias: social_work_type_filter } - chill.person.export.filter_userscope: - class: Chill\PersonBundle\Export\Filter\referrerScopeFilter + chill.person.export.filter_scope: + class: Chill\PersonBundle\Export\Filter\ScopeFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_referrerscope_filter } + - { name: chill.export_filter, alias: social_work_actions_scope_filter } - chill.person.export.filter_referrerjob: - class: Chill\PersonBundle\Export\Filter\referrerJobFilter + chill.person.export.filter_job: + class: Chill\PersonBundle\Export\Filter\JobFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_referrerjob_filter } + - { name: chill.export_filter, alias: social_work_actions_job_filter } ## AGGREGATORS chill.person.export.aggregator_referrer: From c1f578a81182d3bc9abcc5b8a272e1b77809f88e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 29 Jul 2022 12:13:32 +0200 Subject: [PATCH 077/191] exports: add new referrer filter, with mechanism to use it in acp or acpw context --- .../ChillPersonBundle/Export/Declarations.php | 2 + .../Export/Export/CountAccompanyingCourse.php | 2 +- .../Export/Filter/ReferrerFilter.php | 161 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 + .../translations/messages.fr.yml | 4 + 5 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index bb892a69c..58a8eec24 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -21,4 +21,6 @@ abstract class Declarations public const PERSON_TYPE = 'person'; public const ACP_TYPE = 'accompanying_period'; + + public const ACP_SHARED = 'accompanying_period_shared'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index b7b57d3cd..6d2c0c6f6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -105,7 +105,7 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function supportsModifiers(): array { - return [Declarations::ACP_TYPE]; + return [Declarations::ACP_TYPE, Declarations::ACP_SHARED]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php new file mode 100644 index 000000000..22515d13e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -0,0 +1,161 @@ +userRender = $userRender; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_referrers', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + /* + $builder->add('referrers', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + */ + + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filtered by referrers'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string') + { + $users = []; + + foreach ($data['accepted_referrers'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by referrer: only %referrers%', [ + '%referrers' => implode(", ou ", $users) + ]]; + /* + $referrers = []; + + foreach ($data['referrers'] as $r) { + $referrers[] = $this->userRender->renderString($r, []); + } + + return ['Filtered by referrers: only %referrers%', [ + '%referrers%' => implode(', ou ', $referrers) + ]]; + */ + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + + $where = $qb->getDQLPart('where'); + + $from_alias = $this->getEntityFromQB($qb); + + // Use querybuilder from alias to find which export context (indicator) + switch ($from_alias) { + case 'acp': + $clause = $qb->expr()->in('acp.user', ':referrers'); + break; + + case 'acpw': + $qb->join('acpw.referrers', 'r'); + $clause = $qb->expr()->in('r', ':referrers'); + break; + + default: + throw new \Exception("Referrer filter doesn't apply on that entity"); + } + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('referrers', $data['accepted_referrers']); + + /* + $qb->join('acpw.referrers', 'r'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('r', ':referrers'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('referrers', $data['referrers']); + */ + } + + private function getEntityFromQB(QueryBuilder $qb): string + { + /** @var From $from */ + $from = $qb->getDQLPart('from'); + + return $from[0]->getAlias(); + } + + /** + * @inheritDoc + */ + public function applyOn() + { + return Declarations::ACP_SHARED; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 72fa1ad80..4c4bca27d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -95,4 +95,11 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } + chill.person.export.filter_referrer: + class: Chill\PersonBundle\Export\Filter\ReferrerFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter } + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 4c5ca1dcf..a8d57227f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -416,6 +416,10 @@ is occasional: le parcours est ponctuel is regular: le parcours est régulier "Filtered by intensity: only %intensity%": "Filtré par intensité: uniquement si %intensity%" +Filtered by referrers: Filtrer par référent +Accepted referrers: Référents +"Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" + From dd06a262a20f9a63f3abde180a705bcced4d5e04 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Sun, 31 Jul 2022 19:22:39 +0200 Subject: [PATCH 078/191] remove commented unused --- .../Export/Filter/ReferrerFilter.php | 37 ------------------- 1 file changed, 37 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php index 22515d13e..a7727fda7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -35,16 +35,6 @@ class ReferrerFilter implements FilterInterface 'multiple' => true, 'expanded' => true ]); - /* - $builder->add('referrers', EntityType::class, [ - 'class' => User::class, - 'choice_label' => function (User $u) { - return $this->userRender->renderString($u, []); - }, - 'multiple' => true, - 'expanded' => true - ]); - */ } @@ -71,17 +61,6 @@ class ReferrerFilter implements FilterInterface 'Filtered by referrer: only %referrers%', [ '%referrers' => implode(", ou ", $users) ]]; - /* - $referrers = []; - - foreach ($data['referrers'] as $r) { - $referrers[] = $this->userRender->renderString($r, []); - } - - return ['Filtered by referrers: only %referrers%', [ - '%referrers%' => implode(', ou ', $referrers) - ]]; - */ } /** @@ -125,22 +104,6 @@ class ReferrerFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('referrers', $data['accepted_referrers']); - - /* - $qb->join('acpw.referrers', 'r'); - - $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('r', ':referrers'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); - $qb->setParameter('referrers', $data['referrers']); - */ } private function getEntityFromQB(QueryBuilder $qb): string From 7677b8aaa096fc869af01b970fe8fbd5c77b2e89 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Fri, 29 Jul 2022 12:14:37 +0200 Subject: [PATCH 079/191] exports: add new OpenBetweenDates filter --- .../Export/Filter/OpenBetweenDatesFilter.php | 88 +++++++++++++++++++ .../services/exports_accompanying_period.yaml | 9 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 101 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php new file mode 100644 index 000000000..2515f4e75 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php @@ -0,0 +1,88 @@ +add('date_from', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ; + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filtered by opened between dates'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string') + { + return ['Filtered by opening dates: between %datefrom% and %dateto%', [ + '%datefrom%' => $data['date_from']->format('d-m-Y'), + '%dateto%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->lt('acp.openingDate', ':datefrom'), + $qb->expr()->gt('acp.closingDate', ':dateto') + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE); + $qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 4c4bca27d..1f98ffd39 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -102,4 +102,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter } + chill.person.export.filter_openbetweendates: + class: Chill\PersonBundle\Export\Filter\OpenBetweenDatesFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } + + + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index a8d57227f..f3e4be1c4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -420,6 +420,10 @@ Filtered by referrers: Filtrer par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" +Filtered by opened between dates: Filtrer les parcours ouverts entre deux dates +Date from: Date de début +Date to: Date de fin +"Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" From c401e34d63a93274adfab7fd69c5a83e456ae128 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 11:16:17 +0200 Subject: [PATCH 080/191] exports: add new ActiveOneDayBetweenDates filter --- .../Filter/ActiveOneDayBetweenDatesFilter.php | 93 +++++++++++++++++++ .../Export/Filter/OpenBetweenDatesFilter.php | 3 +- .../services/exports_accompanying_period.yaml | 9 +- .../translations/messages.fr.yml | 3 +- 4 files changed, 104 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php new file mode 100644 index 000000000..6f6ef1197 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php @@ -0,0 +1,93 @@ +add('date_from', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ; + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filtered by active at least one day between dates'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string') + { + return ['Filtered by actives courses: at least one day between %datefrom% and %dateto%', [ + '%datefrom%' => $data['date_from']->format('d-m-Y'), + '%dateto%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->orX( + $qb->expr()->lt('(acp.openingDate + 1)', ':dateto'), + $qb->expr()->andX( + $qb->expr()->lt('acp.openingDate', ':datefrom'), + $qb->expr()->isNull('acp.closingDate') + ), + $qb->expr()->gt('(acp.closingDate - 1)', ':datefrom') + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('datefrom', $data['date_from'], Types::DATE_MUTABLE); + $qb->setParameter('dateto', $data['date_to'], Types::DATE_MUTABLE); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php index 2515f4e75..ef829bdfa 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php @@ -2,6 +2,7 @@ namespace Chill\PersonBundle\Export\Filter; +use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; @@ -10,7 +11,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use DateTime; -class OpenBetweenDatesFilter implements \Chill\MainBundle\Export\FilterInterface +class OpenBetweenDatesFilter implements FilterInterface { /** diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 1f98ffd39..20131dc59 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -95,6 +95,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } + chill.person.export.filter_activeonedaybetweendates: + class: Chill\PersonBundle\Export\Filter\ActiveOneDayBetweenDatesFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activeonedaybetweendates_filter } + chill.person.export.filter_referrer: class: Chill\PersonBundle\Export\Filter\ReferrerFilter autowire: true @@ -109,6 +116,4 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } - - ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f3e4be1c4..f047a6804 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -425,7 +425,8 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" - +Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période +"Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" ## aggregators Group people by nationality: Aggréger les personnes par nationalités From 758c56482b5e88b4c41f74615a5fe4145aa9c69a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 11:30:32 +0200 Subject: [PATCH 081/191] exports: add new ActiveOnDate filter --- .../Export/Filter/ActiveOnDateFilter.php | 87 +++++++++++++++++++ .../Filter/ActiveOneDayBetweenDatesFilter.php | 2 +- .../Export/Filter/OpenBetweenDatesFilter.php | 2 +- .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 5 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php new file mode 100644 index 000000000..0d83bce13 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php @@ -0,0 +1,87 @@ +add('on_date', ChillDateType::class, [ + 'data' => new DateTime(), + ]) + ; + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filtered by active on date'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by actives courses: active on %ondate%', [ + '%ondate%' => $data['on_date']->format('d-m-Y') + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->lte('acp.openingDate', ':ondate'), + $qb->expr()->orX( + $qb->expr()->gt('acp.closingDate', ':ondate'), + $qb->expr()->isNull('acp.closingDate') + ) + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php index 6f6ef1197..0054018d1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOneDayBetweenDatesFilter.php @@ -40,7 +40,7 @@ class ActiveOneDayBetweenDatesFilter implements FilterInterface /** * @inheritDoc */ - public function describeAction($data, $format = 'string') + public function describeAction($data, $format = 'string'): array { return ['Filtered by actives courses: at least one day between %datefrom% and %dateto%', [ '%datefrom%' => $data['date_from']->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php index ef829bdfa..2c3514f92 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/OpenBetweenDatesFilter.php @@ -40,7 +40,7 @@ class OpenBetweenDatesFilter implements FilterInterface /** * @inheritDoc */ - public function describeAction($data, $format = 'string') + public function describeAction($data, $format = 'string'): array { return ['Filtered by opening dates: between %datefrom% and %dateto%', [ '%datefrom%' => $data['date_from']->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 20131dc59..fb10e775f 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -95,6 +95,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } + chill.person.export.filter_activeondate: + class: Chill\PersonBundle\Export\Filter\ActiveOnDateFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activeondate_filter } + chill.person.export.filter_activeonedaybetweendates: class: Chill\PersonBundle\Export\Filter\ActiveOneDayBetweenDatesFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f047a6804..0f65dcf6c 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -428,6 +428,10 @@ Date to: Date de fin Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période "Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" +Filtered by active on date: Filtrer les parcours actifs à une date +On date: Actifs à cette date +"Filtered by actives courses: active on %ondate%": "Filtrer les parcours actifs: actifs le %ondate%" + ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From b511517a0f51326d9ea1c81c25f0ef709536794c Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 12:45:04 +0200 Subject: [PATCH 082/191] export new SocialActionFilter --- .../Export/Filter/SocialActionFilter.php | 101 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 19 ++-- 3 files changed, 120 insertions(+), 7 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/SocialActionFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialActionFilter.php new file mode 100644 index 000000000..d421044a2 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialActionFilter.php @@ -0,0 +1,101 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + $this->actionRender = $actionRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialactions', EntityType::class, [ + 'class' => SocialAction::class, + 'choice_label' => function (SocialAction $sa) { + return $this->actionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle(): string + { + return 'Filter by socialaction'; + } + + public function describeAction($data, $format = 'string'): array + { + $socialactions = []; + + foreach ($data['accepted_socialactions'] as $sa) { + $socialactions[] = $this->actionRender->renderString($sa, []); + } + + return ['Filtered by socialactions: only %socialactions%', [ + '%socialactions%' => implode(", ou ", $socialactions) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.works', 'acpw') + ->join('acpw.socialAction', 'sa') + ; + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('sa.id', ':socialactions'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('socialactions', $data['accepted_socialactions']); + } + + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index fb10e775f..0556f051c 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -60,6 +60,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_step_filter } + chill.person.export.filter_socialaction: + class: Chill\PersonBundle\Export\Filter\SocialActionFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_socialaction_filter } + chill.person.export.filter_origin: class: Chill\PersonBundle\Export\Filter\OriginFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 0f65dcf6c..7f56b90fa 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -390,6 +390,10 @@ Filter by step: Filtrer par statut du parcours Accepted steps: Statuts "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" +Filter by socialaction: Filtrer par action d'accompagnement +Accepted socialactions: Actions d'accompagnement +"Filtered by socialactions: only %socialactions%": "Filtré par action d'accompagnement: uniquement %socialactions%" + Filter by origin: Filtrer par origine du parcours Accepted origins: Origines "Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" @@ -416,6 +420,14 @@ is occasional: le parcours est ponctuel is regular: le parcours est régulier "Filtered by intensity: only %intensity%": "Filtré par intensité: uniquement si %intensity%" +Filtered by active on date: Filtrer les parcours actifs à une date +On date: Actifs à cette date +"Filtered by actives courses: active on %ondate%": "Filtrer les parcours actifs: actifs le %ondate%" + +Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période +"Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" + + Filtered by referrers: Filtrer par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" @@ -425,13 +437,6 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" -Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période -"Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" - -Filtered by active on date: Filtrer les parcours actifs à une date -On date: Actifs à cette date -"Filtered by actives courses: active on %ondate%": "Filtrer les parcours actifs: actifs le %ondate%" - ## aggregators Group people by nationality: Aggréger les personnes par nationalités Group by level: Grouper par niveau From bc2209319a256b4e30e7d2f77528af229ad33f91 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 14:32:11 +0200 Subject: [PATCH 083/191] export new EvaluationFilter --- .../Export/Filter/EvaluationFilter.php | 105 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 116 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php new file mode 100644 index 000000000..7dd2a683d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php @@ -0,0 +1,105 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_evaluations', EntityType::class, [ + 'class' => Evaluation::class, + 'choice_label' => function (Evaluation $ev) { + return $this->translatableStringHelper->localize($ev->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by evaluation'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $evaluations = []; + + foreach ($data['accepted_evaluations'] as $ev) { + $evaluations[] = $this->translatableStringHelper->localize($ev->getTitle()); + } + + return ['Filtered by evaluations: only %evals%', [ + '%evals%' => implode(", ou ", $evaluations) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('acp.works', 'acpw') + ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') + ->join('we.evaluation', 'ev') + ; + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('ev.id', ':evaluations'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('evaluations', $data['accepted_evaluations']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 0556f051c..9c3e27d58 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -67,6 +67,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_socialaction_filter } + chill.person.export.filter_evaluation: + class: Chill\PersonBundle\Export\Filter\EvaluationFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_evaluation_filter } + chill.person.export.filter_origin: class: Chill\PersonBundle\Export\Filter\OriginFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7f56b90fa..755797a12 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -394,6 +394,10 @@ Filter by socialaction: Filtrer par action d'accompagnement Accepted socialactions: Actions d'accompagnement "Filtered by socialactions: only %socialactions%": "Filtré par action d'accompagnement: uniquement %socialactions%" +Filter by evaluation: Filtrer par évaluation +Accepted evaluations: Évaluations +"Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" + Filter by origin: Filtrer par origine du parcours Accepted origins: Origines "Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" From 4794e5e7b5c2f29657f53daafbb529fe309045ae Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 15:45:31 +0200 Subject: [PATCH 084/191] export new ActivityTypeFilter --- .../Export/Filter/ActivityTypeFilter.php | 111 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 122 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ActivityTypeFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ActivityTypeFilter.php new file mode 100644 index 000000000..f019394d4 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ActivityTypeFilter.php @@ -0,0 +1,111 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_activitytypes', EntityType::class, [ + 'class' => ActivityType::class, + 'choice_label' => function (ActivityType $aty) { + return $this->translatableStringHelper->localize($aty->getName()); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by activity type'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $types = []; + + foreach ($data['accepted_activitytypes'] as $aty) { + $types[] = $this->translatableStringHelper->localize($aty->getName()); + } + + return ['Filtered by activity types: only %activitytypes%', [ + '%activitytypes%' => implode(", ou ", $types) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + // One2many between activity and accompanyingperiod is not reversed ! + // we replace indicator 'from' clause by 'act', and put 'acp' in a join + + $qb->resetDQLPart('from'); + $qb->from('ChillActivityBundle:Activity', 'act'); + + $qb + ->join('act.accompanyingPeriod', 'acp') + ->join('act.activityType', 'aty') + ; + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('aty.id', ':activitytypes'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('activitytypes', $data['accepted_activitytypes']); + + } + + /** + * @inheritDoc + */ + public function applyOn() + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 9c3e27d58..07f3db1ae 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -74,6 +74,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_evaluation_filter } + chill.person.export.filter_activitytype: + class: Chill\PersonBundle\Export\Filter\ActivityTypeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activitytype_filter } + chill.person.export.filter_origin: class: Chill\PersonBundle\Export\Filter\OriginFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 755797a12..79f280360 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -398,6 +398,10 @@ Filter by evaluation: Filtrer par évaluation Accepted evaluations: Évaluations "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" +Filter by activity type: Filtrer par type d'activité +Accepted activitytypes: Types d'activités +"Filtered by activity types: only %activitytypes%": "Filtré par type d'activité: seulement %activitytypes%" + Filter by origin: Filtrer par origine du parcours Accepted origins: Origines "Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" From 6e439adce251b87cd3e2a2cf60454c528b9c6d09 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 16:50:02 +0200 Subject: [PATCH 085/191] export new administrative location filter --- .../Filter/AdministrativeLocationFilter.php | 99 +++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ .../translations/messages.fr.yml | 4 + 3 files changed, 110 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AdministrativeLocationFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AdministrativeLocationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AdministrativeLocationFilter.php new file mode 100644 index 000000000..b52a2abe1 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AdministrativeLocationFilter.php @@ -0,0 +1,99 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_locations', EntityType::class, [ + 'class' => Location::class, + 'choice_label' => function (Location $l) { + return $l->getName() .' ('. $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by administrative location'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $locations = []; + + foreach ($data['accepted_locations'] as $l) { + $locations[] = $l->getName(); + } + + return ['Filtered by administratives locations: only %locations%', [ + '%locations%' => implode(", ou ", $locations) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('acp.administrativeLocation', ':locations'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('locations', $data['accepted_locations']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 07f3db1ae..671309ae8 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -95,6 +95,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_closingmotive_filter } + chill.person.export.filter_administrative_location: + class: Chill\PersonBundle\Export\Filter\AdministrativeLocationFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_administrative_location_filter } + chill.person.export.filter_confidential: class: Chill\PersonBundle\Export\Filter\ConfidentialFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 79f280360..a524228fc 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -410,6 +410,10 @@ Filter by closing motive: Filtrer par motif de fermeture Accepted closingmotives: Motifs de clôture "Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%" +Filter by administrative location: Filtrer par localisation administrative +Accepted locations: Localisations administratives +"Filtered by administratives locations: only %locations%": "Filtré par localisation administrative: uniquement %locations%" + Filter by confidential: Filtrer par confidentialité Accepted confidentials: '' is confidential: le parcours est confidentiel From 28dc99ff3f30812d5dcbf584f98826f3d6a847f5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 2 Aug 2022 11:24:08 +0200 Subject: [PATCH 086/191] tests added for filters and some aggregators --- .../Export/Aggregator/ReferrerAggregator.php | 5 -- .../Aggregator/ReferrerAggregatorTest.php | 58 ++++++++++++++++++ .../Export/CountSocialWorkActionsTest.php | 43 +++++++++++++ .../Tests/Export/Filter/JobFilterTest.php | 60 ++++++++++++++++++ .../Tests/Export/Filter/ScopeFilterTest.php | 61 +++++++++++++++++++ 5 files changed, 222 insertions(+), 5 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php index 3dbc4b820..91e181012 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php @@ -13,13 +13,9 @@ namespace Chill\PersonBundle\Export\Aggregator; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; -use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Export\Declarations; -use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; -use LogicException; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; final class ReferrerAggregator implements AggregatorInterface { @@ -62,7 +58,6 @@ final class ReferrerAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - dump($values); return function ($value): string { if ('_header' === $value) { return 'Referrer'; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php new file mode 100644 index 000000000..f1aa07190 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.person.export.aggregator_referrer'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container + ->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('count(acpw.id)') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php new file mode 100644 index 000000000..d904f2eeb --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Export/CountSocialWorkActionsTest.php @@ -0,0 +1,43 @@ +export = self::$container->get('chill.person.export.count_social_work_actions'); + } + + /** + * @inheritDoc + */ + public function getExport() + { + return $this->export; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [[]]; + } + + /** + * @inheritDoc + */ + public function getModifiersCombination() + { + return [[Declarations::SOCIAL_WORK_ACTION_TYPE]]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php new file mode 100644 index 000000000..6f7546b4b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/JobFilterTest.php @@ -0,0 +1,60 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_job'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return []; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acpw.id') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php new file mode 100644 index 000000000..d387769cc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ScopeFilterTest.php @@ -0,0 +1,61 @@ +prophesize(); + + $request->willExtend(\Symfony\Component\HttpFoundation\Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_scope'); + + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return []; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->select('acpw.id') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} \ No newline at end of file From 40d92d11fce7362c7c22938fd82aa7306f810a38 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 2 Aug 2022 11:30:30 +0200 Subject: [PATCH 087/191] renaming aggregator job and scope for generic use --- .../{ReferrerJobAggregator.php => JobAggregator.php} | 10 +++++----- ...ferrerScopeAggregator.php => ScopeAggregator.php} | 10 +++++----- .../config/services/exports_social_actions.yaml | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ReferrerJobAggregator.php => JobAggregator.php} (86%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ReferrerScopeAggregator.php => ScopeAggregator.php} (86%) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php similarity index 86% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php index 672ede59a..aa8e6f173 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php @@ -18,7 +18,7 @@ use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -final class ReferrerJobAggregator implements AggregatorInterface +final class JobAggregator implements AggregatorInterface { private UserJobRepository $userJobRepository; @@ -38,14 +38,14 @@ final class ReferrerJobAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.userJob) as referrer_job_aggregator'); + $qb->addSelect('IDENTITY(r.userJob) as job_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { - $qb->addGroupBy('referrer_job_aggregator'); + $qb->addGroupBy('job_aggregator'); } else { - $qb->groupBy('referrer_job_aggregator'); + $qb->groupBy('job_aggregator'); } } @@ -76,7 +76,7 @@ final class ReferrerJobAggregator implements AggregatorInterface public function getQueryKeys($data) { - return ['referrer_job_aggregator']; + return ['job_aggregator']; } public function getTitle() diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php similarity index 86% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php index b6dc3a71d..743677d8e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php @@ -18,7 +18,7 @@ use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; -final class ReferrerScopeAggregator implements AggregatorInterface +final class ScopeAggregator implements AggregatorInterface { private ScopeRepository $scopeRepository; @@ -38,14 +38,14 @@ final class ReferrerScopeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.mainScope) as referrer_scope_aggregator'); + $qb->addSelect('IDENTITY(r.mainScope) as scope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { - $qb->addGroupBy('referrer_scope_aggregator'); + $qb->addGroupBy('scope_aggregator'); } else { - $qb->groupBy('referrer_scope_aggregator'); + $qb->groupBy('scope_aggregator'); } } @@ -76,7 +76,7 @@ final class ReferrerScopeAggregator implements AggregatorInterface public function getQueryKeys($data) { - return ['referrer_scope_aggregator']; + return ['scope_aggregator']; } public function getTitle() diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index bf47c8978..a274f7ca1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -44,19 +44,19 @@ services: tags: - { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator } - chill.person.export.aggregator_referrer_job: - class: Chill\PersonBundle\Export\Aggregator\ReferrerJobAggregator + chill.person.export.aggregator_job: + class: Chill\PersonBundle\Export\Aggregator\JobAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: social_work_actions_referrer_job_aggregator } + - { name: chill.export_aggregator, alias: social_work_actions_job_aggregator } - chill.person.export.aggregator_referrer_scope: - class: Chill\PersonBundle\Export\Aggregator\ReferrerScopeAggregator + chill.person.export.aggregator_scope: + class: Chill\PersonBundle\Export\Aggregator\ScopeAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: social_work_actions_referrer_scope_aggregator } + - { name: chill.export_aggregator, alias: social_work_actions_scope_aggregator } chill.person.export.aggregator_action_type: class: Chill\PersonBundle\Export\Aggregator\ActionTypeAggregator From ea12c601543f7a6b744c22729e3fa1899ccf630f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 2 Aug 2022 12:31:29 +0200 Subject: [PATCH 088/191] more aggregator tests --- .../Aggregator/ActionTypeAggregatorTest.php | 58 +++++++++++++++++++ .../Export/Aggregator/GoalAggregatorTest.php | 58 +++++++++++++++++++ .../Aggregator/ResultAggregatorTest.php | 58 +++++++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php new file mode 100644 index 000000000..1f5585281 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.person.export.aggregator_action_type'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container + ->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('count(acpw.id)') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php new file mode 100644 index 000000000..ca1fa9417 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.person.export.aggregator_goal'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container + ->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('count(acpw.id)') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php new file mode 100644 index 000000000..f5080e488 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php @@ -0,0 +1,58 @@ +aggregator = self::$container->get('chill.person.export.aggregator_result'); + } + + public function getAggregator() + { + return $this->aggregator; + } + + public function getFormData() + { + return [ + [], + ]; + } + + public function getQueryBuilders() + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container + ->get('doctrine.orm.entity_manager'); + + return [ + $em->createQueryBuilder() + ->select('count(acpw.id)') + ->from('ChillPersonBundle:AccompanyingPeriodWork', 'acpw'), + ]; + } +} From c72dc83c067d6b433dfdf7dcb4c298b59407e410 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 2 Aug 2022 13:44:28 +0200 Subject: [PATCH 089/191] adjust countperson to make it work again --- .../Export/Export/CountPerson.php | 22 +++++++++---------- .../Repository/PersonRepository.php | 5 +++++ .../config/services/exports.yaml | 11 ++++------ 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 115b3489e..96f669524 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -15,8 +15,8 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\PersonRepository; use Chill\PersonBundle\Security\Authorization\PersonVoter; -use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use LogicException; @@ -25,19 +25,18 @@ use Symfony\Component\Security\Core\Role\Role; class CountPerson implements ExportInterface, GroupedExportInterface { - /** - * @var EntityManagerInterface - */ - protected $entityManager; + + protected PersonRepository $personRepository; public function __construct( - EntityManagerInterface $em + PersonRepository $personRepository ) { - $this->entityManager = $em; + $this->personRepository = $personRepository; } public function buildForm(FormBuilderInterface $builder) { + // No form necessary } public function getAllowedFormattersTypes() @@ -47,7 +46,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface public function getDescription() { - return 'Count peoples by various parameters.'; + return 'Count people by various parameters.'; } public function getLabels($key, array $values, $data) @@ -76,7 +75,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface public function getTitle() { - return 'Count peoples'; + return 'Count people'; } public function getType() @@ -95,10 +94,9 @@ class CountPerson implements ExportInterface, GroupedExportInterface return $el['center']; }, $acl); - $qb = $this->entityManager->createQueryBuilder(); + $qb = $this->personRepository->createQueryBuilder('person'); $qb->select('COUNT(person.id) AS export_result') - ->from('ChillPersonBundle:Person', 'person') ->join('person.center', 'center') ->andWhere('center IN (:authorized_centers)') ->setParameter('authorized_centers', $centers); @@ -113,7 +111,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface public function supportsModifiers() { - return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN]; + return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN, Declarations::ACP_SHARED]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php index bd8347852..309e5f086 100644 --- a/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php +++ b/src/Bundle/ChillPersonBundle/Repository/PersonRepository.php @@ -31,6 +31,11 @@ final class PersonRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Person::class); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + /** * @param $centers * diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports.yaml index f50674e19..b00e6106d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports.yaml @@ -2,18 +2,15 @@ services: chill.person.export.count_person: class: Chill\PersonBundle\Export\Export\CountPerson - arguments: - - "@doctrine.orm.entity_manager" + autowire: true + autoconfigure: true tags: - { name: chill.export, alias: count_person } chill.person.export.list_person: class: Chill\PersonBundle\Export\Export\ListPerson - arguments: - - "@doctrine.orm.entity_manager" - - "@translator" - - "@chill.main.helper.translatable_string" - - "@chill.custom_field.provider" + autowire: true + autoconfigure: true tags: - { name: chill.export, alias: list_person } From ebb6ee4a41eeea68603bd9df7bbe5912045c0b43 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 2 Aug 2022 14:39:09 +0200 Subject: [PATCH 090/191] agefilter added for persons --- .../ChillPersonExtension.php | 2 +- .../Export/Filter/AgeFilter.php | 106 ++++++++++++++++++ .../{exports.yaml => exports_person.yaml} | 15 ++- 3 files changed, 119 insertions(+), 4 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php rename src/Bundle/ChillPersonBundle/config/services/{exports.yaml => exports_person.yaml} (89%) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 61bce30f9..5b919a333 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -75,7 +75,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config')); $loader->load('services.yaml'); $loader->load('services/widgets.yaml'); - $loader->load('services/exports.yaml'); + $loader->load('services/exports_person.yaml'); $loader->load('services/exports_social_actions.yaml'); $loader->load('services/fixtures.yaml'); $loader->load('services/controller.yaml'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php new file mode 100644 index 000000000..ef2bc2fa0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php @@ -0,0 +1,106 @@ +getDQLPart('where'); + + $min = null !== $data['min_age'] ? $data['min_age'] : 0; + $max = null !== $data['max_age'] ? $data['max_age'] : 200; + $calc = $data['date_calc']; + + $clause = $qb->expr()->andX( + $qb->expr()->gte('DATE_DIFF(:calc_date, person.birthdate)/365', + ':min_age' + ), + $qb->expr()->lte('DATE_DIFF(:calc_date, person.birthdate)/365', + ':max_age' + ) + ); + + if ($where instanceof Expr\Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('min_age', $min); + $qb->setParameter('max_age', $max); + $qb->setParameter('calc_date', $calc); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + { + $builder->add('min_age', IntegerType::class, [ + 'label' => 'Minimum age', + ]); + + $builder->add('max_age', IntegerType::class, [ + 'label' => 'Maximum age', + ]); + + $builder->add('date_calc', DateType::class, [ + 'label' => 'Calculate age in relation to this date', + 'data' => new DateTime('now'), + 'attr' => ['class' => 'datepicker'], + 'widget' => 'single_text', + 'format' => 'dd-MM-yyyy', + ]); + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s age']; + } + + public function getTitle() + { + return 'Filter by person\'s age'; + } + + public function validateForm($data, ExecutionContextInterface $context) + { + $min = $data['min_age']; + $max = $data['max_age']; + + if ( + (null !== $min && null !== $max) + && $min >= $max + ) { + $context->buildViolation('The minimum age should be less than the maximum age.') + ->addViolation(); + } + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml similarity index 89% rename from src/Bundle/ChillPersonBundle/config/services/exports.yaml rename to src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index b00e6106d..e45930ddb 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -24,12 +24,20 @@ services: tags: - { name: chill.export, alias: list_person_duplicate } +# FILTERS chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\GenderFilter - arguments: - $translator: '@translator' + autowire: true + autoconfigure: true tags: - { name: chill.export_filter, alias: person_gender_filter } + + chill.person.export.filter_age: + class: Chill\PersonBundle\Export\Filter\AgeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_age_filter } chill.person.export.filter_birthdate: class: Chill\PersonBundle\Export\Filter\BirthdateFilter @@ -42,7 +50,8 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_nationality_filter } - + +# AGGREGATORS chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\NationalityAggregator autowire: true From cf7cf664a9a7f8347235e4261b67f5b1c6288a0a Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 3 Aug 2022 14:35:55 +0200 Subject: [PATCH 091/191] person filters added --- .../Export/Filter/AgeFilter.php | 12 +- .../Export/Filter/BirthdateFilter.php | 17 +-- .../Export/Filter/DeadOrAliveFilter.php | 113 ++++++++++++++++++ .../Export/Filter/DeathdateFilter.php | 109 +++++++++++++++++ .../Export/Filter/EntrustedChildFilter.php | 65 ++++++++++ .../Export/Filter/FamilySituationFilter.php | 55 +++++++++ .../Export/Filter/NomadicFilter.php | 64 ++++++++++ .../Filter/ResidentialAddressAtUserFilter.php | 67 +++++++++++ .../config/services/exports_person.yaml | 31 +++++ .../translations/messages.fr.yml | 35 +++++- 10 files changed, 548 insertions(+), 20 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/DeadOrAliveFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/DeathdateFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/EntrustedChildFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/FamilySituationFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/NomadicFilter.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/ResidentialAddressAtUserFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php index ef2bc2fa0..3a6e6861a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AgeFilter.php @@ -13,11 +13,14 @@ namespace Chill\PersonBundle\Export\Filter; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\ORM\Query\Expr; +use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\Extension\Core\Type\IntegerType; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; class AgeFilter implements ExportElementValidatedInterface, FilterInterface @@ -27,7 +30,7 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface return null; } - public function alterQuery(\Doctrine\ORM\QueryBuilder $qb, $data) + public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); @@ -61,7 +64,7 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface return Declarations::PERSON_TYPE; } - public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder) { $builder->add('min_age', IntegerType::class, [ 'label' => 'Minimum age', @@ -71,12 +74,9 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface 'label' => 'Maximum age', ]); - $builder->add('date_calc', DateType::class, [ + $builder->add('date_calc', ChillDateType::class, [ 'label' => 'Calculate age in relation to this date', 'data' => new DateTime('now'), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', ]); } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php index 36457e0f8..d7235a5c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/BirthdateFilter.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Filter; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use DateTime; use Doctrine\ORM\Query\Expr; use Symfony\Component\Form\Extension\Core\Type\DateType; @@ -52,26 +53,20 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) { - $builder->add('date_from', DateType::class, [ + $builder->add('date_from', ChillDateType::class, [ 'label' => 'Born after this date', - 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + 'data' => new DateTime() ]); - $builder->add('date_to', DateType::class, [ + $builder->add('date_to', ChillDateType::class, [ 'label' => 'Born before this date', - 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', + 'data' => new DateTime() ]); } public function describeAction($data, $format = 'string') { - return ['Filtered by person\'s birtdate: ' + return ['Filtered by person\'s birthdate: ' . 'between %date_from% and %date_to%', [ '%date_from%' => $data['date_from']->format('d-m-Y'), '%date_to%' => $data['date_to']->format('d-m-Y'), diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/DeadOrAliveFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/DeadOrAliveFilter.php new file mode 100644 index 000000000..6f65038bd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/DeadOrAliveFilter.php @@ -0,0 +1,113 @@ +getDQLPart('where'); + + $personState = $data['person_state']; + $calc = $data['date_calc']; + + if ($personState == 'alive') { + $clause = $qb->expr()->orX( + $qb->expr()->andX( + $qb->expr()->isNull('person.deathdate'), + $qb->expr()->lte( + 'person.birthdate', + ':date_calc' + ) + ), + $qb->expr()->andX( + $qb->expr()->isNotNull('person.deathdate'), + $qb->expr()->gt( + 'person.deathdate', + ':date_calc' + ), + $qb->expr()->lte( + 'person.birthdate', + ':date_calc' + ) + ) + ); + } else { + $clause = $qb->expr()->andX( + $qb->expr()->isNotNull('person.deathdate'), + $qb->expr()->lte( + 'person.deathdate', + ':date_calc' + ) + ); + } + + if ($where instanceof Expr\Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('date_calc', $calc); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('person_state', ChoiceType::class, [ + 'choices' => [ + 'Alive' => 'alive', + 'Deceased' => 'deceased', + ], + 'multiple' => false, + 'expanded' => true, + ]); + + $builder->add('date_calc', ChillDateType::class, [ + 'label' => 'Filter in relation to this date', + 'data' => new DateTime('now'), + ]); + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by a state of %deadOrAlive%: ' + . 'at this date %date_calc%', [ + '%date_calc%' => $data['date_calc']->format('d-m-Y'), + '%deadOrAlive%' => $data['person_state'], + ], ]; + } + + public function getTitle() + { + return 'Filtered by person\'s that are alive or have deceased at a certain date'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/DeathdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/DeathdateFilter.php new file mode 100644 index 000000000..2197a93c6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/DeathdateFilter.php @@ -0,0 +1,109 @@ +getDQLPart('where'); + $clause = $qb->expr()->between( + 'person.deathdate', + ':date_from', + ':date_to' + ); + + if ($where instanceof Expr\Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('date_from', $data['date_from']); + $qb->setParameter('date_to', $data['date_to']); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('date_from', ChillDateType::class, [ + 'label' => 'Death after this date', + 'data' => new DateTime(), + ]); + + $builder->add('date_to', ChillDateType::class, [ + 'label' => 'Deathdate before', + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s deathdate: ' + . 'between %date_from% and %date_to%', [ + '%date_from%' => $data['date_from']->format('d-m-Y'), + '%date_to%' => $data['date_to']->format('d-m-Y'), + ], ]; + } + + public function getTitle() + { + return 'Filter by person\'s deathdate'; + } + + public function validateForm($data, ExecutionContextInterface $context) + { + $date_from = $data['date_from']; + $date_to = $data['date_to']; + + if (null === $date_from) { + $context->buildViolation('The "date from" should not be empty') + //->atPath('date_from') + ->addViolation(); + } + + if (null === $date_to) { + $context->buildViolation('The "date to" should not be empty') + //->atPath('date_to') + ->addViolation(); + } + + if ( + (null !== $date_from && null !== $date_to) + && $date_from >= $date_to + ) { + $context->buildViolation('The date "date to" should be after the ' + . 'date given in "date from" field') + ->addViolation(); + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EntrustedChildFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EntrustedChildFilter.php new file mode 100644 index 000000000..9d2c81b3c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EntrustedChildFilter.php @@ -0,0 +1,65 @@ +resetDQLPart('from'); + $qb->from('App:VendeePersonMineur', 'vpm'); + + $qb->join('vpm.person', 'person'); + $qb->join('person.center', 'center'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('vpm.enfantConfie', 'true'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + { + // No form needed + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by entrusted child status']; + } + + public function getTitle() + { + return 'Filter by entrusted child status'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/FamilySituationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/FamilySituationFilter.php new file mode 100644 index 000000000..30d67aff5 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/FamilySituationFilter.php @@ -0,0 +1,55 @@ +add('date_calc', DateType::class, [ + 'label' => 'Family composition(s) at this time', + 'data' => new DateTime(), + ]); + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s family situation']; + } + + public function getTitle() + { + return 'Filter by person\'s family situation'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/NomadicFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/NomadicFilter.php new file mode 100644 index 000000000..b4ef13c36 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/NomadicFilter.php @@ -0,0 +1,64 @@ +resetDQLPart('from'); + $qb->from('App:VendeePerson', 'vp'); + + $qb->join('vp.person', 'person'); + $qb->join('person.center', 'center'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq('vp.gensDuVoyage', 'true'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + { + // No form needed + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by nomadic status']; + } + + public function getTitle() + { + return 'Filter by nomadic status'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ResidentialAddressAtUserFilter.php new file mode 100644 index 000000000..14369c7f0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ResidentialAddressAtUserFilter.php @@ -0,0 +1,67 @@ +resetDQLPart('from'); + $qb->from('ChillPersonBundle:Person:ResidentialAddress', 'ra'); + + $qb->join('ra.person', 'person'); + $qb->join('person.center', 'center'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->isNotNull('ra.hostPerson'); + + if ($where instanceof Expr\Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + + dump($qb->getQuery()); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + { + // No form needed unless validity date should be added ( not specified in doc as a parameter ). + } + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s who have a residential address located at another user']; + } + + public function getTitle() + { + return 'Filtered by person\'s who have a residential address located at another user'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index e45930ddb..47fb89770 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -43,6 +43,16 @@ services: class: Chill\PersonBundle\Export\Filter\BirthdateFilter tags: - { name: chill.export_filter, alias: person_birthdate_filter } + + chill.person.export.filter_deathdate: + class: Chill\PersonBundle\Export\Filter\DeathdateFilter + tags: + - { name: chill.export_filter, alias: person_deathdate_filter } + + chill.person.export.filter_dead_or_alive: + class: Chill\PersonBundle\Export\Filter\DeadOrAliveFilter + tags: + - { name: chill.export_filter, alias: person_dead_or_alive_filter } chill.person.export.filter_nationality: class: Chill\PersonBundle\Export\Filter\NationalityFilter @@ -50,6 +60,27 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_nationality_filter } + + chill.person.export.filter_residential_address_at_user: + class: Chill\PersonBundle\Export\Filter\ResidentialAddressAtUserFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_residential_address_at_user_filter } + + chill.person.export.filter_entrusted_child: + class: Chill\PersonBundle\Export\Filter\EntrustedChildFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_entrusted_child_filter } + + chill.person.export.filter_nomadic: + class: Chill\PersonBundle\Export\Filter\NomadicFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_nomadic_filter } # AGGREGATORS chill.person.export.aggregator_nationality: diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f613b09da..6e8044d74 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -329,8 +329,8 @@ Accompanyied people: Personnes accompagnées ## exports Exports of persons: Exports des personnes -Count peoples by various parameters.: Compte le nombre de personnes en fonction de différents filtres. -Count peoples: Nombre de personnes +Count people by various parameters.: Compte le nombre de personnes en fonction de différents filtres. +Count people: Nombre de personnes List peoples: Liste des personnes Create a list of people according to various filters.: Crée une liste des personnes selon différents filtres. Fields to include in export: Champs à inclure dans l'export @@ -364,7 +364,36 @@ Born after this date: Nés après cette date Born before this date: Nés avant cette date This field should not be empty: Ce champ ne peut pas être vide This date should be after the date given in "born after" field: Cette date doit être après la date donnée du le champ "nés après le" -"Filtered by person's birtdate: between %date_from% and %date_to%": "Filtré par date de naissance de la personne: uniquement nés entre le %date_from% et %date_to%" +"Filtered by person's birthdate: between %date_from% and %date_to%": "Filtré par date de naissance de la personne: uniquement nés entre le %date_from% et %date_to%" + +Filter by person's deathdate: Filtrer par date de décès de la personne +"Filtered by person's deathdate: between %date_from% and %date_to%": "Filtré par date de naissance de la personne: uniquement nés entre le %date_from% et %date_to%" +Death after this date: Décédé après cette date +Deathdate before: Décédé avant cette date + +Alive: Vivant +Deceased: Décédé +Filter in relation to this date: Filtrer par rapport à cette date +"Filtered by a state of %deadOrAlive% at this date %date_calc%": Filtré par personnes qui sont %deadOrAlive% à cette date %date_calc% + +Filter by person's age: Filtrer par âge de la personne +Filtered by person's age: Filtré par âge de la personne +Minimum age: Âge minimum +Maximum age: Âge maximum +The minimum age should be less than the maximum age.: L'âge minimum doit être plus bas que l'âge maximum. + +Family composition: Composition familiale +Family composition at this time: Composition familiale à cette date. + +Filtered by entrusted child status: Uniquement les personnes qui sont "enfant confié" +Filter by entrusted child status: Uniquement les personnes qui sont "enfant confié" + +Filtered by nomadic status: Uniquement les personnes qui sont "gens de voyage" +Filter by nomadic status: Uniquement les personnes qui sont "gens de voyage" + +Filtered by person's who have a residential address located at another user: Uniquement les usagers qui ont une addresse de résidence chez un autre usager + +Filtered by person's that are alive or have deceased at a certain date: Filtrer par usagers qui sont décédé ou vivant à une certaine date "Filter by accompanying period: active period": "Filtrer par période d'accompagnement: en file active" Having an accompanying period opened after this date: Ayant une période d'accompagnement ouverte après cette date From cfd590442f25231fafad4675d4c5f998352010a5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 3 Aug 2022 15:15:52 +0200 Subject: [PATCH 092/191] moving files into separate folders for better overview --- .../{ => PersonAggregators}/AgeAggregator.php | 2 +- .../CountryOfBirthAggregator.php | 2 +- .../GenderAggregator.php | 2 +- .../NationalityAggregator.php | 2 +- .../ActionTypeAggregator.php | 2 +- .../GoalAggregator.php | 2 +- .../ResultAggregator.php | 2 +- .../AccompanyingPeriodClosingFilter.php | 2 +- .../AccompanyingPeriodFilter.php | 2 +- .../AccompanyingPeriodOpeningFilter.php | 2 +- .../ActiveOnDateFilter.php | 2 +- .../ActiveOneDayBetweenDatesFilter.php | 2 +- .../ActivityTypeFilter.php | 3 +- .../AdministrativeLocationFilter.php | 2 +- .../ClosingMotiveFilter.php | 2 +- .../ConfidentialFilter.php | 2 +- .../EmergencyFilter.php | 2 +- .../IntensityFilter.php | 2 +- .../OpenBetweenDatesFilter.php | 2 +- .../OriginFilter.php | 2 +- .../SocialActionFilter.php | 2 +- .../SocialIssueFilter.php | 2 +- .../StepFilter.php | 2 +- .../Filter/{ => PersonFilters}/AgeFilter.php | 5 ++- .../{ => PersonFilters}/BirthdateFilter.php | 2 +- .../{ => PersonFilters}/DeadOrAliveFilter.php | 2 +- .../{ => PersonFilters}/DeathdateFilter.php | 2 +- .../EntrustedChildFilter.php | 2 +- .../FamilySituationFilter.php | 2 +- .../{ => PersonFilters}/GenderFilter.php | 2 +- .../{ => PersonFilters}/NationalityFilter.php | 2 +- .../{ => PersonFilters}/NomadicFilter.php | 2 +- .../ResidentialAddressAtUserFilter.php | 2 +- .../services/exports_accompanying_period.yaml | 32 +++++++++---------- .../config/services/exports_person.yaml | 26 +++++++-------- .../services/exports_social_actions.yaml | 6 ++-- 36 files changed, 66 insertions(+), 68 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => PersonAggregators}/AgeAggregator.php (97%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => PersonAggregators}/CountryOfBirthAggregator.php (98%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => PersonAggregators}/GenderAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => PersonAggregators}/NationalityAggregator.php (98%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/ActionTypeAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/GoalAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/ResultAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/AccompanyingPeriodClosingFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/AccompanyingPeriodFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/AccompanyingPeriodOpeningFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ActiveOnDateFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ActiveOneDayBetweenDatesFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ActivityTypeFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/AdministrativeLocationFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ClosingMotiveFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ConfidentialFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/EmergencyFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/IntensityFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/OpenBetweenDatesFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/OriginFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/SocialActionFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/SocialIssueFilter.php (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/StepFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/AgeFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/BirthdateFilter.php (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/DeadOrAliveFilter.php (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/DeathdateFilter.php (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/EntrustedChildFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/FamilySituationFilter.php (95%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/GenderFilter.php (98%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/NationalityFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/NomadicFilter.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => PersonFilters}/ResidentialAddressAtUserFilter.php (96%) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index 04edade32..a8f57e022 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php similarity index 98% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index 69cb05882..f0ae90f12 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php index fc8da07da..1e0a7082b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/GenderAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/GenderAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\PersonBundle\Entity\Person; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php similarity index 98% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index 312416367..b8c9ba166 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Export\ExportElementValidatedInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index df6a9f98f..2567ea378 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\PersonBundle\Export\Declarations; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index bc26a113d..d3b277a16 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\PersonBundle\Export\Declarations; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index ef5740a00..476b6f840 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\PersonBundle\Export\Declarations; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php index 787bf46d6..373312e2f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodClosingFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php index 1c658527f..260956db9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php index 7d00060f4..f737dfaab 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingPeriodOpeningFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index 0d83bce13..fff38318c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -1,6 +1,6 @@ Date: Wed, 3 Aug 2022 15:18:22 +0200 Subject: [PATCH 093/191] fix redundant referrerFilter --- .../config/services/exports_social_actions.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index a274f7ca1..401e82649 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -8,13 +8,7 @@ services: - { name: chill.export, alias: count_social_work_actions } ## FILTERS - chill.person.export.filter_referrers: - class: Chill\PersonBundle\Export\Filter\ReferrerFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: social_work_actions_referrer_filter } - + # chill.person.export.filter_social_work_type: # class: Chill\PersonBundle\Export\Filter\SocialWorkTypeFilter # autowire: true From 32bb868b2b50a136766ed98ded53549120dd4c8f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 3 Aug 2022 16:21:57 +0200 Subject: [PATCH 094/191] start with person aggregators --- .../MaritalStatusAggregator.php | 82 ++++++++++++++++++ .../ProfessionalSitutaionAggregator.php | 86 +++++++++++++++++++ .../PersonFilters/EntrustedChildFilter.php | 2 +- .../Filter/PersonFilters/NomadicFilter.php | 2 +- .../config/services/exports_person.yaml | 14 +++ .../translations/messages.fr.yml | 2 + 6 files changed, 186 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php new file mode 100644 index 000000000..ec15be45f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -0,0 +1,82 @@ +maritalStatusRepository = $maritalStatusRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('person.maritalStatus', 'ms'); + $qb->addSelect('ms.id as marital_status_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('marital_status_aggregator'); + } else { + $qb->groupBy('marital_status_aggregator'); + } + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Marital status'; + } + + $g = $this->maritalStatusRepository->find($value); + + return $g->getName()['fr']; + }; + } + + public function getQueryKeys($data) + { + return ['marital_status_aggregator']; + } + + public function getTitle() + { + return 'Group people by marital status'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php new file mode 100644 index 000000000..0ee31d4fe --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php @@ -0,0 +1,86 @@ +professionalSituationRepository = $professionalSituationRepository; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->resetDQLPart('from'); + $qb->from('App:VendeePerson', 'vp'); + $qb->join('vp.person', 'person'); + $qb->join('person.center', 'center'); + + $qb->join('vp.situationProfessionelle', 'sp'); + $qb->addSelect('sp.id as professional_situation_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('professional_situation_aggregator'); + } else { + $qb->groupBy('professional_situation_aggregator'); + } + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Professional situation'; + } + + $g = $this->professionalSituationRepository->find($value); + + return $g->getName()['fr']; + }; + } + + public function getQueryKeys($data) + { + return ['professional_situation_aggregator']; + } + + public function getTitle() + { + return 'Group people by their professional situation'; + } +} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php index 8d886f146..ce09901b7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php @@ -1,5 +1,5 @@ Date: Wed, 3 Aug 2022 16:48:33 +0200 Subject: [PATCH 095/191] start activity exports adaptations and new additions --- .../Export/Declarations.php | 20 ++++ .../Export/CountActivityLinkedToACP.php | 109 ++++++++++++++++++ .../Export/Filter/ActivityTypeFilter.php | 5 +- .../config/services/export.yaml | 21 ++-- .../translations/messages.fr.yml | 3 + 5 files changed, 148 insertions(+), 10 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/Export/Declarations.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php diff --git a/src/Bundle/ChillActivityBundle/Export/Declarations.php b/src/Bundle/ChillActivityBundle/Export/Declarations.php new file mode 100644 index 000000000..76335415f --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Declarations.php @@ -0,0 +1,20 @@ +activityRepository = $activityRepository; + } + + public function buildForm(FormBuilderInterface $builder) + { + } + + public function getAllowedFormattersTypes() + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription() + { + return 'Count activities linked to an accompanying period by various parameters.'; + } + + public function getLabels($key, array $values, $data) + { + if ('export_count_activity_acp' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Number of activities linked to an accompanying period' : $value; + } + + public function getQueryKeys($data) + { + return ['export_count_activity_acp']; + } + + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getTitle() + { + return 'Count activities linked to an accompanying period'; + } + + public function getType() + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $centers = array_map(static fn ($el) => $el['center'], $acl); + + $qb = $this + ->activityRepository + ->createQueryBuilder('activity') + ->select('COUNT(activity.id) as export_count_activity_acp'); + + $qb->andWhere( + $qb->expr()->isNotNull('activity.accompanyingPeriod') + ); + + return $qb; + } + + public function requiredRole() + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers() + { + return [ExportDeclarations::PERSON_TYPE, Declarations::ACTIVITY, ExportDeclarations::ACP_SHARED]; + } + + public function getGroup(): string + { + return 'Exports of activities'; + } +} diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index d3f35a746..6b7e4eab5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Entity\ActivityType; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityTypeRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportElementValidatedInterface; @@ -49,7 +50,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function alterQuery(QueryBuilder $qb, $data) { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.type', ':selected_activity_types'); + $clause = $qb->expr()->in('activity.activityType', ':selected_activity_types'); if ($where instanceof Expr\Andx) { $where->add($clause); @@ -63,7 +64,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function applyOn() { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index d8aa13098..daef12fed 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -7,16 +7,21 @@ services: class: Chill\ActivityBundle\Export\Export\CountActivity tags: - { name: chill.export, alias: 'count_activity' } - - chill.activity.export.sum_activity_duration: - class: Chill\ActivityBundle\Export\Export\StatActivityDuration + + chill.activity.export.count_activity_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\CountActivityLinkedToACP tags: - - { name: chill.export, alias: 'sum_activity_duration' } + - { name: chill.export, alias: 'count_activity_linked_to_acp' } - chill.activity.export.list_activity: - class: Chill\ActivityBundle\Export\Export\ListActivity - tags: - - { name: chill.export, alias: 'list_activity' } + # chill.activity.export.sum_activity_duration: + # class: Chill\ActivityBundle\Export\Export\StatActivityDuration + # tags: + # - { name: chill.export, alias: 'sum_activity_duration' } + + # chill.activity.export.list_activity: + # class: Chill\ActivityBundle\Export\Export\ListActivity + # tags: + # - { name: chill.export, alias: 'list_activity' } chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 93839327e..4296e6d76 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -211,6 +211,9 @@ List activities: Liste les activités List activities description: Créer la liste des activités Number of activities: Nombre d'activités Exports of activities: Exports des activités +Number of activities linked to an accompanying course: Nombre d'activités liés à un parcours. +Count activities linked to an accompanying period: Nombre d'activités liés à un parcours. +Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liés à un parcours en fonction de différents paramètres. #filters Filter by reason: Filtrer par sujet d'activité From 6921e4a40d079b82ab34004256456b9df86a4400 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 3 Aug 2022 15:20:34 +0200 Subject: [PATCH 096/191] exports: add new RequestorFilter --- .../Export/Filter/RequestorFilter.php | 153 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 + .../translations/messages.fr.yml | 8 + 3 files changed, 168 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/RequestorFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/RequestorFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/RequestorFilter.php new file mode 100644 index 000000000..ca2173e5a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/RequestorFilter.php @@ -0,0 +1,153 @@ + 'participation', + 'is other person' => 'other_person', + 'is thirdparty' => 'thirdparty', + 'no requestor' => 'no_requestor', + ]; + + private const DEFAULT_CHOICE = 'participation'; + + protected TranslatorInterface $translator; + + protected EntityManagerInterface $em; + + public function __construct( + TranslatorInterface $translator, + EntityManagerInterface $em + ) { + $this->translator = $translator; + $this->em = $em; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_choices', ChoiceType::class, [ + 'choices' => self::REQUESTOR_CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by requestor'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $choice = array_flip(self::REQUESTOR_CHOICES)[$data['accepted_choices']]; + + return ['Filtered by requestor: only %choice%', [ + '%choice%' => $this->translator->trans($choice) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + switch ($data['accepted_choices']) { + case 'participation': + + $qb->join('acp.participations', 'part'); + + $clause = $qb->expr()->andX( + $qb->expr()->isNotNull('acp.requestorPerson'), + $qb->expr()->eq('acp.requestorPerson', 'part.person') + ); + break; + + case 'other_person': + + $expr = $this->em->getExpressionBuilder(); + + $qb->join('acp.participations','part'); + + $clause = $expr->andX( + $expr->isNotNull('acp.requestorPerson'), + $expr->notIn('acp.requestorPerson', + + // subquery + $this->em->createQueryBuilder() + ->select('identity(acp2.requestorPerson)') + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp2') + ->join('acp2.participations', 'part2') + ->where($expr->eq('acp2.requestorPerson', 'part2.person')) + ->getDQL() + + ) + ); + break; + + case 'thirdparty': + + $clause = $qb->expr()->isNotNull('acp.requestorThirdParty'); + break; + + case 'no_requestor': + + $clause = $qb->expr()->andX( + $qb->expr()->isNull('acp.requestorPerson'), + $qb->expr()->isNull('acp.requestorThirdParty') + ); + break; + + default: + throw new \Exception('Uncaught choice exception'); + } + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 62ad99b97..b715605af 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -102,6 +102,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_administrative_location_filter } + chill.person.export.filter_requestor: + class: Chill\PersonBundle\Export\Filter\RequestorFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_requestor_filter } + chill.person.export.filter_confidential: class: Chill\PersonBundle\Export\Filter\ConfidentialFilter autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f613b09da..bdd70bee4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -418,6 +418,14 @@ Filter by administrative location: Filtrer par localisation administrative Accepted locations: Localisations administratives "Filtered by administratives locations: only %locations%": "Filtré par localisation administrative: uniquement %locations%" +Filter by requestor: Filtrer les parcours selon la présence du demandeur au sein des usagers concernés +Accepted choices: '' +is person concerned: Le demandeur est un usager concerné +is other person: Le demandeur est un autre usager +is thirdparty: Le demandeur est un tiers +no requestor: Il n'y a pas de demandeur +"Filtered by requestor: only %choice%": "Filtré par présence du demandeur au sein des usagers concernés: uniquement si %choice%" + Filter by confidential: Filtrer par confidentialité Accepted confidentials: '' is confidential: le parcours est confidentiel From 2413c986edc3c286a5dbd97fc60ba39e21a724bd Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 3 Aug 2022 13:34:06 +0200 Subject: [PATCH 097/191] exports: add a new GeographicUnitStat Filter (wip) --- .../Filter/GeographicalUnitStatFilter.php | 101 ++++++++++++++++++ .../services/exports_accompanying_period.yaml | 7 ++ 2 files changed, 108 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php new file mode 100644 index 000000000..0375846e6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php @@ -0,0 +1,101 @@ + 'territoire', + // TODO not yet implemented: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/626 + ]; + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder + ->add('date', ChillDateType::class, [ + 'data' => new \DateTime(), + ]) + ->add('accepted_loctype', ChoiceType::class, [ + 'choices' => self::LOCTYPE, + 'multiple' => false, + 'expanded' => true, + ]) + ; + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by geographic unit'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by geographic unit: only %date%', [ + '%date%' => $data['date']->format('d-m-Y'), + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->eq(1, 1); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('date', $data['date'], Types::DATE_MUTABLE); + $qb->setParameter('loctype', $data['accepted_loctype']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index b715605af..7ab97f20f 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -60,6 +60,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_step_filter } + chill.person.export.filter_geographicalunitstat: + class: Chill\PersonBundle\Export\Filter\GeographicalUnitStatFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_geographicalunitstat_filter } + chill.person.export.filter_socialaction: class: Chill\PersonBundle\Export\Filter\SocialActionFilter autowire: true From e3743d3593a9b20ce2490385aa758506cd4db462 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 10:49:02 +0200 Subject: [PATCH 098/191] tests new filters ReferrerFilter and OpenBetweenDatesFilter (wip.. test failed) --- .../Test/Export/AbstractFilterTest.php | 2 +- .../Export/Filter/ReferrerFilter.php | 4 +- .../Filter/OpenBetweenDatesFilterTest.php | 66 +++++++++++++++ .../Export/Filter/ReferrerFilterTest.php | 82 +++++++++++++++++++ 4 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php diff --git a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php index 34869c30b..bef4fd200 100644 --- a/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php +++ b/src/Bundle/ChillMainBundle/Test/Export/AbstractFilterTest.php @@ -37,7 +37,7 @@ abstract class AbstractFilterTest extends KernelTestCase protected function setUp(): void { - $$this->prophet = $this->getProphet(); + $this->prophet = $this->getProphet(); } public function dataProviderAlterQuery() diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php index e46b20592..bac2656c6 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -48,7 +48,7 @@ class ReferrerFilter implements FilterInterface /** * @inheritDoc */ - public function describeAction($data, $format = 'string') + public function describeAction($data, $format = 'string'): array { $users = []; @@ -116,7 +116,7 @@ class ReferrerFilter implements FilterInterface /** * @inheritDoc */ - public function applyOn() + public function applyOn(): string { return Declarations::ACP_SHARED; } diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php new file mode 100644 index 000000000..ccb7e38da --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/OpenBetweenDatesFilterTest.php @@ -0,0 +1,66 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_openbetweendates'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + [ + 'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'), + ], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php new file mode 100644 index 000000000..ec84c7027 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ReferrerFilterTest.php @@ -0,0 +1,82 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_referrer'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(User::class, 'u') + ->select('u') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $u) { + $data[] = ['accepted_referrers' => $u]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw') + ->select('acpw.id'), + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod\AccompanyingPeriodWork', 'acpw') + ->join('acpw.referrers', 'r') + ->select('r.id'), + ]; + } +} \ No newline at end of file From 28599adf4824aa9c76f319c56257f14f6b9c5c20 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 1 Aug 2022 11:37:41 +0200 Subject: [PATCH 099/191] tests on new ActiveOnDate and ActiveOneDayBetweenDates filters --- .../Export/Filter/ActiveOnDateFilterTest.php | 65 ++++++++++++++++++ .../ActiveOneDayBetweenDatesFilterTest.php | 66 +++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php new file mode 100644 index 000000000..b66de0f28 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOnDateFilterTest.php @@ -0,0 +1,65 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_activeondate'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + [ + 'on_date' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), + ], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php new file mode 100644 index 000000000..051db8635 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActiveOneDayBetweenDatesFilterTest.php @@ -0,0 +1,66 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_activeonedaybetweendates'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + [ + 'date_from' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'date_to' => \DateTime::createFromFormat('Y-m-d', '2022-06-01'), + ], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file From ea1a53ed377123bb44c91dc8b1a4891c38b0c7ac Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 4 Aug 2022 09:15:05 +0200 Subject: [PATCH 100/191] tests: add missing FilterTest --- .../Filter/GeographicalUnitStatFilter.php | 2 +- .../Export/Filter/ActivityTypeFilterTest.php | 77 +++++++++++++++++++ .../AdministrativeLocationFilterTest.php | 76 ++++++++++++++++++ .../Export/Filter/EvaluationFilterTest.php | 76 ++++++++++++++++++ .../Filter/GeographicalUnitStatFilterTest.php | 66 ++++++++++++++++ .../Export/Filter/RequestorFilterTest.php | 67 ++++++++++++++++ .../Export/Filter/SocialActionFilterTest.php | 76 ++++++++++++++++++ 7 files changed, 439 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php index 0375846e6..c06325265 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/GeographicalUnitStatFilter.php @@ -25,7 +25,7 @@ class GeographicalUnitStatFilter implements FilterInterface { private const LOCTYPE = [ - 'center' => 'territoire', + 'center' => 'center', // TODO not yet implemented: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/626 ]; diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php new file mode 100644 index 000000000..315592ee9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/ActivityTypeFilterTest.php @@ -0,0 +1,77 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_activitytype'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(ActivityType::class, 'at') + ->select('at') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $t) { + $data[] = ['accepted_activitytypes' => $t]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php new file mode 100644 index 000000000..f974919aa --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/AdministrativeLocationFilterTest.php @@ -0,0 +1,76 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_administrative_location'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(Location::class, 'l') + ->select('l') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $l) { + $data[] = ['accepted_locations' => $l]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php new file mode 100644 index 000000000..310fde2c9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/EvaluationFilterTest.php @@ -0,0 +1,76 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_evaluation'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(Evaluation::class, 'ev') + ->select('ev') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $e) { + $data[] = ['accepted_evaluations' => $e]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php new file mode 100644 index 000000000..8a205e9ac --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/GeographicalUnitStatFilterTest.php @@ -0,0 +1,66 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_geographicalunitstat'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + [ + 'date' => \DateTime::createFromFormat('Y-m-d', '2022-05-01'), + 'accepted_loctype' => 'center' + ], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php new file mode 100644 index 000000000..f8b01aea1 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/RequestorFilterTest.php @@ -0,0 +1,67 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_requestor'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + return [ + ['accepted_choices' => 'participation'], + ['accepted_choices' => 'other_person'], + ['accepted_choices' => 'thirdparty'], + ['accepted_choices' => 'no_requestor'], + ]; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php new file mode 100644 index 000000000..6de54c23a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Filter/SocialActionFilterTest.php @@ -0,0 +1,76 @@ +prophesize(); + + $request->willExtend(Request::class); + $request->getLocale()->willReturn('fr'); + + $this->filter = self::$container->get('chill.person.export.filter_socialaction'); + } + + /** + * @inheritDoc + */ + public function getFilter() + { + return $this->filter; + } + + /** + * @inheritDoc + */ + public function getFormData(): array + { + $em = self::$container->get(EntityManagerInterface::class); + + $array = $em->createQueryBuilder() + ->from(SocialAction::class, 'sa') + ->select('sa') + ->getQuery() + ->getResult(); + + $data = []; + + foreach($array as $a) { + $data[] = ['accepted_socialactions' => $a]; + } + + return $data; + } + + /** + * @inheritDoc + */ + public function getQueryBuilders(): array + { + if (null === self::$kernel) { + self::bootKernel(); + } + + $em = self::$container->get(EntityManagerInterface::class); + + return [ + $em->createQueryBuilder() + ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') + ->select('acp.id'), + ]; + } +} \ No newline at end of file From 43d45a5d04f197b2439a282795ee8a729d571274 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 4 Aug 2022 11:30:52 +0200 Subject: [PATCH 101/191] tests: fix missing use statement --- .../Tests/Export/Aggregator/ActionTypeAggregatorTest.php | 1 + .../Tests/Export/Aggregator/GoalAggregatorTest.php | 1 + .../Tests/Export/Aggregator/ReferrerAggregatorTest.php | 1 + .../Tests/Export/Aggregator/ResultAggregatorTest.php | 1 + 4 files changed, 4 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php index 1f5585281..235545e0f 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ActionTypeAggregatorTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; +use Chill\PersonBundle\Export\Aggregator\ActionTypeAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php index ca1fa9417..050b8ad5a 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/GoalAggregatorTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; +use Chill\PersonBundle\Export\Aggregator\GoalAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php index f1aa07190..e4e0eace8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ReferrerAggregatorTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; +use Chill\PersonBundle\Export\Aggregator\ReferrerAggregator; /** * @internal diff --git a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php index f5080e488..3112fc2d4 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Export/Aggregator/ResultAggregatorTest.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Tests\Export\Aggregator; use Chill\MainBundle\Test\Export\AbstractAggregatorTest; +use Chill\PersonBundle\Export\Aggregator\ResultAggregator; /** * @internal From 2f8bafa2e29f4f10f8f6017c93c19bc20410bef0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 4 Aug 2022 12:46:06 +0200 Subject: [PATCH 102/191] exports: split yaml services accompanying_period and accompanying_course * the 3 old filters are applyOn person -> move it in PersonFilters * there is a conditionnal option to enable them -> split yaml files --- .../ChillPersonExtension.php | 5 +- .../AccompanyingPeriodClosingFilter.php | 2 +- .../AccompanyingPeriodFilter.php | 2 +- .../AccompanyingPeriodOpeningFilter.php | 2 +- .../services/exports_accompanying_course.yaml | 152 +++++++++++++++++ .../services/exports_accompanying_period.yaml | 158 +----------------- .../config/services/exports_person.yaml | 5 +- 7 files changed, 164 insertions(+), 162 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{AccompanyingCourseFilters => PersonFilters}/AccompanyingPeriodClosingFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{AccompanyingCourseFilters => PersonFilters}/AccompanyingPeriodFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{AccompanyingCourseFilters => PersonFilters}/AccompanyingPeriodOpeningFilter.php (97%) create mode 100644 src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 5b919a333..5818ef2ba 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -75,8 +75,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../config')); $loader->load('services.yaml'); $loader->load('services/widgets.yaml'); - $loader->load('services/exports_person.yaml'); - $loader->load('services/exports_social_actions.yaml'); $loader->load('services/fixtures.yaml'); $loader->load('services/controller.yaml'); $loader->load('services/search.yaml'); @@ -96,9 +94,12 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/doctrineEventListener.yaml'); $loader->load('services/accompanyingPeriodConsistency.yaml'); + $loader->load('services/exports_person.yaml'); if ($container->getParameter('chill_person.accompanying_period') !== 'hidden') { $loader->load('services/exports_accompanying_period.yaml'); } + $loader->load('services/exports_accompanying_course.yaml'); + $loader->load('services/exports_social_actions.yaml'); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php index 373312e2f..ab22b830d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodClosingFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php index 260956db9..d043abdc0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php index f737dfaab..4c4b0f85b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/AccompanyingPeriodOpeningFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml new file mode 100644 index 000000000..76de0258f --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -0,0 +1,152 @@ +services: + + ## Indicators + chill.person.export.count_accompanyingcourse: + class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_accompanyingcourse } + + chill.person.export.avg_accompanyingcourse_duration: + class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: avg_accompanyingcourse_duration } + + ## Filters + chill.person.export.filter_current_userscope: + class: Chill\PersonBundle\Export\Filter\CurrentUserScopeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_current_userscope_filter } + + chill.person.export.filter_current_userjob: + class: Chill\PersonBundle\Export\Filter\CurrentUserJobFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_current_userjob_filter } + + chill.person.export.filter_socialissue: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialIssueFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_socialissue_filter } + + chill.person.export.filter_step: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\StepFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_step_filter } + + chill.person.export.filter_geographicalunitstat: + class: Chill\PersonBundle\Export\Filter\GeographicalUnitStatFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_geographicalunitstat_filter } + + chill.person.export.filter_socialaction: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialActionFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_socialaction_filter } + + chill.person.export.filter_evaluation: + class: Chill\PersonBundle\Export\Filter\EvaluationFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_evaluation_filter } + + chill.person.export.filter_activitytype: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActivityTypeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activitytype_filter } + + chill.person.export.filter_origin: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OriginFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } + + chill.person.export.filter_closingmotive: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ClosingMotiveFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_closingmotive_filter } + + chill.person.export.filter_administrative_location: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AdministrativeLocationFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_administrative_location_filter } + + chill.person.export.filter_requestor: + class: Chill\PersonBundle\Export\Filter\RequestorFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_requestor_filter } + + chill.person.export.filter_confidential: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ConfidentialFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_confidential_filter } + + chill.person.export.filter_emergency: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\EmergencyFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_emergency_filter } + + chill.person.export.filter_intensity: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\IntensityFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } + + chill.person.export.filter_activeondate: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOnDateFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activeondate_filter } + + chill.person.export.filter_activeonedaybetweendates: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOneDayBetweenDatesFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_activeonedaybetweendates_filter } + + chill.person.export.filter_referrer: + class: Chill\PersonBundle\Export\Filter\ReferrerFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter } + + chill.person.export.filter_openbetweendates: + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } + + ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml index 804fb5ff3..42ddd2181 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_period.yaml @@ -1,168 +1,16 @@ services: - ## chill.person.export.filter_accompanying_period: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AccompanyingPeriodFilter + class: Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodFilter tags: - { name: chill.export_filter, alias: person_accc_period_filter } chill.person.export.filter_accompanying_period_opening: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AccompanyingPeriodOpeningFilter + class: Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodOpeningFilter tags: - { name: chill.export_filter, alias: person_acc_pe_op_filter } chill.person.export.filter_accompanying_period_closing: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AccompanyingPeriodClosingFilter + class: Chill\PersonBundle\Export\Filter\PersonFilters\AccompanyingPeriodClosingFilter tags: - { name: chill.export_filter, alias: person_acc_pe_cl_filter } - - ## Indicators - chill.person.export.count_accompanyingcourse: - class: Chill\PersonBundle\Export\Export\CountAccompanyingCourse - autowire: true - autoconfigure: true - tags: - - { name: chill.export, alias: count_accompanyingcourse } - - chill.person.export.avg_accompanyingcourse_duration: - class: Chill\PersonBundle\Export\Export\StatAccompanyingCourseDuration - autowire: true - autoconfigure: true - tags: - - { name: chill.export, alias: avg_accompanyingcourse_duration } - - ## Filters - chill.person.export.filter_current_userscope: - class: Chill\PersonBundle\Export\Filter\CurrentUserScopeFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_current_userscope_filter } - - chill.person.export.filter_current_userjob: - class: Chill\PersonBundle\Export\Filter\CurrentUserJobFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_current_userjob_filter } - - chill.person.export.filter_socialissue: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialIssueFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_socialissue_filter } - - chill.person.export.filter_step: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\StepFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_step_filter } - - chill.person.export.filter_geographicalunitstat: - class: Chill\PersonBundle\Export\Filter\GeographicalUnitStatFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_geographicalunitstat_filter } - - chill.person.export.filter_socialaction: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\SocialActionFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_socialaction_filter } - - chill.person.export.filter_evaluation: - class: Chill\PersonBundle\Export\Filter\EvaluationFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_evaluation_filter } - - chill.person.export.filter_activitytype: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActivityTypeFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_activitytype_filter } - - chill.person.export.filter_origin: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OriginFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_origin_filter } - - chill.person.export.filter_closingmotive: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ClosingMotiveFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_closingmotive_filter } - - chill.person.export.filter_administrative_location: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\AdministrativeLocationFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_administrative_location_filter } - - chill.person.export.filter_requestor: - class: Chill\PersonBundle\Export\Filter\RequestorFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_requestor_filter } - - chill.person.export.filter_confidential: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ConfidentialFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_confidential_filter } - - chill.person.export.filter_emergency: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\EmergencyFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_emergency_filter } - - chill.person.export.filter_intensity: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\IntensityFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_intensity_filter } - - chill.person.export.filter_activeondate: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOnDateFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_activeondate_filter } - - chill.person.export.filter_activeonedaybetweendates: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ActiveOneDayBetweenDatesFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_activeonedaybetweendates_filter } - - chill.person.export.filter_referrer: - class: Chill\PersonBundle\Export\Filter\ReferrerFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_referrer_filter } - - chill.person.export.filter_openbetweendates: - class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\OpenBetweenDatesFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } - - ## Aggregators \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index f94b32ae1..c8bd9d76a 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -1,5 +1,6 @@ services: + ## Indicators chill.person.export.count_person: class: Chill\PersonBundle\Export\Export\CountPerson autowire: true @@ -24,7 +25,7 @@ services: tags: - { name: chill.export, alias: list_person_duplicate } -# FILTERS + ## Filters chill.person.export.filter_gender: class: Chill\PersonBundle\Export\Filter\PersonFilters\GenderFilter autowire: true @@ -82,7 +83,7 @@ services: tags: - { name: chill.export_filter, alias: person_nomadic_filter } -# AGGREGATORS + ## Aggregators chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator autowire: true From 95006b9643411734fe7406b3632376e377ba0b68 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 4 Aug 2022 14:12:25 +0200 Subject: [PATCH 103/191] exports: use Declarations for each applyOn --- .../Filter/PersonFilters/AccompanyingPeriodClosingFilter.php | 3 ++- .../Export/Filter/PersonFilters/AccompanyingPeriodFilter.php | 3 ++- .../Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php | 3 ++- .../Export/Filter/PersonFilters/BirthdateFilter.php | 3 ++- .../Export/Filter/PersonFilters/GenderFilter.php | 3 ++- .../Export/Filter/PersonFilters/NationalityFilter.php | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php index ab22b830d..67ebf137b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodClosingFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\AbstractAccompanyingPeriodExportElement; +use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; @@ -42,7 +43,7 @@ class AccompanyingPeriodClosingFilter extends AbstractAccompanyingPeriodExportEl public function applyOn(): string { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php index d043abdc0..b92c4cc1d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\AbstractAccompanyingPeriodExportElement; +use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; @@ -49,7 +50,7 @@ class AccompanyingPeriodFilter extends AbstractAccompanyingPeriodExportElement i public function applyOn(): string { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php index 4c4b0f85b..398e516d5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AccompanyingPeriodOpeningFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\AbstractAccompanyingPeriodExportElement; +use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\QueryBuilder; @@ -42,7 +43,7 @@ class AccompanyingPeriodOpeningFilter extends AbstractAccompanyingPeriodExportEl public function applyOn(): string { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php index 24ea14d01..e26e3697d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/BirthdateFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\ORM\Query\Expr; use Symfony\Component\Form\Extension\Core\Type\DateType; @@ -48,7 +49,7 @@ class BirthdateFilter implements ExportElementValidatedInterface, FilterInterfac public function applyOn() { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php index 26c7be868..373d9798c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/GenderFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\PersonBundle\Entity\Person; +use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -74,7 +75,7 @@ class GenderFilter implements public function applyOn() { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php index be7496d7c..d10de8f30 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NationalityFilter.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\Select2CountryType; use Chill\MainBundle\Templating\TranslatableStringHelper; +use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -57,7 +58,7 @@ class NationalityFilter implements public function applyOn() { - return 'person'; + return Declarations::PERSON_TYPE; } public function buildForm(FormBuilderInterface $builder) From faef81a90bf7d4658c4fc1d9eb8012d037aaa581 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 4 Aug 2022 14:17:23 +0200 Subject: [PATCH 104/191] moving files into separate folders for better overview --- .../CurrentUserJobFilter.php | 2 +- .../CurrentUserScopeFilter.php | 2 +- .../EvaluationFilter.php | 2 +- .../GeographicalUnitStatFilter.php | 2 +- .../RequestorFilter.php | 2 +- .../config/services/exports_accompanying_course.yaml | 10 +++++----- 6 files changed, 10 insertions(+), 10 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/CurrentUserJobFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/CurrentUserScopeFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/EvaluationFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/GeographicalUnitStatFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/RequestorFilter.php (98%) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php index 72dd39a0f..e3b63ff67 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserJob; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index aaa38f420..939a1368e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; use Chill\CustomFieldsBundle\Form\Type\ChoicesType; use Chill\MainBundle\Entity\Scope; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php index 7dd2a683d..4756f06c2 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EvaluationFilter.php @@ -1,6 +1,6 @@ Date: Thu, 4 Aug 2022 14:46:10 +0200 Subject: [PATCH 105/191] moving files into separate folders for better overview --- .../{ => SocialWorkAggregators}/JobAggregator.php | 2 +- .../ReferrerAggregator.php | 2 +- .../{ => SocialWorkAggregators}/ScopeAggregator.php | 2 +- .../Filter/{ => SocialWorkFilters}/JobFilter.php | 2 +- .../Filter/{ => SocialWorkFilters}/ScopeFilter.php | 2 +- .../{ => SocialWorkFilters}/SocialWorkTypeFilter.php | 2 +- .../config/services/exports_social_actions.yaml | 12 ++++++------ 7 files changed, 12 insertions(+), 12 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/JobAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/ReferrerAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/ScopeAggregator.php (96%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => SocialWorkFilters}/JobFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => SocialWorkFilters}/ScopeFilter.php (97%) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => SocialWorkFilters}/SocialWorkTypeFilter.php (99%) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index aa8e6f173..2177d4554 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserJobRepository; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php index 91e181012..a7ea78c3b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php similarity index 96% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index 743677d8e..aec969585 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\ScopeRepository; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index b9aaabb6f..7eb7d6142 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Entity\UserJob; use Chill\MainBundle\Export\FilterInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php similarity index 97% rename from src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index d4f4524b3..a91344645 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Filter; +namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Export\FilterInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php similarity index 99% rename from src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 8f8d70349..bf28fb695 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -1,6 +1,6 @@ Date: Thu, 4 Aug 2022 15:14:56 +0200 Subject: [PATCH 106/191] exports: add new aggregators for acp --- .../translations/messages.fr.yml | 2 + .../EvaluationAggregator.php | 104 +++++++++++++ .../OriginAggregator.php | 103 +++++++++++++ .../SocialActionAggregator.php | 99 ++++++++++++ .../SocialIssueAggregator.php | 100 ++++++++++++ .../StepAggregator.php | 142 ++++++++++++++++++ .../UserJobAggregator.php | 101 +++++++++++++ .../UserScopeAggregator.php | 99 ++++++++++++ .../CurrentUserJobFilter.php | 6 - .../CurrentUserScopeFilter.php | 8 - .../GeographicalUnitStatFilter.php | 2 +- .../SocialActionFilter.php | 8 - .../services/exports_accompanying_course.yaml | 50 +++++- .../translations/messages.fr.yml | 11 ++ 14 files changed, 811 insertions(+), 24 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index 376806292..ee6c308e0 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -188,6 +188,7 @@ Main location: Localisation principale Main scope: Cercle Main center: Centre user job: Métier de l'utilisateur +Job: Métier Choose a main center: Choisir un centre Choose a main scope: Choisir un cercle choose a job: Choisir un métier @@ -248,6 +249,7 @@ Country code: Code du pays # circles / scopes Choose the circle: Choisir le cercle +Scope: Service Scopes: Services #export diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php new file mode 100644 index 000000000..f02368fde --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -0,0 +1,104 @@ +evaluationRepository = $evaluationRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Evaluation'; + } + + $e = $this->evaluationRepository->find($value); + + return $this->translatableStringHelper->localize( + $e->getTitle() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['evaluation_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by evaluation'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('acp.works', 'acpw') + ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') + ; + + $qb->addSelect('IDENTITY(we.evaluation) AS evaluation_aggregator'); + + $groupby = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('evaluation_aggregator'); + } else { + $qb->groupBy('evaluation_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php new file mode 100644 index 000000000..2bb131435 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/OriginAggregator.php @@ -0,0 +1,103 @@ +repository = $em->getRepository(Origin::class); + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Origin'; + } + + $o = $this->repository->find($value); + + return $this->translatableStringHelper->localize( + $o->getLabel() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['origin_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by origin'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.origin', 'o'); + + $qb->addSelect('o.id AS origin_aggregator'); + + $groupby = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('origin_aggregator'); + } else { + $qb->groupBy('origin_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php new file mode 100644 index 000000000..4be8c027d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -0,0 +1,99 @@ +actionRender = $actionRender; + $this->actionRepository = $actionRepository; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function($value) { + if ('_header' === $value) { + return 'Social action'; + } + + $sa = $this->actionRepository->find($value); + + return $this->actionRender->renderString($sa, []); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['socialaction_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by social action'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.works', 'acpw'); + + $qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ?? + + $groupby = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('socialaction_aggregator'); + } else { + $qb->groupBy('socialaction_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php new file mode 100644 index 000000000..fe2830d00 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialIssueAggregator.php @@ -0,0 +1,100 @@ +issueRepository = $issueRepository; + $this->issueRender = $issueRender; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + + if ($value === '_header') { + return 'Social issues'; + } + + $i = $this->issueRepository->find($value); + + return $this->issueRender->renderString($i, []); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['socialissue_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by social issue'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.socialIssues', 'si'); + $qb->addSelect('si.id as socialissue_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('socialissue_aggregator'); + } else { + $qb->groupBy('socialissue_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php new file mode 100644 index 000000000..9b21373a8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/StepAggregator.php @@ -0,0 +1,142 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + switch ($value) { + + case AccompanyingPeriod::STEP_DRAFT: + return $this->translator->trans('Draft'); + + case AccompanyingPeriod::STEP_CONFIRMED: + return $this->translator->trans('Confirmed'); + + case AccompanyingPeriod::STEP_CLOSED: + return $this->translator->trans('Closed'); + + case '_header': + return 'Step'; + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['step_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('on_date', ChillDateType::class, [ + 'data' => new \DateTime(), + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by step'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('acp.step AS step_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('step_aggregator'); + } else { + $qb->groupBy('step_aggregator'); + } + + // add date in where clause + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->lte('acp.openingDate', ':ondate'), + $qb->expr()->orX( + $qb->expr()->gt('acp.closingDate', ':ondate'), + $qb->expr()->isNull('acp.closingDate') + ) + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } + + /* + * TODO check if we need to add FilterInterface and DescribeAction Method to describe date filter ?? + * + public function describeAction($data, $format = 'string') + { + return [ + "Filtered by actives courses: active on %ondate%", [ + '%ondate%' => $data['on_date']->format('d-m-Y') + ] + ]; + } + */ +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php new file mode 100644 index 000000000..843464fb6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php @@ -0,0 +1,101 @@ +jobRepository = $jobRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function($value): string { + if ($value === '_header') { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['userjob_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by user job'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.job', 'j'); + $qb->addSelect('IDENTITY(acp.job) AS userjob_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('userjob_aggregator'); + } else { + $qb->groupBy('userjob_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php new file mode 100644 index 000000000..3fef5b4a9 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php @@ -0,0 +1,99 @@ +scopeRepository = $scopeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize($s->getName()); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['userscope_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by user scope'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.scopes', 's'); + $qb->addSelect('s.id as userscope_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('userscope_aggregator'); + } else { + $qb->groupBy('userscope_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php index e3b63ff67..ddebbdc6f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserJobFilter.php @@ -20,23 +20,17 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; -use Symfony\Contracts\Translation\TranslatorInterface; class CurrentUserJobFilter implements FilterInterface { - - protected TranslatorInterface $translator; - private Security $security; private TranslatableStringHelper $translatableStringHelper; public function __construct( - TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper, Security $security ) { - $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; $this->security = $security; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index 939a1368e..b41347026 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -22,15 +22,9 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Security; -use Symfony\Contracts\Translation\TranslatorInterface; class CurrentUserScopeFilter implements FilterInterface { - /** - * @var TranslatorInterface - */ - protected $translator; - private Security $security; /** @@ -39,11 +33,9 @@ class CurrentUserScopeFilter implements FilterInterface private TranslatableStringHelper $translatableStringHelper; public function __construct( - TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper, Security $security ) { - $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; $this->security = $security; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index f47cc2ee1..8a18eb2fe 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -51,7 +51,7 @@ class GeographicalUnitStatFilter implements FilterInterface */ public function getTitle(): string { - return 'Filter by geographic unit'; + return 'Filter by geographical unit'; } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index bf0e5a7a5..3f61b017f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -11,15 +11,9 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; class SocialActionFilter implements FilterInterface { - /** - * @var TranslatorInterface - */ - protected $translator; - /** * @var TranslatableStringHelper */ @@ -31,11 +25,9 @@ class SocialActionFilter implements FilterInterface private SocialActionRender $actionRender; public function __construct( - TranslatorInterface $translator, TranslatableStringHelper $translatableStringHelper, SocialActionRender $actionRender ) { - $this->translator = $translator; $this->translatableStringHelper = $translatableStringHelper; $this->actionRender = $actionRender; } diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 5a7b6c8d5..236c7fe96 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -149,4 +149,52 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } - ## Aggregators \ No newline at end of file + ## Aggregators + chill.person.export.aggregator_userscope: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserScopeAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_userscope_aggregator } + + chill.person.export.aggregator_userjob: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_userjob_aggregator } + + chill.person.export.aggregator_socialissue: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialIssueAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_socialissue_aggregator } + + chill.person.export.aggregator_step: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\StepAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_step_aggregator } + + chill.person.export.aggregator_socialaction: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialActionAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_socialaction_aggregator } + + chill.person.export.aggregator_evaluation: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\EvaluationAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_evaluation_aggregator } + + chill.person.export.aggregator_origin: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\OriginAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_origin_aggregator } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index fdb38a041..be32253e0 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -203,6 +203,7 @@ This accompanying course is still a draft: Ce parcours est encore à l'état bro Associated peoples: Usagers concernés Resources: Interlocuteurs privilégiés Any requestor to this accompanying course: Aucun demandeur pour ce parcours +Social action: Action d'accompagnement Social actions: Actions d'accompagnement Last social actions: Les dernières actions d'accompagnement Social issue: Problématique sociale @@ -411,25 +412,34 @@ Having an accompanying period closed after this date: Ayant une période d'accom Filter by user scope: Filtrer par service du référent "Filtered by user main scope: only %scope%": "Filtré par service du référent: uniquement %scope%" +Group by user scope: Grouper par service du référent Filter by user job: Filtrer par métier du référent "Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" +Group by user job: Grouper par métier du référent Filter by social issue: Filtrer par problématiques sociales Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" +Group by social issue: Grouper par problématiques sociales Filter by step: Filtrer par statut du parcours Accepted steps: Statuts +Step: Statut "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" +Group by step: Grouper par statut du parcours +Filter by geographical unit: Filtrer par zone géographique Filter by socialaction: Filtrer par action d'accompagnement Accepted socialactions: Actions d'accompagnement "Filtered by socialactions: only %socialactions%": "Filtré par action d'accompagnement: uniquement %socialactions%" +Group by social action: Grouper par action d'accompagnement Filter by evaluation: Filtrer par évaluation Accepted evaluations: Évaluations +Evaluation: Évaluation "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" +Group by evaluation: Grouper par évaluation Filter by activity type: Filtrer par type d'activité Accepted activitytypes: Types d'activités @@ -438,6 +448,7 @@ Accepted activitytypes: Types d'activités Filter by origin: Filtrer par origine du parcours Accepted origins: Origines "Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" +Group by origin: Grouper par origine du parcours Filter by closing motive: Filtrer par motif de fermeture Accepted closingmotives: Motifs de clôture From 643f37509fb9b84137c3bb97d77e342ea676fe8e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 8 Aug 2022 16:12:34 +0200 Subject: [PATCH 107/191] exports: share Scope and Job Aggregators --- .../translations/messages.fr.yml | 4 +- ...serJobAggregator.php => JobAggregator.php} | 38 ++++++-- ...copeAggregator.php => ScopeAggregator.php} | 42 +++++++-- .../SocialWorkAggregators/JobAggregator.php | 86 ------------------- .../SocialWorkAggregators/ScopeAggregator.php | 86 ------------------- .../Export/Filter/ReferrerFilter.php | 8 +- .../services/exports_accompanying_course.yaml | 12 +-- .../services/exports_social_actions.yaml | 14 --- 8 files changed, 74 insertions(+), 216 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{AccompanyingCourseAggregators/UserJobAggregator.php => JobAggregator.php} (64%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{AccompanyingCourseAggregators/UserScopeAggregator.php => ScopeAggregator.php} (60%) delete mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php delete mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php diff --git a/src/Bundle/ChillMainBundle/translations/messages.fr.yml b/src/Bundle/ChillMainBundle/translations/messages.fr.yml index ee6c308e0..1e95e32d0 100644 --- a/src/Bundle/ChillMainBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillMainBundle/translations/messages.fr.yml @@ -249,8 +249,8 @@ Country code: Code du pays # circles / scopes Choose the circle: Choisir le cercle -Scope: Service -Scopes: Services +Scope: Cercle +Scopes: Cercles #export diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php similarity index 64% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php index 843464fb6..9793dd875 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserJobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php @@ -1,15 +1,16 @@ join('acp.job', 'j'); - $qb->addSelect('IDENTITY(acp.job) AS userjob_aggregator'); + switch ($this->getBaseEntityAppliedOn($qb)) { + + case 'acp': + $qb->join('acp.job', 'j'); + $qb->addSelect('IDENTITY(acp.job) AS job_aggregator'); + break; + + case 'acpw': + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('IDENTITY(r.userJob) as job_aggregator'); + break; + + default: + throw new \Exception("Does not apply on that base entity"); + } $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { - $qb->addGroupBy('userjob_aggregator'); + $qb->addGroupBy('job_aggregator'); } else { - $qb->groupBy('userjob_aggregator'); + $qb->groupBy('job_aggregator'); } } @@ -96,6 +110,14 @@ final class UserJobAggregator implements AggregatorInterface */ public function applyOn(): string { - return Declarations::ACP_TYPE; + return Declarations::ACP_SHARED; + } + + private function getBaseEntityAppliedOn(QueryBuilder $qb): string + { + /** @var From $from */ + $from = $qb->getDQLPart('from'); + + return $from[0]->getAlias(); } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php similarity index 60% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php index 3fef5b4a9..d6d6d5a58 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/UserScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php @@ -1,15 +1,16 @@ scopeRepository->find($value); - return $this->translatableStringHelper->localize($s->getName()); + return $this->translatableStringHelper->localize( + $s->getName() + ); }; } @@ -45,7 +48,7 @@ final class UserScopeAggregator implements AggregatorInterface */ public function getQueryKeys($data): array { - return ['userscope_aggregator']; + return ['scope_aggregator']; } /** @@ -77,15 +80,28 @@ final class UserScopeAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.scopes', 's'); - $qb->addSelect('s.id as userscope_aggregator'); + switch ($this->getBaseEntityAppliedOn($qb)) { + + case 'acp': + $qb->join('acp.scopes', 's'); + $qb->addSelect('s.id as scope_aggregator'); + break; + + case 'acpw': + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('IDENTITY(r.mainScope) as scope_aggregator'); + break; + + default: + throw new \Exception("Does not apply on that base entity"); + } $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { - $qb->addGroupBy('userscope_aggregator'); + $qb->addGroupBy('scope_aggregator'); } else { - $qb->groupBy('userscope_aggregator'); + $qb->groupBy('scope_aggregator'); } } @@ -94,6 +110,14 @@ final class UserScopeAggregator implements AggregatorInterface */ public function applyOn(): string { - return Declarations::ACP_TYPE; + return Declarations::ACP_SHARED; + } + + private function getBaseEntityAppliedOn(QueryBuilder $qb): string + { + /** @var From $from */ + $from = $qb->getDQLPart('from'); + + return $from[0]->getAlias(); } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php deleted file mode 100644 index 2177d4554..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ /dev/null @@ -1,86 +0,0 @@ -userJobRepository = $userJobRepository; - $this->translatableStringHelper = $translatableStringHelper; - } - - public function addRole() - { - return null; - } - - public function alterQuery(QueryBuilder $qb, $data) - { - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.userJob) as job_aggregator'); - - $groupBy = $qb->getDQLPart('groupBy'); - - if (!empty($groupBy)) { - $qb->addGroupBy('job_aggregator'); - } else { - $qb->groupBy('job_aggregator'); - } - - } - - public function applyOn() - { - return Declarations::SOCIAL_WORK_ACTION_TYPE; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'User job'; - } - - $j = $this->userJobRepository->find($value); - - return $this->translatableStringHelper->localize( - $j->getLabel()); - }; - } - - public function getQueryKeys($data) - { - return ['job_aggregator']; - } - - public function getTitle() - { - return 'Group social work actions by referrer job'; - } -} diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php deleted file mode 100644 index aec969585..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ /dev/null @@ -1,86 +0,0 @@ -scopeRepository = $scopeRepository; - $this->translatableStringHelper = $translatableStringHelper; - } - - public function addRole() - { - return null; - } - - public function alterQuery(QueryBuilder $qb, $data) - { - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.mainScope) as scope_aggregator'); - - $groupBy = $qb->getDQLPart('groupBy'); - - if (!empty($groupBy)) { - $qb->addGroupBy('scope_aggregator'); - } else { - $qb->groupBy('scope_aggregator'); - } - - } - - public function applyOn() - { - return Declarations::SOCIAL_WORK_ACTION_TYPE; - } - - public function buildForm(FormBuilderInterface $builder) - { - // no form - } - - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'User scope'; - } - - $s = $this->scopeRepository->find($value); - - return $this->translatableStringHelper->localize( - $s->getName()); - }; - } - - public function getQueryKeys($data) - { - return ['scope_aggregator']; - } - - public function getTitle() - { - return 'Group social work actions by referrer scope'; - } -} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php index bac2656c6..5aac709c4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -78,10 +78,8 @@ class ReferrerFilter implements FilterInterface $where = $qb->getDQLPart('where'); - $from_alias = $this->getEntityFromQB($qb); - // Use querybuilder from alias to find which export context (indicator) - switch ($from_alias) { + switch ($this->getBaseEntityAppliedOn($qb)) { case 'acp': $clause = $qb->expr()->in('acp.user', ':referrers'); break; @@ -92,7 +90,7 @@ class ReferrerFilter implements FilterInterface break; default: - throw new \Exception("Referrer filter doesn't apply on that entity"); + throw new \Exception("Does not apply on that base entity"); } if ($where instanceof Andx) { @@ -105,7 +103,7 @@ class ReferrerFilter implements FilterInterface $qb->setParameter('referrers', $data['accepted_referrers']); } - private function getEntityFromQB(QueryBuilder $qb): string + private function getBaseEntityAppliedOn(QueryBuilder $qb): string { /** @var From $from */ $from = $qb->getDQLPart('from'); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 236c7fe96..726c84599 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -150,19 +150,19 @@ services: - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } ## Aggregators - chill.person.export.aggregator_userscope: - class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserScopeAggregator + chill.person.export.aggregator_scope: + class: Chill\PersonBundle\Export\Aggregator\ScopeAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: accompanyingcourse_userscope_aggregator } + - { name: chill.export_aggregator, alias: accompanyingcourse_scope_aggregator } - chill.person.export.aggregator_userjob: - class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\UserJobAggregator + chill.person.export.aggregator_job: + class: Chill\PersonBundle\Export\Aggregator\JobAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: accompanyingcourse_userjob_aggregator } + - { name: chill.export_aggregator, alias: accompanyingcourse_job_aggregator } chill.person.export.aggregator_socialissue: class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialIssueAggregator diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 1d4023b4d..b655afaa6 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -37,20 +37,6 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator } - - chill.person.export.aggregator_job: - class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator - autowire: true - autoconfigure: true - tags: - - { name: chill.export_aggregator, alias: social_work_actions_job_aggregator } - - chill.person.export.aggregator_scope: - class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator - autowire: true - autoconfigure: true - tags: - - { name: chill.export_aggregator, alias: social_work_actions_scope_aggregator } chill.person.export.aggregator_action_type: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator From ec7325ebbdb1dcc339a21d01c1d7f7348fa92185 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 8 Aug 2022 16:36:01 +0200 Subject: [PATCH 108/191] exports: add a new ClosingMotive aggregator --- .../ClosingMotiveAggregator.php | 103 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 9 +- .../translations/messages.fr.yml | 1 + 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php new file mode 100644 index 000000000..198cacea7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ClosingMotiveAggregator.php @@ -0,0 +1,103 @@ +motiveRepository = $em->getRepository(ClosingMotive::class); + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Closing motive'; + } + + $cm = $this->motiveRepository->find($value); + + return $this->translatableStringHelper->localize( + $cm->getName() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data) + { + return ['closingmotive_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by closing motive'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.closingMotive', 'cm'); + + $qb->addSelect('IDENTITY(acp.closingMotive) AS closingmotive_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('closingmotive_aggregator'); + } else { + $qb->groupBy('closingmotive_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 726c84599..1aae1d1fa 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -197,4 +197,11 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: accompanyingcourse_origin_aggregator } \ No newline at end of file + - { name: chill.export_aggregator, alias: accompanyingcourse_origin_aggregator } + + chill.person.export.aggregator_closingmotive: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ClosingMotiveAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_closingmotive_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index be32253e0..767061f55 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -453,6 +453,7 @@ Group by origin: Grouper par origine du parcours Filter by closing motive: Filtrer par motif de fermeture Accepted closingmotives: Motifs de clôture "Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%" +Group by closing motive: Grouper par motif de fermeture Filter by administrative location: Filtrer par localisation administrative Accepted locations: Localisations administratives From ace2cb6151fc1360bffcbdb5e5d02c73ab1406a0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 8 Aug 2022 16:59:03 +0200 Subject: [PATCH 109/191] exports: add new AdministrativeLocation aggregator --- .../AdministrativeLocationAggregator.php | 100 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 7 ++ .../translations/messages.fr.yml | 2 + 3 files changed, 109 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php new file mode 100644 index 000000000..8d421f369 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/AdministrativeLocationAggregator.php @@ -0,0 +1,100 @@ +locationRepository = $locationRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Administrative location'; + } + + $l = $this->locationRepository->find($value); + + return $l->getName() .' ('. $this->translatableStringHelper->localize($l->getLocationType()->getTitle()) . ')'; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['location_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle() + { + return 'Group by administrative location'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.administrativeLocation', 'al'); + + $qb->addSelect('IDENTITY(acp.administrativeLocation) AS location_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('location_aggregator'); + } else { + $qb->groupBy('location_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 1aae1d1fa..45c818ffb 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -205,3 +205,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: accompanyingcourse_closingmotive_aggregator } + + chill.person.export.aggregator_administrative_location: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\AdministrativeLocationAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_administrative_location_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 767061f55..14505de45 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -457,7 +457,9 @@ Group by closing motive: Grouper par motif de fermeture Filter by administrative location: Filtrer par localisation administrative Accepted locations: Localisations administratives +Administrative location: Localisation administrative "Filtered by administratives locations: only %locations%": "Filtré par localisation administrative: uniquement %locations%" +Group by administrative location: Grouper par localisation administrative Filter by requestor: Filtrer les parcours selon la présence du demandeur au sein des usagers concernés Accepted choices: '' From 5940e2c0b74b66cb4d0458a86a62e5afeb5ab2b0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 8 Aug 2022 17:39:53 +0200 Subject: [PATCH 110/191] exports: add new Confidential and Emergency Aggregators --- .../ConfidentialAggregator.php | 100 ++++++++++++++++++ .../EmergencyAggregator.php | 100 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 14 +++ .../translations/messages.fr.yml | 4 + 4 files changed, 218 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php new file mode 100644 index 000000000..d2bec5c32 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ConfidentialAggregator.php @@ -0,0 +1,100 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Confidentiality'; + } + switch ($value) { + + case true: + return $this->translator->trans('is confidential'); + + case false: + return $this->translator->trans('is not confidential'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + return $value; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['confidential_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by confidential'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('acp.confidential AS confidential_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('confidential_aggregator'); + } else { + $qb->groupBy('confidential_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php new file mode 100644 index 000000000..c5991e7f0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EmergencyAggregator.php @@ -0,0 +1,100 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Emergency'; + } + switch ($value) { + + case true: + return $this->translator->trans('is emergency'); + + case false: + return $this->translator->trans('is not emergency'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + return $value; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['emergency_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by emergency'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('acp.emergency AS emergency_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('emergency_aggregator'); + } else { + $qb->groupBy('emergency_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 45c818ffb..5a97f1b85 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -212,3 +212,17 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: accompanyingcourse_administrative_location_aggregator } + + chill.person.export.aggregator_confidential: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ConfidentialAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_confidential_aggregator } + + chill.person.export.aggregator_emergency: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\EmergencyAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_emergency_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 14505de45..1bfd1f5c3 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -474,12 +474,16 @@ Accepted confidentials: '' is confidential: le parcours est confidentiel is not confidential: le parcours n'est pas confidentiel "Filtered by confidential: only %confidential%": "Filtré par confidentialité: uniquement si %confidential%" +Confidentiality: Confidentialité +Group by confidential: Grouper par confidentialité Filter by emergency: Filtrer par urgence Accepted emergencies: '' is emergency: le parcours est urgent is not emergency: le parcours n'est pas urgent "Filtered by emergency: only %emergency%": "Filtré par urgence: uniquement si %emergency%" +Emergency: Urgence +Group by emergency: Grouper par urgence Filter by intensity: Filtrer par intensité Accepted intensities: '' From f817ca96712bc2224b713931bc195c8ccacd600a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 11:11:53 +0200 Subject: [PATCH 111/191] exports: add a new intensity aggregator --- .../IntensityAggregator.php | 96 +++++++++++++++++++ .../services/exports_accompanying_course.yaml | 7 ++ .../translations/messages.fr.yml | 2 + 3 files changed, 105 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php new file mode 100644 index 000000000..8da38b766 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/IntensityAggregator.php @@ -0,0 +1,96 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Intensity'; + } + switch ($value) { + case 'occasional': + return $this->translator->trans('is occasional'); + case 'regular': + return $this->translator->trans('is regular'); + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['intensity_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by intensity'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('acp.intensity AS intensity_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('intensity_aggregator'); + } else { + $qb->groupBy('intensity_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 5a97f1b85..019bf6fd1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -226,3 +226,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: accompanyingcourse_emergency_aggregator } + + chill.person.export.aggregator_intensity: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\IntensityAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_intensity_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 1bfd1f5c3..8e3c7f389 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -490,6 +490,8 @@ Accepted intensities: '' is occasional: le parcours est ponctuel is regular: le parcours est régulier "Filtered by intensity: only %intensity%": "Filtré par intensité: uniquement si %intensity%" +Intensity: Intensité +Group by intensity: Grouper par intensité Filtered by active on date: Filtrer les parcours actifs à une date On date: Actifs à cette date From ed1dde4713f4be32c113734b04dc3877692d9a2e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 11:30:42 +0200 Subject: [PATCH 112/191] exports: share referrer aggregator --- .../ReferrerAggregator.php | 50 +++++++++++++++---- .../services/exports_accompanying_course.yaml | 8 +++ .../services/exports_social_actions.yaml | 7 --- .../translations/messages.fr.yml | 1 + 4 files changed, 48 insertions(+), 18 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{SocialWorkAggregators => }/ReferrerAggregator.php (52%) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php similarity index 52% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php index a7ea78c3b..3f9344212 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php @@ -9,11 +9,13 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; +namespace Chill\PersonBundle\Export\Aggregator; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Templating\Entity\UserRender; use Chill\PersonBundle\Export\Declarations; +use Doctrine\ORM\Query\Expr\From; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -21,9 +23,14 @@ final class ReferrerAggregator implements AggregatorInterface { private UserRepository $userRepository; - public function __construct(UserRepository $userRepository) - { + private UserRender $userRender; + + public function __construct( + UserRepository $userRepository, + UserRender $userRender + ) { $this->userRepository = $userRepository; + $this->userRender = $userRender; } public function addRole() @@ -33,8 +40,21 @@ final class ReferrerAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('r.id as referrer_aggregator'); + switch ($this->getBaseEntityAppliedOn($qb)) { + + case 'acp': + $qb->join('acp.user', 'u'); + $qb->addSelect('u.id AS referrer_aggregator'); + break; + + case 'acpw': + $qb->join('acpw.referrers', 'r'); + $qb->addSelect('r.id AS referrer_aggregator'); + break; + + default: + throw new \Exception("Does not apply on that base entity"); + } $groupBy = $qb->getDQLPart('groupBy'); @@ -46,9 +66,9 @@ final class ReferrerAggregator implements AggregatorInterface } - public function applyOn() + public function applyOn(): string { - return Declarations::SOCIAL_WORK_ACTION_TYPE; + return Declarations::ACP_SHARED; } public function buildForm(FormBuilderInterface $builder) @@ -65,17 +85,25 @@ final class ReferrerAggregator implements AggregatorInterface $r = $this->userRepository->find($value); - return $r->getUsername(); + return $this->userRender->renderString($r, []); }; } - public function getQueryKeys($data) + public function getQueryKeys($data): array { return ['referrer_aggregator']; } - public function getTitle() + public function getTitle(): string { - return 'Group social work actions by referrers'; + return 'Group by referrers'; + } + + private function getBaseEntityAppliedOn(QueryBuilder $qb): string + { + /** @var From $from */ + $from = $qb->getDQLPart('from'); + + return $from[0]->getAlias(); } } diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 019bf6fd1..592df7573 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -233,3 +233,11 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: accompanyingcourse_intensity_aggregator } + + chill.person.export.aggregator_referrer: + class: Chill\PersonBundle\Export\Aggregator\ReferrerAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_referrer_aggregator } + diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index b655afaa6..266b8db75 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -31,13 +31,6 @@ services: - { name: chill.export_filter, alias: social_work_actions_job_filter } ## AGGREGATORS - chill.person.export.aggregator_referrer: - class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator - autowire: true - autoconfigure: true - tags: - - { name: chill.export_aggregator, alias: social_work_actions_referrer_aggregator } - chill.person.export.aggregator_action_type: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 8e3c7f389..3d30b5c9f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -504,6 +504,7 @@ Filtered by active at least one day between dates: Filtrer les parcours actifs a Filtered by referrers: Filtrer par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" +Group by referrers: Grouper par référent Filtered by opened between dates: Filtrer les parcours ouverts entre deux dates Date from: Date de début From b8bb0b1209cc63f9d41fcf2e18be72bcc8391036 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 15:11:01 +0200 Subject: [PATCH 113/191] exports: improve translations --- .../translations/messages.fr.yml | 6 +++--- .../translations/messages.nl.yaml | 6 +++--- .../translations/messages.fr.yml | 20 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 4296e6d76..1c9a37f99 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -240,9 +240,9 @@ By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet Group by reasons: Sujet d'activité -Aggregate by activity user: Aggréger par utilisateur lié à l'activité -Aggregate by activity type: Aggréger par type d'activité -Aggregate by activity reason: Aggréger par sujet de l'activité +Aggregate by activity user: Grouper par utilisateur lié à l'activité +Aggregate by activity type: Grouper par type d'activité +Aggregate by activity reason: Grouper par sujet de l'activité Last activities: Les dernières activités diff --git a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml index 8d7cc293a..d24eacf0a 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml +++ b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml @@ -217,9 +217,9 @@ By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet Group by reasons: Sujet d'activité -Aggregate by activity user: Aggréger par utilisateur lié à l'activité -Aggregate by activity type: Aggréger par type d'activité -Aggregate by activity reason: Aggréger par sujet de l'activité +Aggregate by activity user: Grouper par utilisateur lié à l'activité +Aggregate by activity type: Grouper par type d'activité +Aggregate by activity reason: Grouper par sujet de l'activité Last activities: Les dernières activités diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3d30b5c9f..9b0d72fbf 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -386,11 +386,11 @@ The minimum age should be less than the maximum age.: L'âge minimum doit être Family composition: Composition familiale Family composition at this time: Composition familiale à cette date. -Filtered by entrusted child status: Uniquement les personnes qui sont "enfant confié" -Filter by entrusted child status: Uniquement les personnes qui sont "enfant confié" +Filter by entrusted child status: Filtrer les usagers qui sont "enfant confié" +Filtered by entrusted child status: Uniquement les usagers qui sont "enfant confié" -Filtered by nomadic status: Uniquement les personnes qui sont "gens de voyage" -Filter by nomadic status: Uniquement les personnes qui sont "gens de voyage" +Filter by nomadic status: Filtrer les usagers qui sont "gens de voyage" +Filtered by nomadic status: Uniquement les usagers qui sont "gens de voyage" Filtered by person's who have a residential address located at another user: Uniquement les usagers qui ont une addresse de résidence chez un autre usager @@ -512,19 +512,19 @@ Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" ## aggregators -Group people by nationality: Aggréger les personnes par nationalités +Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau Group by continents: Grouper par continent Group by country: Grouper par pays -Group people by gender: Aggréger les personnes par genre -Group people by their professional situation: Aggréger les personnes par situation professionelle -Group people by marital status: Aggréger les personnes par état matrimonial +Group people by gender: Grouper les personnes par genre +Group people by their professional situation: Grouper les personnes par situation professionelle +Group people by marital status: Grouper les personnes par état matrimonial -Aggregate by age: Aggréger par âge +Aggregate by age: Grouper par âge Calculate age in relation to this date: Calculer l'âge par rapport à cette date -Group people by country of birth: Aggréger les personnes par pays de naissance +Group people by country of birth: Grouper les personnes par pays de naissance Similar persons: Personnes similaires crud: From 72a5a6cd2704be839062577782e242447d470206 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 15:15:27 +0200 Subject: [PATCH 114/191] hop --- .../Export/CountActivityLinkedToACP.php | 6 +++++- .../Export/Export/StatActivityDuration.php | 7 ++++++- .../config/services/export.yaml | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php index 02a358156..c182145a8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php @@ -99,7 +99,11 @@ class CountActivityLinkedToACP implements ExportInterface, GroupedExportInterfac public function supportsModifiers() { - return [ExportDeclarations::PERSON_TYPE, Declarations::ACTIVITY, ExportDeclarations::ACP_SHARED]; + return [ + ExportDeclarations::PERSON_TYPE, + Declarations::ACTIVITY, + ExportDeclarations::ACP_SHARED + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php index 5493046c2..5793c2b06 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php @@ -17,6 +17,8 @@ use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; +use Chill\PersonBundle\Export\Declarations as Person_Declarations; +use Chill\ActivityBundle\Export\Declarations as Activity_Declarations; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -127,7 +129,10 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function supportsModifiers() { - return ['person', 'activity']; + return [ + Person_Declarations::PERSON_TYPE, + Activity_Declarations::ACTIVITY + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index daef12fed..366c9c1b1 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -3,6 +3,7 @@ services: autowire: true autoconfigure: true + ## Indicators chill.activity.export.count_activity: class: Chill\ActivityBundle\Export\Export\CountActivity tags: @@ -13,16 +14,17 @@ services: tags: - { name: chill.export, alias: 'count_activity_linked_to_acp' } - # chill.activity.export.sum_activity_duration: - # class: Chill\ActivityBundle\Export\Export\StatActivityDuration - # tags: - # - { name: chill.export, alias: 'sum_activity_duration' } + chill.activity.export.sum_activity_duration: + class: Chill\ActivityBundle\Export\Export\StatActivityDuration + tags: + - { name: chill.export, alias: 'sum_activity_duration' } - # chill.activity.export.list_activity: - # class: Chill\ActivityBundle\Export\Export\ListActivity - # tags: - # - { name: chill.export, alias: 'list_activity' } + chill.activity.export.list_activity: + class: Chill\ActivityBundle\Export\Export\ListActivity + tags: + - { name: chill.export, alias: 'list_activity' } + ## Filters chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter tags: @@ -45,6 +47,7 @@ services: name: chill.export_filter alias: 'activity_person_having_ac_bw_date_filter' + ## Aggregators chill.activity.export.reason_aggregator: class: Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator tags: From 93d0fbead509cddec7e7a0f524a705780c903588 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 16:06:32 +0200 Subject: [PATCH 115/191] exports: create new indicator to count evaluations --- .../ChillPersonExtension.php | 1 + .../ChillPersonBundle/Export/Declarations.php | 6 +- .../Export/Export/CountEvaluation.php | 135 ++++++++++++++++++ .../Export/Export/CountPerson.php | 6 +- .../config/services/exports_evaluation.yaml | 13 ++ .../translations/messages.fr.yml | 4 + 6 files changed, 162 insertions(+), 3 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php create mode 100644 src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 5818ef2ba..bf73b4f81 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -100,6 +100,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac } $loader->load('services/exports_accompanying_course.yaml'); $loader->load('services/exports_social_actions.yaml'); + $loader->load('services/exports_evaluation.yaml'); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index 72d702aa2..5a88d988b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -22,7 +22,9 @@ abstract class Declarations public const ACP_TYPE = 'accompanying_period'; - public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; - public const ACP_SHARED = 'accompanying_period_shared'; + + public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; + + public const EVAL_TYPE = 'evaluation'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php new file mode 100644 index 000000000..985a69df6 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -0,0 +1,135 @@ +evaluationRepository = $em->getRepository(Evaluation::class); + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // TODO: Implement buildForm() method. + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Count evaluations'; + } + + /** + * @inheritDoc + */ + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + /** + * @inheritDoc + */ + public function getDescription(): string + { + return 'Count evaluation by various parameters.'; + } + + /** + * @inheritDoc + */ + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['export_result']; + } + + /** + * @inheritDoc + */ + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + /** + * @inheritDoc + */ + public function getType(): string + { + return Declarations::EVAL_TYPE; + } + + /** + * @inheritDoc + */ + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $qb = $this->evaluationRepository->createQueryBuilder('eval'); + + $qb->select('COUNT(eval.id) AS export_result'); + + return $qb; + } + + /** + * @inheritDoc + */ + public function requiredRole() + { + return new Role(AccompanyingPeriodVoter::STATS); + } + + /** + * @inheritDoc + */ + public function supportsModifiers(): array + { + return [ + Declarations::EVAL_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of evaluations'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index 96f669524..a2f3842e7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -111,7 +111,11 @@ class CountPerson implements ExportInterface, GroupedExportInterface public function supportsModifiers() { - return [Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN, Declarations::ACP_SHARED]; + return [ + Declarations::PERSON_TYPE, + Declarations::PERSON_IMPLIED_IN, + Declarations::ACP_SHARED + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml new file mode 100644 index 000000000..03cd37ee3 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml @@ -0,0 +1,13 @@ +services: + + ## Indicators + chill.person.export.count_evaluation: + class: Chill\PersonBundle\Export\Export\CountEvaluation + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_evaluation } + + ## Filters + ## Aggregators + \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9b0d72fbf..750bbf0ba 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -350,6 +350,10 @@ Exports of social work actions: Exports des actions d'accompangement Count social work actions: Nombre d'actions d'accompagnement Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. +Exports of evaluations: Exports des évaluations +Count evaluations: Nombre d'évaluations +Count evaluation by various parameters.: Compte le nombre d'évaluations selon différents filtres. + ## filters Filter by person gender: Filtrer par genre de la personne Accepted genders: Genres acceptés From 9a2af662c0b28eb3f46566831c1018999c180049 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:13:24 +0200 Subject: [PATCH 116/191] use translatablestringhelper --- .../PersonAggregators/MaritalStatusAggregator.php | 12 +++++++----- .../SocialWorkAggregators/ActionTypeAggregator.php | 9 +++++---- .../SocialWorkAggregators/GoalAggregator.php | 8 ++++++-- .../SocialWorkAggregators/ResultAggregator.php | 6 +++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php index ec15be45f..3d4c1f7cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/MaritalStatusAggregator.php @@ -12,21 +12,23 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use Chill\MainBundle\Export\AggregatorInterface; -use Chill\PersonBundle\Entity\Person; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\MaritalStatusRepository; use Doctrine\ORM\QueryBuilder; -use LogicException; use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Contracts\Translation\TranslatorInterface; + final class MaritalStatusAggregator implements AggregatorInterface { private MaritalStatusRepository $maritalStatusRepository; - public function __construct(MaritalStatusRepository $maritalStatusRepository) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(MaritalStatusRepository $maritalStatusRepository, TranslatableStringHelper $translatableStringHelper) { $this->maritalStatusRepository = $maritalStatusRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -66,7 +68,7 @@ final class MaritalStatusAggregator implements AggregatorInterface $g = $this->maritalStatusRepository->find($value); - return $g->getName()['fr']; + return $this->translatableStringHelper->localize($g->getName()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php index 2567ea378..d8f485561 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ActionTypeAggregator.php @@ -12,9 +12,9 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; -use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -22,11 +22,12 @@ final class ActionTypeAggregator implements AggregatorInterface { private SocialActionRepository $socialActionRepository; - private SocialActionRender $socialActionRender; + private TranslatableStringHelper $translatableStringHelper; - public function __construct(SocialActionRepository $socialActionRepository) + public function __construct(SocialActionRepository $socialActionRepository, TranslatableStringHelper $translatableStringHelper) { $this->socialActionRepository = $socialActionRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -69,7 +70,7 @@ final class ActionTypeAggregator implements AggregatorInterface $sa = $this->socialActionRepository->find($value); - return $sa->getTitle()['fr']; + return $this->translatableStringHelper->localize($sa->getTitle()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php index d3b277a16..cb908ef3e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/GoalAggregator.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\GoalRepository; use Doctrine\ORM\QueryBuilder; @@ -21,9 +22,12 @@ final class GoalAggregator implements AggregatorInterface { private GoalRepository $goalRepository; - public function __construct(GoalRepository $goalRepository) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(GoalRepository $goalRepository, TranslatableStringHelper $translatableStringHelper) { $this->goalRepository = $goalRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -65,7 +69,7 @@ final class GoalAggregator implements AggregatorInterface $g = $this->goalRepository->find($value); - return $g->getTitle()['fr']; + return $this->translatableStringHelper->localize($g->getTitle()); }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 476b6f840..424010138 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -33,8 +33,8 @@ final class ResultAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.results', 'r'); - $qb->addSelect('r.id as result_aggregator'); + $qb->join('acpw.results', 'res'); + $qb->addSelect('res.id as result_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); @@ -65,7 +65,7 @@ final class ResultAggregator implements AggregatorInterface $g = $this->resultRepository->find($value); - return $g->getTitle()['fr']; + return $this->translatableStringHelper->localize($g->getTitle()); }; } From a3cae28613e16fd6b6f2020b3cb82a28fca53426 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:14:01 +0200 Subject: [PATCH 117/191] residential address at thirdparty filter : not done! --- .../ResidentialAddressAtThirdpartyFilter.php | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php new file mode 100644 index 000000000..83f09bb0d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -0,0 +1,87 @@ +add('thirdparty_type', EntityType::class, [ + 'class' => ThirdPartyCategory::class, + 'choice_label' => function (ThirdPartyCategory $tpc) { + return $this->translatableStringHelper->localize($tpc->getName()); + }, + 'multiple' => true, + 'expanded' => true + ]); + + $builder->add('date_calc', ChillDateType::class, [ + 'label' => 'Date during which residential address was valid', + 'data' => new DateTime('now'), + ]); + } + + public function alterQuery(QueryBuilder $qb, $data) + { + + //TODO: Query is not finished... not clear what 'catégorie' corresponds with. Cannot get values to appear in table thirdparty_category + $qb->resetDQLPart('from'); + $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra'); + + $qb->join('ra.person', 'person'); + $qb->join('person.center', 'center'); + $qb->join('ra.hostThirdparty', 'thirdparty'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->andX( + $qb->expr()->isNotNull('ra.hostThirdparty'), + // $qb->expr()->in('thirdparty.categories') + ); + + if ($where instanceof Expr\Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + } + + public function applyOn() + { + return Declarations::PERSON_TYPE; + } + + + public function describeAction($data, $format = 'string') + { + return ['Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type%']; + } + + public function getTitle() + { + return 'Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type%'; + } +} \ No newline at end of file From 6010559936e78806343b1aaabe004a2a7976448f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:14:17 +0200 Subject: [PATCH 118/191] translations added --- .../ChillPersonBundle/translations/messages.fr.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3d30b5c9f..13f92dafd 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -330,14 +330,15 @@ Accompanyied people: Personnes accompagnées ## exports Exports of persons: Exports des personnes -Count people by various parameters.: Compte le nombre de personnes en fonction de différents filtres. -Count people: Nombre de personnes +Count people by various parameters.: Compte le nombre d'usagers en fonction de différents filtres. +Count people: Nombre d'usagers List peoples: Liste des personnes Create a list of people according to various filters.: Crée une liste des personnes selon différents filtres. Fields to include in export: Champs à inclure dans l'export Address valid at this date: Addresse valide à cette date List duplicates: Liste des doublons Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. +Count people with an accompanying course by various parameters.: Nombre d'usagers concernées par un parcours Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours @@ -383,6 +384,9 @@ Minimum age: Âge minimum Maximum age: Âge maximum The minimum age should be less than the maximum age.: L'âge minimum doit être plus bas que l'âge maximum. +Date during which residential address was valid: Date de validité +Filtered by person\'s who have a residential address located at a thirdparty of type %thirparty_type%: Uniquement les usagers qui ont une addresse de résidence chez un tiers de catégorie %thirdparty_type% + Family composition: Composition familiale Family composition at this time: Composition familiale à cette date. @@ -418,6 +422,8 @@ Filter by user job: Filtrer par métier du référent "Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" Group by user job: Grouper par métier du référent +Filter by scope: Filtrer par service + Filter by social issue: Filtrer par problématiques sociales Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" @@ -441,6 +447,10 @@ Evaluation: Évaluation "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" Group by evaluation: Grouper par évaluation +Group social work actions by action type: Grouper par type d'action +Group social work actions by goal: Grouper par objectif +Group social work actions by result: Grouper par résultat + Filter by activity type: Filtrer par type d'activité Accepted activitytypes: Types d'activités "Filtered by activity types: only %activitytypes%": "Filtré par type d'activité: seulement %activitytypes%" From 5b4b7473c5eea840ed8322d56a09ba90f9f31ed7 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:14:41 +0200 Subject: [PATCH 119/191] residential address at user filter done --- .../Filter/PersonFilters/ResidentialAddressAtUserFilter.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index a05e8ef7d..9558c5940 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -26,7 +26,7 @@ class ResidentialAddressAtUserFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->resetDQLPart('from'); - $qb->from('ChillPersonBundle:Person:ResidentialAddress', 'ra'); + $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra'); $qb->join('ra.person', 'person'); $qb->join('person.center', 'center'); @@ -42,7 +42,6 @@ class ResidentialAddressAtUserFilter implements FilterInterface $qb->add('where', $where); - dump($qb->getQuery()); } public function applyOn() From 97ec921a0a01a9f81b730c139cd2628e4c551e4e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:15:27 +0200 Subject: [PATCH 120/191] small adjustments --- src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php | 2 +- .../PersonAggregators/ProfessionalSitutaionAggregator.php | 8 ++++++-- .../Export/Filter/PersonFilters/EntrustedChildFilter.php | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php index 56c9368dc..649830b4a 100644 --- a/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php +++ b/src/Bundle/ChillPersonBundle/Entity/MaritalStatus.php @@ -31,7 +31,7 @@ class MaritalStatus private ?string $id; /** - * @var string array + * @var array * @ORM\Column(type="json") */ private array $name; diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php index 0ee31d4fe..476c7ea0a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Export\Aggregator\PersonAggregators; use App\Repository\VendeePerson\SituationProfessionelleRepository; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -22,10 +23,13 @@ use Symfony\Component\Form\FormBuilderInterface; final class ProfessionalSituationAggregator implements AggregatorInterface { private SituationProfessionelleRepository $professionalSituationRepository; + + private TranslatableStringHelper $translatableStringHelper; - public function __construct(SituationProfessionelleRepository $professionalSituationRepository) + public function __construct(SituationProfessionelleRepository $professionalSituationRepository, TranslatableStringHelper $translatableStringHelper) { $this->professionalSituationRepository = $professionalSituationRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -70,7 +74,7 @@ final class ProfessionalSituationAggregator implements AggregatorInterface $g = $this->professionalSituationRepository->find($value); - return $g->getName()['fr']; + return $this->translatableStringHelper->localize($g->getName());; }; } diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php index ce09901b7..0e85232bf 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\PersonBundle\Export\Declarations; use DateTime; use Doctrine\ORM\Query\Expr\Andx; +use Symfony\Component\Form\FormBuilderInterface; class EntrustedChildFilter implements FilterInterface { @@ -48,7 +49,7 @@ class EntrustedChildFilter implements FilterInterface return Declarations::PERSON_TYPE; } - public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder) { // No form needed } From 2c7a128348ee71246dff5decc45993d91eb9e5cc Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 9 Aug 2022 16:46:29 +0200 Subject: [PATCH 121/191] vendee filters and aggregators moved to root folder --- .../ProfessionalSitutaionAggregator.php | 90 ------------------- .../PersonFilters/EntrustedChildFilter.php | 66 -------------- .../Filter/PersonFilters/NomadicFilter.php | 64 ------------- .../config/services/exports_person.yaml | 21 ----- 4 files changed, 241 deletions(-) delete mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php delete mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php delete mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NomadicFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php deleted file mode 100644 index 476c7ea0a..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/ProfessionalSitutaionAggregator.php +++ /dev/null @@ -1,90 +0,0 @@ -professionalSituationRepository = $professionalSituationRepository; - $this->translatableStringHelper = $translatableStringHelper; - } - - public function addRole() - { - return null; - } - - public function alterQuery(QueryBuilder $qb, $data) - { - $qb->resetDQLPart('from'); - $qb->from('App:VendeePerson', 'vp'); - $qb->join('vp.person', 'person'); - $qb->join('person.center', 'center'); - - $qb->join('vp.situationProfessionelle', 'sp'); - $qb->addSelect('sp.id as professional_situation_aggregator'); - - $groupBy = $qb->getDQLPart('groupBy'); - - if (!empty($groupBy)) { - $qb->addGroupBy('professional_situation_aggregator'); - } else { - $qb->groupBy('professional_situation_aggregator'); - } - } - - public function applyOn() - { - return Declarations::PERSON_TYPE; - } - - public function buildForm(FormBuilderInterface $builder) - { - } - - public function getLabels($key, array $values, $data) - { - return function ($value): string { - if ('_header' === $value) { - return 'Professional situation'; - } - - $g = $this->professionalSituationRepository->find($value); - - return $this->translatableStringHelper->localize($g->getName());; - }; - } - - public function getQueryKeys($data) - { - return ['professional_situation_aggregator']; - } - - public function getTitle() - { - return 'Group people by their professional situation'; - } -} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php deleted file mode 100644 index 0e85232bf..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/EntrustedChildFilter.php +++ /dev/null @@ -1,66 +0,0 @@ -resetDQLPart('from'); - $qb->from('App:VendeePersonMineur', 'vpm'); - - $qb->join('vpm.person', 'person'); - $qb->join('person.center', 'center'); - - $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('vpm.enfantConfie', 'true'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); - } - - public function applyOn() - { - return Declarations::PERSON_TYPE; - } - - public function buildForm(FormBuilderInterface $builder) - { - // No form needed - } - - public function describeAction($data, $format = 'string') - { - return ['Filtered by entrusted child status']; - } - - public function getTitle() - { - return 'Filter by entrusted child status'; - } -} diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NomadicFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NomadicFilter.php deleted file mode 100644 index 33cac6522..000000000 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/NomadicFilter.php +++ /dev/null @@ -1,64 +0,0 @@ -resetDQLPart('from'); - $qb->from('App:VendeePerson', 'vp'); - - $qb->join('vp.person', 'person'); - $qb->join('person.center', 'center'); - - $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->eq('vp.gensDuVoyage', 'true'); - - if ($where instanceof Andx) { - $where->add($clause); - } else { - $where = $qb->expr()->andX($clause); - } - - $qb->add('where', $where); - } - - public function applyOn() - { - return Declarations::PERSON_TYPE; - } - - public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) - { - // No form needed - } - - public function describeAction($data, $format = 'string') - { - return ['Filtered by nomadic status']; - } - - public function getTitle() - { - return 'Filter by nomadic status'; - } -} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index c8bd9d76a..d3bb49b6f 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -68,20 +68,6 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: person_residential_address_at_user_filter } - - chill.person.export.filter_entrusted_child: - class: Chill\PersonBundle\Export\Filter\PersonFilters\EntrustedChildFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: person_entrusted_child_filter } - - chill.person.export.filter_nomadic: - class: Chill\PersonBundle\Export\Filter\PersonFilters\NomadicFilter - autowire: true - autoconfigure: true - tags: - - { name: chill.export_filter, alias: person_nomadic_filter } ## Aggregators chill.person.export.aggregator_nationality: @@ -118,10 +104,3 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_marital_status_aggregator } - - # chill.person.export.aggregator_professional_situation: - # class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\ProfessionalSituationAggregator - # autowire: true - # autoconfigure: true - # tags: - # - { name: chill.export_aggregator, alias: person_professional_situation_aggregator } From 955d4a9e7a5b1c397a701b6c4a1abab114e5e35b Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 10:21:05 +0200 Subject: [PATCH 122/191] exports: add new EvaluationType Filter and Aggregator --- .../EvaluationTypeAggregator.php | 98 +++++++++++++++++++ .../Export/Export/CountEvaluation.php | 4 +- .../EvaluationTypeFilter.php | 96 ++++++++++++++++++ .../config/services/exports_evaluation.yaml | 13 +++ .../translations/messages.fr.yml | 6 ++ 5 files changed, 215 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php new file mode 100644 index 000000000..d52c410e5 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -0,0 +1,98 @@ +evaluationRepository = $evaluationRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Evaluation type'; + } + + $ev = $this->evaluationRepository->find($value); + + return $this->translatableStringHelper->localize($ev->getTitle()); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['evaluationtype_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by evaluation type'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('eval.evaluation', 'ev'); + $qb->addSelect('ev.id AS evaluationtype_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('evaluationtype_aggregator'); + } else { + $qb->groupBy('evaluationtype_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::EVAL_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 985a69df6..22bd07b0c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -5,7 +5,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\PersonBundle\Entity\SocialWork\Evaluation; +use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; @@ -22,7 +22,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface public function __construct( EntityManagerInterface $em ) { - $this->evaluationRepository = $em->getRepository(Evaluation::class); + $this->evaluationRepository = $em->getRepository(AccompanyingPeriodWorkEvaluation::class); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php new file mode 100644 index 000000000..6df5e38bf --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/EvaluationTypeFilter.php @@ -0,0 +1,96 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_evaluationtype', EntityType::class, [ + 'class' => Evaluation::class, + 'choice_label' => function (Evaluation $ev): string { + return $this->translatableStringHelper->localize($ev->getTitle()); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by evaluation type'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $evals = []; + + foreach ($data['accepted_evaluationtype'] as $ev) { + $evals[] = $this->translatableStringHelper->localize($ev->getTitle()); + } + + return ['Filtered by evaluation type: only %evals%', [ + '%evals%' => implode(", ou ", $evals) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('eval.evaluation', ':evaluationtype'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('evaluationtype', $data['accepted_evaluationtype']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::EVAL_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml index 03cd37ee3..92d9cfd3d 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml @@ -9,5 +9,18 @@ services: - { name: chill.export, alias: count_evaluation } ## Filters + chill.person.export.filter_evaluationtype: + class: Chill\PersonBundle\Export\Filter\EvaluationFilters\EvaluationTypeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_evaluationtype_filter } + ## Aggregators + chill.person.export.aggregator_evaluationtype: + class: Chill\PersonBundle\Export\Aggregator\EvaluationAggregators\EvaluationTypeAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_evaluationtype_aggregator } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 750bbf0ba..7ef7cc107 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -515,6 +515,12 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" +Filter by evaluation type: Filtrer par type d'évaluation +Accepted evaluationtype: Évaluations +"Filtered by evaluation type: only %evals%": "Filtré par type d'évaluation: uniquement %evals%" +Group by evaluation type: Grouper par type d'évaluation +Evaluation type: Type d'évaluation + ## aggregators Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau From 3c451209c7cdf1fda5f2a04683d52c2a524576a8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 10 Aug 2022 10:35:32 +0200 Subject: [PATCH 123/191] fix nationality aggregator --- .../Repository/CountryRepository.php | 6 ++++++ .../PersonAggregators/NationalityAggregator.php | 13 +++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php index 81bea648d..055f41195 100644 --- a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php @@ -14,6 +14,7 @@ namespace Chill\MainBundle\Repository; use Chill\MainBundle\Entity\Country; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; final class CountryRepository implements ObjectRepository @@ -25,6 +26,11 @@ final class CountryRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Country::class); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id, $lockMode = null, $lockVersion = null): ?Country { return $this->repository->find($id, $lockMode, $lockVersion); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index b8c9ba166..b4c2bc31a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -124,17 +124,19 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ->getQuery() ->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR); + // initialize array and add blank key for null values $labels = [ '' => $this->translator->trans('without data'), '_header' => $this->translator->trans('Nationality'), ]; + foreach ($countries as $row) { $labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']); } } - + if ('continent' === $data['group_by_level']) { $labels = [ 'EU' => $this->translator->trans('Europe'), @@ -149,9 +151,16 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ]; } - return static function (string $value) use ($labels): string { + return function ($value) use ($labels): string { + // if ('_header' === $value) { + // return 'Marital status'; + // } return $labels[$value]; }; + // return static function (string $value) use ($labels): string { + // dump($labels[$value]); + // return $labels[$value]; + // }; } public function getQueryKeys($data) From 6eddb420cc41718b88d6a41c331c933ddb34386d Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 10 Aug 2022 10:35:32 +0200 Subject: [PATCH 124/191] fix nationality aggregator --- .../ChillMainBundle/Repository/CountryRepository.php | 6 ++++++ .../Aggregator/PersonAggregators/NationalityAggregator.php | 7 +++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php index 81bea648d..055f41195 100644 --- a/src/Bundle/ChillMainBundle/Repository/CountryRepository.php +++ b/src/Bundle/ChillMainBundle/Repository/CountryRepository.php @@ -14,6 +14,7 @@ namespace Chill\MainBundle\Repository; use Chill\MainBundle\Entity\Country; use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\QueryBuilder; use Doctrine\Persistence\ObjectRepository; final class CountryRepository implements ObjectRepository @@ -25,6 +26,11 @@ final class CountryRepository implements ObjectRepository $this->repository = $entityManager->getRepository(Country::class); } + public function createQueryBuilder(string $alias, ?string $indexBy = null): QueryBuilder + { + return $this->repository->createQueryBuilder($alias, $indexBy); + } + public function find($id, $lockMode = null, $lockVersion = null): ?Country { return $this->repository->find($id, $lockMode, $lockVersion); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php index b8c9ba166..8c3c0e9a7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/NationalityAggregator.php @@ -124,17 +124,19 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ->getQuery() ->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR); + // initialize array and add blank key for null values $labels = [ '' => $this->translator->trans('without data'), '_header' => $this->translator->trans('Nationality'), ]; + foreach ($countries as $row) { $labels[$row['c_countryCode']] = $this->translatableStringHelper->localize($row['c_name']); } } - + if ('continent' === $data['group_by_level']) { $labels = [ 'EU' => $this->translator->trans('Europe'), @@ -149,9 +151,10 @@ final class NationalityAggregator implements AggregatorInterface, ExportElementV ]; } - return static function (string $value) use ($labels): string { + return function ($value) use ($labels): string { return $labels[$value]; }; + } public function getQueryKeys($data) From 8efbf02f64b4016c8a76ec72a18a9073a052d700 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 10:57:32 +0200 Subject: [PATCH 125/191] exports: add new MaxDate Filter for evaluation --- .../CurrentUserScopeFilter.php | 1 - .../EvaluationFilters/MaxDateFilter.php | 103 ++++++++++++++++++ .../config/services/exports_evaluation.yaml | 7 ++ .../translations/messages.fr.yml | 6 + 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php index b41347026..e6c56f11e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/CurrentUserScopeFilter.php @@ -11,7 +11,6 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; -use Chill\CustomFieldsBundle\Form\Type\ChoicesType; use Chill\MainBundle\Entity\Scope; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Export\FilterInterface; diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php new file mode 100644 index 000000000..de84d5877 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -0,0 +1,103 @@ + true, + 'is not specified' => false, + ]; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('maxdate', ChoiceType::class, [ + 'choices' => self::MAXDATE_CHOICES, + 'multiple' => false, + 'expanded' => true + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by maxdate'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + foreach (self::MAXDATE_CHOICES as $k => $v) { + if ($v === $data['maxdate']) { + $choice = $k; + } + } + + return ['Filtered by maxdate: only %choice%', [ + '%choice%' => $this->translator->trans($choice) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + if ($data['maxdate'] === true) { + $clause = $qb->expr()->isNotNull('eval.maxDate'); + } else { + $clause = $qb->expr()->isNull('eval.maxDate'); + } + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + + dump($data['maxdate']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::EVAL_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml index 92d9cfd3d..e21e0b6c1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_evaluation.yaml @@ -16,6 +16,13 @@ services: tags: - { name: chill.export_filter, alias: accompanyingcourse_evaluationtype_filter } + chill.person.export.filter_maxdate: + class: Chill\PersonBundle\Export\Filter\EvaluationFilters\MaxDateFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: accompanyingcourse_maxdate_filter } + ## Aggregators chill.person.export.aggregator_evaluationtype: class: Chill\PersonBundle\Export\Aggregator\EvaluationAggregators\EvaluationTypeAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 7ef7cc107..af21991d3 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -521,6 +521,12 @@ Accepted evaluationtype: Évaluations Group by evaluation type: Grouper par type d'évaluation Evaluation type: Type d'évaluation +Filter by maxdate: Filtrer par date d'échéance +Maxdate: '' +is specified: La date d'échéance est spécifiée +is not specified: La date d'échéance n'est pas spécifiée +"Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%" + ## aggregators Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau From 0c2c364eb668936b25eb9477201e713208ce3e07 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 10 Aug 2022 13:58:51 +0200 Subject: [PATCH 126/191] trying to get dynamic form to work --- .../SocialWorkTypeFilter.php | 159 ++++-------------- 1 file changed, 32 insertions(+), 127 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index bf28fb695..b5b8fbfd1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -3,6 +3,7 @@ namespace Chill\PersonBundle\Export\Filter\SocialWorkFilters; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr\Andx; @@ -12,117 +13,27 @@ use Symfony\Component\Form\FormBuilderInterface; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Templating\Entity\SocialActionRender; use Doctrine\ORM\EntityRepository; +use Symfony\Component\Form\Event\PostSetDataEvent; +use Symfony\Component\Form\Event\PostSubmitEvent; use Symfony\Component\Form\Event\PreSetDataEvent; +use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormInterface; class SocialWorkTypeFilter implements FilterInterface { private SocialActionRender $socialActionRender; - public function __construct(SocialActionRender $socialActionRender) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(SocialActionRender $socialActionRender, TranslatableStringHelper $translatableStringHelper) { $this->socialActionRender = $socialActionRender; + $this->translatableStringHelper = $translatableStringHelper; } public function buildForm(FormBuilderInterface $builder) { - /** - * EXAMPLE CODE TO INSPIRE - */ - // parent::buildForm($builder, $options); - // //other fields - - // $builder->add('country', 'entity', array( - // 'class' => 'Orfos\CoreBundle\Entity\Country', - // 'property' => $locale . 'name', - // 'label' => 'register.country.label', - // 'query_builder' => function(EntityRepository $er) { - // return $er->createQueryBuilder('c') - // ->select('c', 't') - // ->join('c.translations', 't'); - // }, - // )); - - // $factory = $builder->getFormFactory(); - // $refreshRegion = function ($form, $country) use ($factory, $locale) { - // $form->add($factory->createNamed('entity', 'region', null, array( - // 'class' => 'Orfos\CoreBundle\Entity\Region', - // 'property' => $locale . 'name', - // 'label' => 'register.region.label', - // 'query_builder' => function (EntityRepository $repository) use ($country) { - // $qb = $repository->createQueryBuilder('region') - // ->select('region', 'translation') - // ->innerJoin('region.country', 'country') - // ->join('region.translations', 'translation'); - - // if ($country instanceof Country) { - // $qb = $qb->where('region.country = :country') - // ->setParameter('country', $country); - // } elseif (is_numeric($country)) { - // $qb = $qb->where('country.id = :country_id') - // ->setParameter('country_id', $country); - // } else { - // $qb = $qb->where('country.id = 1'); - // } - - // return $qb; - // } - // ))); - // }; - // $factory = $builder->getFormFactory(); - // $refreshCity = function($form, $region) use ($factory, $locale) { - // $form->add($factory->createNamed('entity', 'city', null, array( - // 'class' => 'Orfos\CoreBundle\Entity\City', - // 'property' => $locale . 'name', - // 'label' => 'register.city.label', - // 'query_builder' => function (EntityRepository $repository) use ($region) { - // $qb = $repository->createQueryBuilder('city') - // ->select('city', 'translation') - // ->innerJoin('city.region', 'region') - // ->innerJoin('city.translations', 'translation'); - - // if ($region instanceof Region) { - // $qb = $qb->where('city.region = :region') - // ->setParameter('region', $region); - // } elseif (is_numeric($region)) { - // $qb = $qb->where('region.id = :region_id') - // ->setParameter('region_id', $region); - // } else { - // $qb = $qb->where('region.id = 1'); - // } - - // return $qb; - // } - // ))); - // }; - - // $builder->addEventListener(FormEvents::PRE_SET_DATA, function (DataEvent $event) use ($refreshRegion, $refreshCity) { - // $form = $event->getForm(); - // $data = $event->getData(); - - // if ($data == null){ - // $refreshRegion($form, null); - // $refreshCity($form, null); - // } - - // if ($data instanceof Country) { - // $refreshRegion($form, $data->getCountry()->getRegions()); - // $refreshCity($form, $data->getRegion()->getCities()); - // } - // }); - - // $builder->addEventListener(FormEvents::PRE_BIND, function (DataEvent $event) use ($refreshRegion, $refreshCity) { - // $form = $event->getForm(); - // $data = $event->getData(); - - // if (array_key_exists('country', $data)) { - // $refreshRegion($form, $data['country']); - // } - // if (array_key_exists('region', $data)) { - // $refreshCity($form, $data['region']); - // } - // }); - $builder->add('actionType', EntityType::class, [ 'class' => SocialAction::class, @@ -133,45 +44,39 @@ class SocialWorkTypeFilter implements FilterInterface 'expanded' => true ]); - $refreshGoals = function ($form, $actionType) { + $refreshGoals = function (FormInterface $form, SocialAction $actionType = null) { + + $goals = null === $actionType ? [] : $actionType->getGoals(); + $form->add('goal', EntityType::class, [ 'class' => Goal::class, + 'placeholder' => '', + 'choices' => $goals, 'choice_label' => function (Goal $g) { - return $g->getTitle(); + return $this->translatableStringHelper->localize($g->getTitle()); }, - 'query_builder' => function (EntityRepository $repository) use ($actionType) { - $qb = $repository->createQueryBuilder('g') - ->select('g') - ->join('g.socialActions', 'socialActions'); - - if ($actionType instanceof SocialAction) { - $qb = $qb->where( - $qb->expr()->andX( - $qb->expr()->in('g', ':socialActions') - )) - ->setParameter('country', $actionType); - } - - dump($qb->getQuery()->getResult()); - - return $qb; - } ]); - }; + }; - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (PreSetDataEvent $event) use ($refreshGoals) { + $builder->addEventListener(FormEvents::POST_SUBMIT, function (PostSubmitEvent $event) use ($refreshGoals) { + dump($event); $form = $event->getForm(); $data = $event->getData(); - if ($data == null){ - $refreshGoals($form, null); - } - - if ($data instanceof SocialAction) { - $refreshGoals($form, $data->getGoals()); - // $refreshCity($form, $data->getRegion()->getCities()); - } + $refreshGoals($form, $data); + }); + + $builder->get('actionType')->addEventListener( + FormEvents::POST_SUBMIT, + function (FormEvent $event) use ($refreshGoals) { + $actionType = $event->getForm()->getData(); + dump('after submit listener'); + dump($actionType); + + $refreshGoals($event->getForm()->getParent(), $actionType); + } + ); } public function getTitle(): string From 3f4d4497af46148f8919f23cc37928a024715061 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 14:03:47 +0200 Subject: [PATCH 127/191] exports: add new countHousehold export --- .../ChillPersonExtension.php | 1 + .../ChillPersonBundle/Export/Declarations.php | 2 + .../Export/Export/CountHousehold.php | 139 ++++++++++++++++++ .../config/services/exports_household.yaml | 13 ++ .../translations/messages.fr.yml | 4 + 5 files changed, 159 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php create mode 100644 src/Bundle/ChillPersonBundle/config/services/exports_household.yaml diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index bf73b4f81..efbb972c1 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -101,6 +101,7 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac $loader->load('services/exports_accompanying_course.yaml'); $loader->load('services/exports_social_actions.yaml'); $loader->load('services/exports_evaluation.yaml'); + $loader->load('services/exports_household.yaml'); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index 5a88d988b..b8e2cd69c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -27,4 +27,6 @@ abstract class Declarations public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; public const EVAL_TYPE = 'evaluation'; + + public const HOUSEHOLD_TYPE = 'household'; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php new file mode 100644 index 000000000..0fa708bf0 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -0,0 +1,139 @@ +acpRepository = $em->getRepository(AccompanyingPeriod::class); + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // TODO: Implement buildForm() method. + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Count households'; + } + + /** + * @inheritDoc + */ + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + /** + * @inheritDoc + */ + public function getDescription(): string + { + return 'Count household by various parameters.'; + } + + /** + * @inheritDoc + */ + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['export_result']; + } + + /** + * @inheritDoc + */ + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + /** + * @inheritDoc + */ + public function getType(): string + { + return Declarations::HOUSEHOLD_TYPE; + } + + /** + * @inheritDoc + */ + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $qb = $this->acpRepository->createQueryBuilder('acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person') + ->join('person.householdParticipations', 'householdmember') + ; + + $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); + + return $qb; + } + + /** + * @inheritDoc + */ + public function requiredRole() + { + // TODO HouseholdVoter::STATS !?? + return new Role(AccompanyingPeriodVoter::STATS); + } + + /** + * @inheritDoc + */ + public function supportsModifiers(): array + { + return [ + Declarations::HOUSEHOLD_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of households'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml new file mode 100644 index 000000000..45d70f6e4 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml @@ -0,0 +1,13 @@ +services: + + ## Indicators + chill.person.export.count_household: + class: Chill\PersonBundle\Export\Export\CountHousehold + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_household } + + ## Filters + + ## Aggregators diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index af21991d3..2f783c1e7 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -354,6 +354,10 @@ Exports of evaluations: Exports des évaluations Count evaluations: Nombre d'évaluations Count evaluation by various parameters.: Compte le nombre d'évaluations selon différents filtres. +Exports of households: Exports des ménages +Count households: Nombre de ménages +Count household by various parameters.: Compte le nombre de ménages selon différents filtres. + ## filters Filter by person gender: Filtrer par genre de la personne Accepted genders: Genres acceptés From 3463ff8e2e5bba73c51cd0293930296f61bdcb7b Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 16:25:38 +0200 Subject: [PATCH 128/191] exports: add Composition Filter and Aggregator in Household exports --- .../CompositionAggregator.php | 104 +++++++++++++++++ .../Export/Export/CountHousehold.php | 1 + .../HouseholdFilters/CompositionFilter.php | 106 ++++++++++++++++++ .../config/services/exports_household.yaml | 12 ++ .../translations/messages.fr.yml | 6 +- 5 files changed, 228 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php new file mode 100644 index 000000000..5718f990d --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -0,0 +1,104 @@ +typeRepository = $typeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Composition'; + } + + $c = $this->typeRepository->find($value); + + return $this->translatableStringHelper->localize( + $c->getLabel() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['composition_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // TODO: Implement buildForm() method. + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by composition'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('household.compositions', 'composition') + //->join('composition.householdCompositionType', 'type') + ; + + $qb->addSelect('IDENTITY(composition.householdCompositionType) AS composition_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('composition_aggregator'); + } else { + $qb->groupBy('composition_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::HOUSEHOLD_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 0fa708bf0..5bc333e2a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -106,6 +106,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface ->join('acp.participations', 'acppart') ->join('acppart.person', 'person') ->join('person.householdParticipations', 'householdmember') + ->join('householdmember.household', 'household') ; $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php new file mode 100644 index 000000000..132b878fd --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -0,0 +1,106 @@ +translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_composition', EntityType::class, [ + 'class' => HouseholdCompositionType::class, + 'choice_label' => function (HouseholdCompositionType $type) { + return $this->translatableStringHelper->localize( + $type->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by composition'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $compositions = []; + + foreach ($data['accepted_composition'] as $c) { + $compositions[] = $this->translatableStringHelper->localize( + $c->getLabel() + ); + } + + return ['Filtered by composition: only %compositions%', [ + '%compositions%' => implode(", ou ", $compositions) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->join('household.compositions', 'composition') + //->join('composition.householdCompositionType', 'type') + ; + + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('composition.householdCompositionType', ':compositions'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('compositions', $data['accepted_composition']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::HOUSEHOLD_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml index 45d70f6e4..b59537717 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml @@ -9,5 +9,17 @@ services: - { name: chill.export, alias: count_household } ## Filters + chill.person.export.filter_household_composition: + class: Chill\PersonBundle\Export\Filter\HouseholdFilters\CompositionFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: household_composition_filter } ## Aggregators + chill.person.export.aggregator_household_composition: + class: Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\CompositionAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: household_composition_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 2f783c1e7..a19150477 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -508,7 +508,6 @@ On date: Actifs à cette date Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période "Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" - Filtered by referrers: Filtrer par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" @@ -531,6 +530,11 @@ is specified: La date d'échéance est spécifiée is not specified: La date d'échéance n'est pas spécifiée "Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%" +Filter by composition: Filtrer par composition familiale +Accepted composition: Composition familiale +"Filtered by composition: only %compositions%": "Filtré par composition familiale: uniquement %compositions%" +Group by composition: Grouper par composition familiale + ## aggregators Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau From c693dfde66219db20f3d895883dcabacbb237495 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 16:33:05 +0200 Subject: [PATCH 129/191] a same join() in filter and aggregator make error if we combine them --- .../HouseholdAggregators/CompositionAggregator.php | 5 ----- .../ChillPersonBundle/Export/Export/CountHousehold.php | 1 + .../Export/Filter/HouseholdFilters/CompositionFilter.php | 5 ----- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 5718f990d..2a7c89ee3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -78,11 +78,6 @@ class CompositionAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('household.compositions', 'composition') - //->join('composition.householdCompositionType', 'type') - ; - $qb->addSelect('IDENTITY(composition.householdCompositionType) AS composition_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 5bc333e2a..c9b2b541a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -107,6 +107,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface ->join('acppart.person', 'person') ->join('person.householdParticipations', 'householdmember') ->join('householdmember.household', 'household') + ->join('household.compositions', 'composition') ; $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index 132b878fd..ae4427e6d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -77,11 +77,6 @@ class CompositionFilter implements FilterInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('household.compositions', 'composition') - //->join('composition.householdCompositionType', 'type') - ; - $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('composition.householdCompositionType', ':compositions'); From bc5d610f8065c96dfc548e25f111fac591b710e6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 16:50:59 +0200 Subject: [PATCH 130/191] exports: add on_date parameter on Composition Filter/Aggregator --- .../CompositionAggregator.php | 27 +++++++++++- .../HouseholdFilters/CompositionFilter.php | 44 +++++++++++++------ .../translations/messages.fr.yml | 2 +- 3 files changed, 58 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 2a7c89ee3..3e292ceec 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -3,9 +3,12 @@ namespace Chill\PersonBundle\Export\Aggregator\HouseholdAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\Household\HouseholdCompositionTypeRepository; +use Doctrine\DBAL\Types\Types; +use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -54,7 +57,9 @@ class CompositionAggregator implements AggregatorInterface */ public function buildForm(FormBuilderInterface $builder) { - // TODO: Implement buildForm() method. + $builder->add('on_date', ChillDateType::class, [ + 'data' => new \DateTime('now'), + ]); } /** @@ -87,6 +92,26 @@ class CompositionAggregator implements AggregatorInterface } else { $qb->groupBy('composition_aggregator'); } + + // add date in where clause + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->lte('composition.startDate', ':ondate'), + $qb->expr()->orX( + $qb->expr()->gt('composition.endDate', ':ondate'), + $qb->expr()->isNull('composition.endDate') + ) + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index ae4427e6d..f8a36e4b9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -3,9 +3,11 @@ namespace Chill\PersonBundle\Export\Filter\HouseholdFilters; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\Household\HouseholdCompositionType; use Chill\PersonBundle\Export\Declarations; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; @@ -26,16 +28,21 @@ class CompositionFilter implements FilterInterface */ public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_composition', EntityType::class, [ - 'class' => HouseholdCompositionType::class, - 'choice_label' => function (HouseholdCompositionType $type) { - return $this->translatableStringHelper->localize( - $type->getLabel() - ); - }, - 'multiple' => true, - 'expanded' => true, - ]); + $builder + ->add('accepted_composition', EntityType::class, [ + 'class' => HouseholdCompositionType::class, + 'choice_label' => function (HouseholdCompositionType $type) { + return $this->translatableStringHelper->localize( + $type->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true, + ]) + ->add('on_date', ChillDateType::class, [ + 'data' => new \DateTime('now'), + ]) + ; } /** @@ -59,8 +66,9 @@ class CompositionFilter implements FilterInterface ); } - return ['Filtered by composition: only %compositions%', [ - '%compositions%' => implode(", ou ", $compositions) + return ['Filtered by composition: only %compositions% on %ondate%', [ + '%compositions%' => implode(", ou ", $compositions), + '%ondate%' => $data['on_date']->format('d-m-Y') ]]; } @@ -79,7 +87,16 @@ class CompositionFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('composition.householdCompositionType', ':compositions'); + $clause = $qb->expr()->andX( + $qb->expr()->in('composition.householdCompositionType', ':compositions'), + $qb->expr()->andX( + $qb->expr()->lte('composition.startDate', ':ondate'), + $qb->expr()->orX( + $qb->expr()->gt('composition.endDate', ':ondate'), + $qb->expr()->isNull('composition.endDate') + ) + ) + ); if ($where instanceof Andx) { $where->add($clause); @@ -89,6 +106,7 @@ class CompositionFilter implements FilterInterface $qb->add('where', $where); $qb->setParameter('compositions', $data['accepted_composition']); + $qb->setParameter('ondate', $data['on_date'], Types::DATE_MUTABLE); } /** diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index a19150477..f46bb1750 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -532,7 +532,7 @@ is not specified: La date d'échéance n'est pas spécifiée Filter by composition: Filtrer par composition familiale Accepted composition: Composition familiale -"Filtered by composition: only %compositions%": "Filtré par composition familiale: uniquement %compositions%" +"Filtered by composition: only %compositions% on %ondate%": "Filtré par composition familiale: uniquement %compositions%, en date du %ondate%" Group by composition: Grouper par composition familiale ## aggregators From 18c17818f61c81642d540448cadf1966dd5482ce Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 10 Aug 2022 17:17:29 +0200 Subject: [PATCH 131/191] exports: add ChildrenNumber Aggregator --- .../ChildrenNumberAggregator.php | 108 ++++++++++++++++++ .../config/services/exports_household.yaml | 7 ++ .../translations/messages.fr.yml | 2 + 3 files changed, 117 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php new file mode 100644 index 000000000..c629fe0bf --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -0,0 +1,108 @@ +translator = $translator; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + + if ($value === '_header') { + return 'Number of children'; + } + + return $this->translator->trans( + 'household_composition.numberOfChildren children in household', [ + 'numberOfChildren' => $value + ]); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['childrennumber_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('on_date', ChillDateType::class, [ + 'data' => new \DateTime('now'), + ]); + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by number of children'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('composition.numberOfChildren AS childrennumber_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('childrennumber_aggregator'); + } else { + $qb->groupBy('childrennumber_aggregator'); + } + + // add date in where clause + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->lte('composition.startDate', ':ondate'), + $qb->expr()->orX( + $qb->expr()->gt('composition.endDate', ':ondate'), + $qb->expr()->isNull('composition.endDate') + ) + ); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::HOUSEHOLD_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml index b59537717..0b8c5f1ce 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_household.yaml @@ -23,3 +23,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: household_composition_aggregator } + + chill.person.export.aggregator_household_childrennumber: + class: Chill\PersonBundle\Export\Aggregator\HouseholdAggregators\ChildrenNumberAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: household_childrennumber_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index f46bb1750..3f895e0c4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -535,6 +535,8 @@ Accepted composition: Composition familiale "Filtered by composition: only %compositions% on %ondate%": "Filtré par composition familiale: uniquement %compositions%, en date du %ondate%" Group by composition: Grouper par composition familiale +Group by number of children: Grouper par nombre d'enfants + ## aggregators Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau From 70488a935d9622601cd3c9df7f91cea3acce40b0 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 11:59:35 +0200 Subject: [PATCH 132/191] exports: test if a join is already loaded when a specific join has to be shared between combined filters/aggregators, we need to check if it has been already loaded. we cannot load it into indicator because result is wrong --- .../HouseholdAggregators/ChildrenNumberAggregator.php | 4 ++++ .../Aggregator/HouseholdAggregators/CompositionAggregator.php | 4 ++++ src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php | 1 - .../Export/Filter/HouseholdFilters/CompositionFilter.php | 4 ++++ 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php index c629fe0bf..df50b76f0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/ChildrenNumberAggregator.php @@ -76,6 +76,10 @@ class ChildrenNumberAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { + if (!in_array('composition', $qb->getAllAliases())) { + $qb->join('household.compositions', 'composition'); + } + $qb->addSelect('composition.numberOfChildren AS childrennumber_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php index 3e292ceec..2c6ab174f 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/HouseholdAggregators/CompositionAggregator.php @@ -83,6 +83,10 @@ class CompositionAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { + if (!in_array('composition', $qb->getAllAliases())) { + $qb->join('household.compositions', 'composition'); + } + $qb->addSelect('IDENTITY(composition.householdCompositionType) AS composition_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index c9b2b541a..5bc333e2a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -107,7 +107,6 @@ class CountHousehold implements ExportInterface, GroupedExportInterface ->join('acppart.person', 'person') ->join('person.householdParticipations', 'householdmember') ->join('householdmember.household', 'household') - ->join('household.compositions', 'composition') ; $qb->select('COUNT(DISTINCT householdmember.household) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php index f8a36e4b9..78aba8bf7 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/HouseholdFilters/CompositionFilter.php @@ -85,6 +85,10 @@ class CompositionFilter implements FilterInterface */ public function alterQuery(QueryBuilder $qb, $data) { + if (!in_array('composition', $qb->getAllAliases())) { + $qb->join('household.compositions', 'composition'); + } + $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( From 6e467a62d4949302b179490351f4ed059997b1a1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 11:58:54 +0200 Subject: [PATCH 133/191] exports: simplify with querybuilder method to getRootAlias --- .../Export/Aggregator/JobAggregator.php | 10 +--------- .../Export/Aggregator/ReferrerAggregator.php | 10 +--------- .../Export/Aggregator/ScopeAggregator.php | 10 +--------- .../Export/Filter/ReferrerFilter.php | 13 ++----------- 4 files changed, 5 insertions(+), 38 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php index 9793dd875..d2334cfd1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php @@ -80,7 +80,7 @@ final class JobAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - switch ($this->getBaseEntityAppliedOn($qb)) { + switch ($qb->getRootAlias()) { case 'acp': $qb->join('acp.job', 'j'); @@ -112,12 +112,4 @@ final class JobAggregator implements AggregatorInterface { return Declarations::ACP_SHARED; } - - private function getBaseEntityAppliedOn(QueryBuilder $qb): string - { - /** @var From $from */ - $from = $qb->getDQLPart('from'); - - return $from[0]->getAlias(); - } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php index 3f9344212..bcf1e2f6c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php @@ -40,7 +40,7 @@ final class ReferrerAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($this->getBaseEntityAppliedOn($qb)) { + switch ($qb->getRootAlias()) { case 'acp': $qb->join('acp.user', 'u'); @@ -98,12 +98,4 @@ final class ReferrerAggregator implements AggregatorInterface { return 'Group by referrers'; } - - private function getBaseEntityAppliedOn(QueryBuilder $qb): string - { - /** @var From $from */ - $from = $qb->getDQLPart('from'); - - return $from[0]->getAlias(); - } } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php index d6d6d5a58..968d3115a 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php @@ -80,7 +80,7 @@ final class ScopeAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - switch ($this->getBaseEntityAppliedOn($qb)) { + switch ($qb->getRootAlias()) { case 'acp': $qb->join('acp.scopes', 's'); @@ -112,12 +112,4 @@ final class ScopeAggregator implements AggregatorInterface { return Declarations::ACP_SHARED; } - - private function getBaseEntityAppliedOn(QueryBuilder $qb): string - { - /** @var From $from */ - $from = $qb->getDQLPart('from'); - - return $from[0]->getAlias(); - } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php index 5aac709c4..7d2a3dbb9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php @@ -75,11 +75,10 @@ class ReferrerFilter implements FilterInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $where = $qb->getDQLPart('where'); - // Use querybuilder from alias to find which export context (indicator) - switch ($this->getBaseEntityAppliedOn($qb)) { + switch ($qb->getRootAlias()) { + case 'acp': $clause = $qb->expr()->in('acp.user', ':referrers'); break; @@ -103,14 +102,6 @@ class ReferrerFilter implements FilterInterface $qb->setParameter('referrers', $data['accepted_referrers']); } - private function getBaseEntityAppliedOn(QueryBuilder $qb): string - { - /** @var From $from */ - $from = $qb->getDQLPart('from'); - - return $from[0]->getAlias(); - } - /** * @inheritDoc */ From b8d187c82bf3decbe138a5d2436ea370fa617eee Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 14:04:15 +0200 Subject: [PATCH 134/191] exports evaluation: fix root query from acp --- .../EvaluationTypeAggregator.php | 3 +-- .../Export/Export/CountEvaluation.php | 11 +++++++---- .../Export/Filter/EvaluationFilters/MaxDateFilter.php | 3 --- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php index d52c410e5..e94290925 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/EvaluationAggregators/EvaluationTypeAggregator.php @@ -76,8 +76,7 @@ class EvaluationTypeAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('eval.evaluation', 'ev'); - $qb->addSelect('ev.id AS evaluationtype_aggregator'); + $qb->addSelect('IDENTITY(eval.evaluation) AS evaluationtype_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 22bd07b0c..98b73c398 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -5,7 +5,7 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; @@ -17,12 +17,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountEvaluation implements ExportInterface, GroupedExportInterface { - private EntityRepository $evaluationRepository; + private EntityRepository $acpRepository; public function __construct( EntityManagerInterface $em ) { - $this->evaluationRepository = $em->getRepository(AccompanyingPeriodWorkEvaluation::class); + $this->acpRepository = $em->getRepository(AccompanyingPeriod::class); } /** @@ -103,7 +103,10 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->evaluationRepository->createQueryBuilder('eval'); + $qb = $this->acpRepository->createQueryBuilder('acp') + ->join('acp.works', 'acpw') + ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval') + ; $qb->select('COUNT(eval.id) AS export_result'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php index de84d5877..c69e15d9e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/EvaluationFilters/MaxDateFilter.php @@ -12,7 +12,6 @@ use Symfony\Contracts\Translation\TranslatorInterface; class MaxDateFilter implements FilterInterface { - private const MAXDATE_CHOICES = [ 'is specified' => true, 'is not specified' => false, @@ -89,8 +88,6 @@ class MaxDateFilter implements FilterInterface } $qb->add('where', $where); - - dump($data['maxdate']); } /** From c45ef7d74f3e63c31561a9b0cae81371d2c1745a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 14:48:03 +0200 Subject: [PATCH 135/191] exports: fix initiateQuery to always begin from acp entity --- .../Export/Export/CountAccompanyingCourse.php | 20 ++++++------ .../Export/Export/CountEvaluation.php | 6 ++-- .../Export/Export/CountHousehold.php | 6 ++-- .../Export/Export/CountSocialWorkActions.php | 31 ++++++++++++------- .../Export/StatAccompanyingCourseDuration.php | 24 +++++++------- 5 files changed, 45 insertions(+), 42 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index 6d2c0c6f6..b1d6af4b4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -18,6 +18,7 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -26,15 +27,12 @@ use LogicException; class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface { - /** - * @var EntityManagerInterface - */ - protected $entityManager; + protected EntityRepository $repository; public function __construct( EntityManagerInterface $em ) { - $this->entityManager = $em; + $this->repository = $em->getRepository(AccompanyingPeriod::class); } public function buildForm(FormBuilderInterface $builder): void @@ -88,12 +86,9 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $qb = $this->entityManager->createQueryBuilder(); - $expr = $qb->expr(); + $qb = $this->repository->createQueryBuilder('acp'); - $qb->select('COUNT(acp.id) AS export_result') - ->from('ChillPersonBundle:AccompanyingPeriod', 'acp') - ; + $qb->select('COUNT(acp.id) AS export_result'); return $qb; } @@ -105,7 +100,10 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface public function supportsModifiers(): array { - return [Declarations::ACP_TYPE, Declarations::ACP_SHARED]; + return [ + Declarations::ACP_TYPE, + Declarations::ACP_SHARED + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 98b73c398..3c7a0e319 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -17,12 +17,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountEvaluation implements ExportInterface, GroupedExportInterface { - private EntityRepository $acpRepository; + private EntityRepository $repository; public function __construct( EntityManagerInterface $em ) { - $this->acpRepository = $em->getRepository(AccompanyingPeriod::class); + $this->repository = $em->getRepository(AccompanyingPeriod::class); } /** @@ -103,7 +103,7 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->acpRepository->createQueryBuilder('acp') + $qb = $this->repository->createQueryBuilder('acp') ->join('acp.works', 'acpw') ->join('acpw.accompanyingPeriodWorkEvaluations', 'eval') ; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 5bc333e2a..9767c17ed 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -16,12 +16,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountHousehold implements ExportInterface, GroupedExportInterface { - private EntityRepository $acpRepository; + private EntityRepository $repository; public function __construct( EntityManagerInterface $em ) { - $this->acpRepository = $em->getRepository(AccompanyingPeriod::class); + $this->repository = $em->getRepository(AccompanyingPeriod::class); } /** @@ -102,7 +102,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $qb = $this->acpRepository->createQueryBuilder('acp') + $qb = $this->repository->createQueryBuilder('acp') ->join('acp.participations', 'acppart') ->join('acppart.person', 'person') ->join('person.householdParticipations', 'householdmember') diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index 7cba36904..bad952743 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -14,9 +14,11 @@ namespace Chill\PersonBundle\Export\Export; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; -use Chill\PersonBundle\Repository\AccompanyingPeriod\AccompanyingPeriodWorkRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -25,11 +27,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountSocialWorkActions implements ExportInterface, GroupedExportInterface { - protected AccompanyingPeriodWorkRepository $socialActionRepository; + protected EntityRepository $repository; - public function __construct(AccompanyingPeriodWorkRepository $socialActionRepository) - { - $this->socialActionRepository = $socialActionRepository; + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(AccompanyingPeriod::class); } public function buildForm(FormBuilderInterface $builder): void @@ -54,7 +57,7 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - if ('export_count_social_work_actions' !== $key) { + if ('export_result' !== $key) { throw new LogicException("the key {$key} is not used by this export"); } @@ -68,7 +71,7 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function getQueryKeys($data): array { - return ['export_count_social_work_actions']; + return ['export_result']; } public function getResult($qb, $data) @@ -83,10 +86,11 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $qb = $this - ->socialActionRepository - ->createQueryBuilder('acpw') - ->select('COUNT(acpw.id) as export_count_social_work_actions'); + $qb = $this->repository->createQueryBuilder('acp') + ->join('acp.works', 'acpw') + ; + + $qb->select('COUNT(acpw.id) as export_result'); return $qb; } @@ -99,7 +103,10 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface public function supportsModifiers(): array { - return [Declarations::SOCIAL_WORK_ACTION_TYPE, Declarations::ACP_SHARED]; + return [ + Declarations::SOCIAL_WORK_ACTION_TYPE, + Declarations::ACP_SHARED + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php index 8747c288a..417411f98 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/StatAccompanyingCourseDuration.php @@ -15,9 +15,11 @@ use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; -use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Chill\PersonBundle\Security\Authorization\AccompanyingPeriodVoter; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -26,15 +28,12 @@ use Symfony\Component\Security\Core\Role\Role; class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportInterface { - private AccompanyingPeriodRepository $periodRepository; + private EntityRepository $repository; - /** - * @param AccompanyingPeriodRepository $periodRepository - */ public function __construct( - AccompanyingPeriodRepository $periodRepository + EntityManagerInterface $em ) { - $this->periodRepository = $periodRepository; + $this->repository = $em->getRepository(AccompanyingPeriod::class); } /** @@ -118,10 +117,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn */ public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder { - $qb = $this->periodRepository->createQueryBuilder('acp'); - $expr = $qb->expr(); - - $force_closingdate = $data['closingdate']; // parameter from buildForm + $qb = $this->repository->createQueryBuilder('acp'); $qb ->select('AVG( @@ -131,7 +127,7 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn ELSE :force_closingDate END ) - acp.openingDate ) AS export_result') - ->setParameter('force_closingDate', $force_closingdate) + ->setParameter('force_closingDate', $data['closingdate']) ; return $qb; @@ -150,7 +146,9 @@ class StatAccompanyingCourseDuration implements ExportInterface, GroupedExportIn */ public function supportsModifiers(): array { - return [Declarations::ACP_TYPE]; + return [ + Declarations::ACP_TYPE + ]; } public function getGroup(): string From b614149fab417d548827590a17d71eb4d5ca6b2a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 16:39:36 +0200 Subject: [PATCH 136/191] translations chain --- .../Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php | 2 +- .../ActiveOneDayBetweenDatesFilter.php | 2 +- .../AccompanyingCourseFilters/OpenBetweenDatesFilter.php | 2 +- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php index fff38318c..933350134 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOnDateFilter.php @@ -31,7 +31,7 @@ class ActiveOnDateFilter implements FilterInterface */ public function getTitle(): string { - return 'Filtered by active on date'; + return 'Filter by active on date'; } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php index 91732e83d..2f83667c9 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActiveOneDayBetweenDatesFilter.php @@ -34,7 +34,7 @@ class ActiveOneDayBetweenDatesFilter implements FilterInterface */ public function getTitle(): string { - return 'Filtered by active at least one day between dates'; + return 'Filter by active at least one day between dates'; } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php index 20e020784..400ab7a14 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/OpenBetweenDatesFilter.php @@ -34,7 +34,7 @@ class OpenBetweenDatesFilter implements FilterInterface */ public function getTitle(): string { - return 'Filtered by opened between dates'; + return 'Filter by opened between dates'; } /** diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3f895e0c4..3d899719e 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -501,11 +501,11 @@ is regular: le parcours est régulier Intensity: Intensité Group by intensity: Grouper par intensité -Filtered by active on date: Filtrer les parcours actifs à une date +Filter by active on date: Filtrer les parcours actifs à une date On date: Actifs à cette date "Filtered by actives courses: active on %ondate%": "Filtrer les parcours actifs: actifs le %ondate%" -Filtered by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période +Filter by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période "Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" Filtered by referrers: Filtrer par référent @@ -513,7 +513,7 @@ Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" Group by referrers: Grouper par référent -Filtered by opened between dates: Filtrer les parcours ouverts entre deux dates +Filter by opened between dates: Filtrer les parcours ouverts entre deux dates Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" From 93eb9220a74fb9b904ffc5197ee47a1211719eed Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 16:41:15 +0200 Subject: [PATCH 137/191] =?UTF-8?q?split=20ReferrerFilter,=20logiquement?= =?UTF-8?q?=20ce=20sont=20des=20filtres=20diff=C3=A9rents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReferrerFilter.php | 22 +--- .../SocialWorkFilters/ReferrerFilter.php | 100 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 2 +- .../services/exports_social_actions.yaml | 7 ++ .../translations/messages.fr.yml | 7 +- 5 files changed, 118 insertions(+), 20 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Filter/{ => AccompanyingCourseFilters}/ReferrerFilter.php (78%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php similarity index 78% rename from src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php rename to src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php index 7d2a3dbb9..89b306678 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/ReferrerFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ReferrerFilter.php @@ -1,6 +1,6 @@ getDQLPart('where'); - - switch ($qb->getRootAlias()) { - - case 'acp': - $clause = $qb->expr()->in('acp.user', ':referrers'); - break; - - case 'acpw': - $qb->join('acpw.referrers', 'r'); - $clause = $qb->expr()->in('r', ':referrers'); - break; - - default: - throw new \Exception("Does not apply on that base entity"); - } + $clause = $qb->expr()->in('acp.user', ':referrers'); if ($where instanceof Andx) { $where->add($clause); @@ -107,6 +93,6 @@ class ReferrerFilter implements FilterInterface */ public function applyOn(): string { - return Declarations::ACP_SHARED; + return Declarations::ACP_TYPE; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php new file mode 100644 index 000000000..1ca1d39d2 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ReferrerFilter.php @@ -0,0 +1,100 @@ +userRender = $userRender; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_agents', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Filter by treating agent'; + } + + /** + * @inheritDoc + */ + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_agents'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by treating agent: only %agents%', [ + '%agents' => implode(", ou ", $users) + ]]; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'u'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('u', ':agents'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('agents', $data['accepted_agents']); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 592df7573..a48081d21 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -136,7 +136,7 @@ services: - { name: chill.export_filter, alias: accompanyingcourse_activeonedaybetweendates_filter } chill.person.export.filter_referrer: - class: Chill\PersonBundle\Export\Filter\ReferrerFilter + class: Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters\ReferrerFilter autowire: true autoconfigure: true tags: diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 266b8db75..08b3893da 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -29,6 +29,13 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: social_work_actions_job_filter } + + chill.person.export.filter_treating_agent: + class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ReferrerFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_actions_referrer_filter } ## AGGREGATORS chill.person.export.aggregator_action_type: diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 3d899719e..9812a9293 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -508,11 +508,16 @@ On date: Actifs à cette date Filter by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période "Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" -Filtered by referrers: Filtrer par référent +Filter by referrers: Filtrer par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" Group by referrers: Grouper par référent +Filter by treating agent: Filtrer par agent traitant +Accepted agents: Agent traitant +"Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" +Group by treating agent: Grouper par agent traitant + Filter by opened between dates: Filtrer les parcours ouverts entre deux dates Date from: Date de début Date to: Date de fin From 312a23e91f2000371f2501e966e39da075841e67 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 16:56:18 +0200 Subject: [PATCH 138/191] split ReferrerAggregator --- .../ReferrerAggregator.php | 20 +---- .../ReferrerAggregator.php | 89 +++++++++++++++++++ .../services/exports_accompanying_course.yaml | 2 +- .../services/exports_social_actions.yaml | 9 +- 4 files changed, 102 insertions(+), 18 deletions(-) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => AccompanyingCourseAggregators}/ReferrerAggregator.php (77%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php similarity index 77% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php index bcf1e2f6c..56522f2ed 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ReferrerAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ReferrerAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\PersonBundle\Export\Aggregator; +namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; @@ -40,21 +40,9 @@ final class ReferrerAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - switch ($qb->getRootAlias()) { + $qb->join('acp.user', 'u'); - case 'acp': - $qb->join('acp.user', 'u'); - $qb->addSelect('u.id AS referrer_aggregator'); - break; - - case 'acpw': - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('r.id AS referrer_aggregator'); - break; - - default: - throw new \Exception("Does not apply on that base entity"); - } + $qb->addSelect('u.id AS referrer_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); @@ -68,7 +56,7 @@ final class ReferrerAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACP_SHARED; + return Declarations::ACP_TYPE; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php new file mode 100644 index 000000000..1815ecc19 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ReferrerAggregator.php @@ -0,0 +1,89 @@ +userRepository = $userRepository; + $this->userRender = $userRender; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'u'); + + $qb->addSelect('u.id AS referrer_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('referrer_aggregator'); + } else { + $qb->groupBy('referrer_aggregator'); + } + + } + + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ('_header' === $value) { + return 'Referrer'; + } + + $r = $this->userRepository->find($value); + + return $this->userRender->renderString($r, []); + }; + } + + public function getQueryKeys($data): array + { + return ['referrer_aggregator']; + } + + public function getTitle(): string + { + return 'Group by treating agent'; + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index a48081d21..25b19caf8 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -235,7 +235,7 @@ services: - { name: chill.export_aggregator, alias: accompanyingcourse_intensity_aggregator } chill.person.export.aggregator_referrer: - class: Chill\PersonBundle\Export\Aggregator\ReferrerAggregator + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ReferrerAggregator autowire: true autoconfigure: true tags: diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 08b3893da..9879736db 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -35,7 +35,7 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_referrer_filter } + - { name: chill.export_filter, alias: social_work_actions_treating_agent_filter } ## AGGREGATORS chill.person.export.aggregator_action_type: @@ -44,6 +44,13 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_action_type_aggregator } + + chill.person.export.aggregator_treating_agent: + class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_treating_agent_aggregator } chill.person.export.aggregator_goal: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator From d27c52b526509310b6765727100b3deb323157c9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 17:10:19 +0200 Subject: [PATCH 139/191] Split Job and Scope Aggregators --- .../JobAggregator.php | 103 ++++++++++++++++++ .../ScopeAggregator.php | 20 +--- .../JobAggregator.php | 20 +--- .../SocialWorkAggregators/ScopeAggregator.php | 103 ++++++++++++++++++ .../services/exports_accompanying_course.yaml | 12 +- .../services/exports_social_actions.yaml | 22 +++- 6 files changed, 238 insertions(+), 42 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => AccompanyingCourseAggregators}/ScopeAggregator.php (78%) rename src/Bundle/ChillPersonBundle/Export/Aggregator/{ => SocialWorkAggregators}/JobAggregator.php (78%) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php new file mode 100644 index 000000000..31b3fca66 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/JobAggregator.php @@ -0,0 +1,103 @@ +jobRepository = $jobRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function($value): string { + if ($value === '_header') { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['job_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by user job'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acp.job', 'j'); + + $qb->addSelect('IDENTITY(acp.job) AS job_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('job_aggregator'); + } else { + $qb->groupBy('job_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php similarity index 78% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php index 968d3115a..5bddac42b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/ScopeAggregator.php @@ -1,6 +1,6 @@ getRootAlias()) { + $qb->join('acp.scopes', 's'); - case 'acp': - $qb->join('acp.scopes', 's'); - $qb->addSelect('s.id as scope_aggregator'); - break; - - case 'acpw': - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.mainScope) as scope_aggregator'); - break; - - default: - throw new \Exception("Does not apply on that base entity"); - } + $qb->addSelect('s.id as scope_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); @@ -110,6 +98,6 @@ final class ScopeAggregator implements AggregatorInterface */ public function applyOn(): string { - return Declarations::ACP_SHARED; + return Declarations::ACP_TYPE; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php similarity index 78% rename from src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php rename to src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index d2334cfd1..c8aa368b1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -1,6 +1,6 @@ getRootAlias()) { + $qb->join('acpw.referrers', 'u'); - case 'acp': - $qb->join('acp.job', 'j'); - $qb->addSelect('IDENTITY(acp.job) AS job_aggregator'); - break; - - case 'acpw': - $qb->join('acpw.referrers', 'r'); - $qb->addSelect('IDENTITY(r.userJob) as job_aggregator'); - break; - - default: - throw new \Exception("Does not apply on that base entity"); - } + $qb->addSelect('IDENTITY(u.userJob) as job_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); @@ -110,6 +98,6 @@ final class JobAggregator implements AggregatorInterface */ public function applyOn(): string { - return Declarations::ACP_SHARED; + return Declarations::SOCIAL_WORK_ACTION_TYPE; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php new file mode 100644 index 000000000..ca968f20e --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -0,0 +1,103 @@ +scopeRepository = $scopeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['scope_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by user scope'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('acpw.referrers', 'u'); + + $qb->addSelect('IDENTITY(u.mainScope) as scope_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('scope_aggregator'); + } else { + $qb->groupBy('scope_aggregator'); + } + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::SOCIAL_WORK_ACTION_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 25b19caf8..155ad11df 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -150,19 +150,19 @@ services: - { name: chill.export_filter, alias: accompanyingcourse_openbetweendates_filter } ## Aggregators - chill.person.export.aggregator_scope: - class: Chill\PersonBundle\Export\Aggregator\ScopeAggregator + chill.person.export.aggregator_referrer_scope: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\ScopeAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: accompanyingcourse_scope_aggregator } + - { name: chill.export_aggregator, alias: accompanyingcourse_referrer_scope_aggregator } - chill.person.export.aggregator_job: - class: Chill\PersonBundle\Export\Aggregator\JobAggregator + chill.person.export.aggregator_referrer_job: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\JobAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: accompanyingcourse_job_aggregator } + - { name: chill.export_aggregator, alias: accompanyingcourse_referrer_job_aggregator } chill.person.export.aggregator_socialissue: class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\SocialIssueAggregator diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index 9879736db..ef86732ff 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -30,12 +30,12 @@ services: tags: - { name: chill.export_filter, alias: social_work_actions_job_filter } - chill.person.export.filter_treating_agent: + chill.person.export.filter_treatingagent: class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ReferrerFilter autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: social_work_actions_treating_agent_filter } + - { name: chill.export_filter, alias: social_work_actions_treatingagent_filter } ## AGGREGATORS chill.person.export.aggregator_action_type: @@ -45,12 +45,26 @@ services: tags: - { name: chill.export_aggregator, alias: social_work_actions_action_type_aggregator } - chill.person.export.aggregator_treating_agent: + chill.person.export.aggregator_treatingagent_scope: + class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ScopeAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_treatingagent_scope_aggregator } + + chill.person.export.aggregator_treatingagent_job: + class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\JobAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: social_work_actions_treatingagent_job_aggregator } + + chill.person.export.aggregator_treatingagent: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ReferrerAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: social_work_actions_treating_agent_aggregator } + - { name: chill.export_aggregator, alias: social_work_actions_treatingagent_aggregator } chill.person.export.aggregator_goal: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator From f7993eaf2b056541cee993c373b3bfea19536dd5 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 17:17:52 +0200 Subject: [PATCH 140/191] remove ACP_SHARED Declaration --- .../Export/Export/CountActivityLinkedToACP.php | 6 +++--- src/Bundle/ChillPersonBundle/Export/Declarations.php | 2 -- .../Export/Export/CountAccompanyingCourse.php | 1 - src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php | 2 +- .../Export/Export/CountSocialWorkActions.php | 1 - 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php index c182145a8..f17ced0fd 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php @@ -17,7 +17,7 @@ use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\PersonBundle\Export\Declarations as ExportDeclarations; +use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -100,9 +100,9 @@ class CountActivityLinkedToACP implements ExportInterface, GroupedExportInterfac public function supportsModifiers() { return [ - ExportDeclarations::PERSON_TYPE, Declarations::ACTIVITY, - ExportDeclarations::ACP_SHARED + PersonDeclarations::PERSON_TYPE, + //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Declarations.php b/src/Bundle/ChillPersonBundle/Export/Declarations.php index b8e2cd69c..f6c870e4d 100644 --- a/src/Bundle/ChillPersonBundle/Export/Declarations.php +++ b/src/Bundle/ChillPersonBundle/Export/Declarations.php @@ -22,8 +22,6 @@ abstract class Declarations public const ACP_TYPE = 'accompanying_period'; - public const ACP_SHARED = 'accompanying_period_shared'; - public const SOCIAL_WORK_ACTION_TYPE = 'social_actions'; public const EVAL_TYPE = 'evaluation'; diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php index b1d6af4b4..a842284f5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountAccompanyingCourse.php @@ -102,7 +102,6 @@ class CountAccompanyingCourse implements ExportInterface, GroupedExportInterface { return [ Declarations::ACP_TYPE, - Declarations::ACP_SHARED ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php index a2f3842e7..3ef74a69e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPerson.php @@ -114,7 +114,7 @@ class CountPerson implements ExportInterface, GroupedExportInterface return [ Declarations::PERSON_TYPE, Declarations::PERSON_IMPLIED_IN, - Declarations::ACP_SHARED + //Declarations::ACP_TYPE ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php index bad952743..cfea1f0c1 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountSocialWorkActions.php @@ -105,7 +105,6 @@ class CountSocialWorkActions implements ExportInterface, GroupedExportInterface { return [ Declarations::SOCIAL_WORK_ACTION_TYPE, - Declarations::ACP_SHARED ]; } From b03950d0f7221fc8ed624c7184f0a16a547fffc9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 17:33:58 +0200 Subject: [PATCH 141/191] improve translations for treating agent --- .../SocialWorkAggregators/JobAggregator.php | 2 +- .../SocialWorkAggregators/ScopeAggregator.php | 2 +- .../Filter/SocialWorkFilters/JobFilter.php | 16 ++++++++-------- .../Filter/SocialWorkFilters/ScopeFilter.php | 6 +++--- .../translations/messages.fr.yml | 18 +++++++++++++----- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php index c8aa368b1..ddab1f7cd 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/JobAggregator.php @@ -64,7 +64,7 @@ final class JobAggregator implements AggregatorInterface */ public function getTitle(): string { - return 'Group by user job'; + return 'Group by treating agent job'; } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php index ca968f20e..74a73537c 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ScopeAggregator.php @@ -64,7 +64,7 @@ final class ScopeAggregator implements AggregatorInterface */ public function getTitle(): string { - return 'Group by user scope'; + return 'Group by treating agent scope'; } /** diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 7eb7d6142..0202a9be0 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -39,7 +39,7 @@ class JobFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('userjob', EntityType::class, [ + $builder->add('job', EntityType::class, [ 'class' => UserJob::class, 'choice_label' => function (UserJob $j) { return $this->translatableStringHelper->localize( @@ -55,13 +55,13 @@ class JobFilter implements FilterInterface { $userjobs = []; - foreach ($data['userjob'] as $j) { + foreach ($data['job'] as $j) { $userjobs[] = $this->translatableStringHelper->localize( $j->getLabel()); } - return ['Filtered by the following jobs: only %userjobs%', [ - '%userjobs%' => implode(', ou ', $userjobs) + return ['Filtered by treating agent job: only %jobs%', [ + '%jobs%' => implode(', ou ', $userjobs) ]]; } @@ -75,7 +75,7 @@ class JobFilter implements FilterInterface $qb->join('acpw.referrers', 'r'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('r.userJob', ':userjob'); + $clause = $qb->expr()->in('r.userJob', ':job'); if ($where instanceof Andx) { $where->add($clause); @@ -84,7 +84,7 @@ class JobFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('userjob', $data['userjob']); + $qb->setParameter('job', $data['job']); } public function applyOn() @@ -93,8 +93,8 @@ class JobFilter implements FilterInterface } - public function getTitle() + public function getTitle(): string { - return 'Filter by user job'; + return 'Filter by treating agent job'; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index a91344645..228c3ea92 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -59,8 +59,8 @@ class ScopeFilter implements FilterInterface $s->getName()); } - return ['Filtered by the following scopes: only %scope%', [ - '%scope%' => implode(', ou ', $scopes) + return ['Filtered by treating agent scope: only %scopes%', [ + '%scopes%' => implode(', ou ', $scopes) ]]; } @@ -94,6 +94,6 @@ class ScopeFilter implements FilterInterface public function getTitle() { - return 'Filter by scope'; + return 'Filter by treating agent scope'; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9812a9293..cf14100e7 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -513,16 +513,24 @@ Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" Group by referrers: Grouper par référent -Filter by treating agent: Filtrer par agent traitant -Accepted agents: Agent traitant -"Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" -Group by treating agent: Grouper par agent traitant - Filter by opened between dates: Filtrer les parcours ouverts entre deux dates Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" +Filter by treating agent scope: Filtrer par service de l'agent traitant +"Filtered by treating agent scope: only %scopes%": "Filtré par service de l'agent traitant: uniquement %scopes%" +Group by treating agent scope: Grouper par service de l'agent traitant + +Filter by treating agent job: Filtrer par métier de l'agent traitant +"Filtered by treating agent job: only %jobs%": "Filtré par métier de l'agent traitant: uniquement %jobs%" +Group by treating agent job: Grouper par métier de l'agent traitant + +Filter by treating agent: Filtrer par agent traitant +Accepted agents: Agent traitant +"Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" +Group by treating agent: Grouper par agent traitant + Filter by evaluation type: Filtrer par type d'évaluation Accepted evaluationtype: Évaluations "Filtered by evaluation type: only %evals%": "Filtré par type d'évaluation: uniquement %evals%" From 619ae4e45898f6effe28c6f35102621313e71382 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 17:43:20 +0200 Subject: [PATCH 142/191] improve social work actions translations --- .../translations/messages.fr.yml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index cf14100e7..029803196 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -518,18 +518,23 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" -Filter by treating agent scope: Filtrer par service de l'agent traitant +Group social work actions by action type: Grouper les actions par type d'action + +Filter by treating agent scope: Filtrer les actions par service de l'agent traitant "Filtered by treating agent scope: only %scopes%": "Filtré par service de l'agent traitant: uniquement %scopes%" -Group by treating agent scope: Grouper par service de l'agent traitant +Group by treating agent scope: Grouper les actions par service de l'agent traitant -Filter by treating agent job: Filtrer par métier de l'agent traitant +Filter by treating agent job: Filtrer les actions par métier de l'agent traitant "Filtered by treating agent job: only %jobs%": "Filtré par métier de l'agent traitant: uniquement %jobs%" -Group by treating agent job: Grouper par métier de l'agent traitant +Group by treating agent job: Grouper les actions par métier de l'agent traitant -Filter by treating agent: Filtrer par agent traitant +Filter by treating agent: Filtrer les actions par agent traitant Accepted agents: Agent traitant "Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" -Group by treating agent: Grouper par agent traitant +Group by treating agent: Grouper les actions par agent traitant + +Group social work actions by goal: Grouper les actions par objectif +Group social work actions by result: Grouper les actions par résultat Filter by evaluation type: Filtrer par type d'évaluation Accepted evaluationtype: Évaluations From 4e12684f9807bc0b623eb882de9ba547bd2f5f97 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 11 Aug 2022 18:09:25 +0200 Subject: [PATCH 143/191] add condition on join clause to improve combined Filters/Aggregators --- .../EvaluationAggregator.php | 8 ++++---- .../SocialActionAggregator.php | 4 +++- .../AccompanyingCourseFilters/SocialActionFilter.php | 7 ++++--- .../Export/Filter/SocialWorkFilters/JobFilter.php | 4 ++-- .../Export/Filter/SocialWorkFilters/ScopeFilter.php | 4 ++-- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php index f02368fde..3f98c7003 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/EvaluationAggregator.php @@ -78,10 +78,10 @@ final class EvaluationAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb - ->join('acp.works', 'acpw') - ->join('acpw.accompanyingPeriodWorkEvaluations', 'we') - ; + if (!in_array('acpw', $qb->getAllAliases())) { + $qb->join('acp.works', 'acpw'); + } + $qb->join('acpw.accompanyingPeriodWorkEvaluations', 'we'); $qb->addSelect('IDENTITY(we.evaluation) AS evaluation_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php index 4be8c027d..a9257bd8e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/SocialActionAggregator.php @@ -76,7 +76,9 @@ final class SocialActionAggregator implements AggregatorInterface */ public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.works', 'acpw'); + if (!in_array('acpw', $qb->getAllAliases())) { + $qb->join('acp.works', 'acpw'); + } $qb->addSelect('IDENTITY(acpw.socialAction) AS socialaction_aggregator'); // DISTINCT ?? diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php index 3f61b017f..d96d0ca44 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/SocialActionFilter.php @@ -69,9 +69,10 @@ class SocialActionFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acp.works', 'acpw') - ->join('acpw.socialAction', 'sa') - ; + if (!in_array('acpw', $qb->getAllAliases())) { + $qb->join('acp.works', 'acpw'); + } + $qb->join('acpw.socialAction', 'sa'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->in('sa.id', ':socialactions'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php index 0202a9be0..80efd03e3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/JobFilter.php @@ -72,10 +72,10 @@ class JobFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'r'); + $qb->join('acpw.referrers', 'u'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('r.userJob', ':job'); + $clause = $qb->expr()->in('u.userJob', ':job'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php index 228c3ea92..6588efc18 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/ScopeFilter.php @@ -71,10 +71,10 @@ class ScopeFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->join('acpw.referrers', 'r'); + $qb->join('acpw.referrers', 'u'); $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('r.mainScope', ':scope'); + $clause = $qb->expr()->in('u.mainScope', ':scope'); if ($where instanceof Andx) { $where->add($clause); From a9e83d3dc8bd6d40692d27f8953610a9b63926f8 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 10:42:13 +0200 Subject: [PATCH 144/191] delete double translations --- .../translations/messages.fr.yml | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index d7455f070..34921ec4b 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -338,7 +338,8 @@ Fields to include in export: Champs à inclure dans l'export Address valid at this date: Addresse valide à cette date List duplicates: Liste des doublons Create a list of duplicate people: Créer la liste des personnes détectées comme doublons. -Count people with an accompanying course by various parameters.: Nombre d'usagers concernées par un parcours +Count people participating in an accompanying course by various parameters.: Nombre d'usagers concernées par un parcours +Count people participating in an accompanying course: Nombre d'usagers concernés par un parcours Exports of accompanying courses: Exports des parcours d'accompagnement Count accompanying courses: Nombre de parcours @@ -455,10 +456,6 @@ Evaluation: Évaluation "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" Group by evaluation: Grouper par évaluation -Group social work actions by action type: Grouper par type d'action -Group social work actions by goal: Grouper par objectif -Group social work actions by result: Grouper par résultat - Filter by activity type: Filtrer par type d'activité Accepted activitytypes: Types d'activités "Filtered by activity types: only %activitytypes%": "Filtré par type d'activité: seulement %activitytypes%" @@ -528,8 +525,6 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" -Group social work actions by action type: Grouper les actions par type d'action - Filter by treating agent scope: Filtrer les actions par service de l'agent traitant "Filtered by treating agent scope: only %scopes%": "Filtré par service de l'agent traitant: uniquement %scopes%" Group by treating agent scope: Grouper les actions par service de l'agent traitant @@ -542,9 +537,10 @@ Filter by treating agent: Filtrer les actions par agent traitant Accepted agents: Agent traitant "Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" Group by treating agent: Grouper les actions par agent traitant - -Group social work actions by goal: Grouper les actions par objectif -Group social work actions by result: Grouper les actions par résultat + +Group social work actions by action type: Grouper les actions par type d'action +Group social work actions by goal: Grouper par objectif +Group social work actions by result: Grouper par résultat Filter by evaluation type: Filtrer par type d'évaluation Accepted evaluationtype: Évaluations From bde623e80663d267eb51137430ce333eaa7cd429 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 10:47:36 +0200 Subject: [PATCH 145/191] add second indicator for person exports --- .../CountPersonWithAccompanyingCourse.php | 138 ++++++++++++++++++ .../config/services/exports_person.yaml | 7 + 2 files changed, 145 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php new file mode 100644 index 000000000..d271bd3da --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountPersonWithAccompanyingCourse.php @@ -0,0 +1,138 @@ +repository = $em->getRepository(AccompanyingPeriod::class); + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // TODO: Implement buildForm() method. + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Count people participating in an accompanying course'; + } + + /** + * @inheritDoc + */ + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + /** + * @inheritDoc + */ + public function getDescription(): string + { + return 'Count people participating in an accompanying course by various parameters.'; + } + + /** + * @inheritDoc + */ + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['export_result']; + } + + /** + * @inheritDoc + */ + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + /** + * @inheritDoc + */ + public function getType(): string + { + return Declarations::HOUSEHOLD_TYPE; + } + + /** + * @inheritDoc + */ + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + $qb = $this->repository->createQueryBuilder('acp') + ->join('acp.participations', 'acppart') + ->join('acppart.person', 'person') + ; + + $qb->select('COUNT(DISTINCT person.id) AS export_result'); + + return $qb; + } + + /** + * @inheritDoc + */ + public function requiredRole() + { + return new Role(AccompanyingPeriodVoter::STATS); + } + + /** + * @inheritDoc + */ + public function supportsModifiers(): array + { + return [ + Declarations::ACP_TYPE, + Declarations::PERSON_TYPE + ]; + } + + public function getGroup(): string + { + return 'Exports of persons'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index d3bb49b6f..288cd1f15 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -7,6 +7,13 @@ services: autoconfigure: true tags: - { name: chill.export, alias: count_person } + + chill.person.export.count_person_with_accompanying_course: + class: Chill\PersonBundle\Export\Export\CountPersonWithAccompanyingCourse + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_person_with_accompanying_course } chill.person.export.list_person: class: Chill\PersonBundle\Export\Export\ListPerson From c2c409998b0440aa692fc0a0119cb4bb66759f25 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 16 Aug 2022 10:30:44 +0200 Subject: [PATCH 146/191] exports: precise translation when acp filters/aggreg are combined with others --- .../ActivityTypeFilter.php | 2 +- .../translations/messages.fr.yml | 71 ++++++++++--------- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php index 7d916a148..938a4e4b4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/ActivityTypeFilter.php @@ -43,7 +43,7 @@ class ActivityTypeFilter implements FilterInterface */ public function getTitle(): string { - return 'Filter by activity type'; + return 'Filter accompanying course by activity type'; } /** diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 029803196..d9dad5f85 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -418,56 +418,57 @@ Having an accompanying period closed after this date: Ayant une période d'accom "Having an accompanying period closed before this date": "Ayant une période d'accompagnement fermée avant cette date" "Filtered by accompanying period: persons having an accompanying period closed between the %date_from% and %date_to%": "Filtrer par période d'accompagnement: ayant une période fermée entre le %date_from% et le %date_to%" -Filter by user scope: Filtrer par service du référent +Filter by user scope: Filtrer les parcours par service du référent "Filtered by user main scope: only %scope%": "Filtré par service du référent: uniquement %scope%" -Group by user scope: Grouper par service du référent +Group by user scope: Grouper les parcours par service du référent -Filter by user job: Filtrer par métier du référent +Filter by user job: Filtrer les parcours par métier du référent "Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" -Group by user job: Grouper par métier du référent +Group by user job: Grouper les parcours par métier du référent -Filter by social issue: Filtrer par problématiques sociales +Filter by social issue: Filtrer les parcours par problématiques sociales Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" -Group by social issue: Grouper par problématiques sociales +Group by social issue: Grouper les parcours par problématiques sociales -Filter by step: Filtrer par statut du parcours +Filter by step: Filtrer les parcours par statut du parcours Accepted steps: Statuts Step: Statut "Filtered by steps: only %step%": "Filtré par statut du parcours: uniquement %step%" -Group by step: Grouper par statut du parcours +Group by step: Grouper les parcours par statut du parcours -Filter by geographical unit: Filtrer par zone géographique -Filter by socialaction: Filtrer par action d'accompagnement +Filter by geographical unit: Filtrer les parcours par zone géographique + +Filter by socialaction: Filtrer les parcours par action d'accompagnement Accepted socialactions: Actions d'accompagnement "Filtered by socialactions: only %socialactions%": "Filtré par action d'accompagnement: uniquement %socialactions%" -Group by social action: Grouper par action d'accompagnement +Group by social action: Grouper les parcours par action d'accompagnement -Filter by evaluation: Filtrer par évaluation +Filter by evaluation: Filtrer les parcours par évaluation Accepted evaluations: Évaluations Evaluation: Évaluation "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" -Group by evaluation: Grouper par évaluation +Group by evaluation: Grouper les parcours par évaluation -Filter by activity type: Filtrer par type d'activité +Filter accompanying course by activity type: Filtrer les parcours par type d'activité Accepted activitytypes: Types d'activités "Filtered by activity types: only %activitytypes%": "Filtré par type d'activité: seulement %activitytypes%" -Filter by origin: Filtrer par origine du parcours +Filter by origin: Filtrer les parcours par origine du parcours Accepted origins: Origines "Filtered by origins: only %origins%": "Filtré par origine du parcours: uniquement %origins%" -Group by origin: Grouper par origine du parcours +Group by origin: Grouper les parcours par origine du parcours -Filter by closing motive: Filtrer par motif de fermeture +Filter by closing motive: Filtrer les parcours par motif de fermeture Accepted closingmotives: Motifs de clôture "Filtered by closingmotive: only %closingmotives%": "Filtré par motif de clôture: uniquement %closingmotives%" -Group by closing motive: Grouper par motif de fermeture +Group by closing motive: Grouper les parcours par motif de fermeture -Filter by administrative location: Filtrer par localisation administrative +Filter by administrative location: Filtrer les parcours par localisation administrative Accepted locations: Localisations administratives Administrative location: Localisation administrative "Filtered by administratives locations: only %locations%": "Filtré par localisation administrative: uniquement %locations%" -Group by administrative location: Grouper par localisation administrative +Group by administrative location: Grouper les parcours par localisation administrative Filter by requestor: Filtrer les parcours selon la présence du demandeur au sein des usagers concernés Accepted choices: '' @@ -477,29 +478,29 @@ is thirdparty: Le demandeur est un tiers no requestor: Il n'y a pas de demandeur "Filtered by requestor: only %choice%": "Filtré par présence du demandeur au sein des usagers concernés: uniquement si %choice%" -Filter by confidential: Filtrer par confidentialité +Filter by confidential: Filtrer les parcours par confidentialité Accepted confidentials: '' is confidential: le parcours est confidentiel is not confidential: le parcours n'est pas confidentiel "Filtered by confidential: only %confidential%": "Filtré par confidentialité: uniquement si %confidential%" Confidentiality: Confidentialité -Group by confidential: Grouper par confidentialité +Group by confidential: Grouper les parcours par confidentialité -Filter by emergency: Filtrer par urgence +Filter by emergency: Filtrer les parcours par urgence Accepted emergencies: '' is emergency: le parcours est urgent is not emergency: le parcours n'est pas urgent "Filtered by emergency: only %emergency%": "Filtré par urgence: uniquement si %emergency%" Emergency: Urgence -Group by emergency: Grouper par urgence +Group by emergency: Grouper les parcours par urgence -Filter by intensity: Filtrer par intensité +Filter by intensity: Filtrer les parcours par intensité Accepted intensities: '' is occasional: le parcours est ponctuel is regular: le parcours est régulier "Filtered by intensity: only %intensity%": "Filtré par intensité: uniquement si %intensity%" Intensity: Intensité -Group by intensity: Grouper par intensité +Group by intensity: Grouper les parcours par intensité Filter by active on date: Filtrer les parcours actifs à une date On date: Actifs à cette date @@ -508,17 +509,17 @@ On date: Actifs à cette date Filter by active at least one day between dates: Filtrer les parcours actifs au moins un jour dans la période "Filtered by actives courses: at least one day between %datefrom% and %dateto%": "Filtrer les parcours actifs: au moins un jour entre le %datefrom% et le %dateto%" -Filter by referrers: Filtrer par référent +Filter by referrers: Filtrer les parcours par référent Accepted referrers: Référents "Filtered by referrer: only %referrers%": "Filtré par référent: uniquement %referrers%" -Group by referrers: Grouper par référent +Group by referrers: Grouper les parcours par référent Filter by opened between dates: Filtrer les parcours ouverts entre deux dates Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" -Group social work actions by action type: Grouper les actions par type d'action +Group social work actions by action type: Grouper les actions par type Filter by treating agent scope: Filtrer les actions par service de l'agent traitant "Filtered by treating agent scope: only %scopes%": "Filtré par service de l'agent traitant: uniquement %scopes%" @@ -536,24 +537,24 @@ Group by treating agent: Grouper les actions par agent traitant Group social work actions by goal: Grouper les actions par objectif Group social work actions by result: Grouper les actions par résultat -Filter by evaluation type: Filtrer par type d'évaluation +Filter by evaluation type: Filtrer les évaluations par type Accepted evaluationtype: Évaluations "Filtered by evaluation type: only %evals%": "Filtré par type d'évaluation: uniquement %evals%" -Group by evaluation type: Grouper par type d'évaluation +Group by evaluation type: Grouper les évaluations par type Evaluation type: Type d'évaluation -Filter by maxdate: Filtrer par date d'échéance +Filter by maxdate: Filtrer les évaluations par date d'échéance Maxdate: '' is specified: La date d'échéance est spécifiée is not specified: La date d'échéance n'est pas spécifiée "Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%" -Filter by composition: Filtrer par composition familiale +Filter by composition: Filtrer les ménages par composition familiale Accepted composition: Composition familiale "Filtered by composition: only %compositions% on %ondate%": "Filtré par composition familiale: uniquement %compositions%, en date du %ondate%" -Group by composition: Grouper par composition familiale +Group by composition: Grouper les ménages par composition familiale -Group by number of children: Grouper par nombre d'enfants +Group by number of children: Grouper les ménages par nombre d'enfants ## aggregators Group people by nationality: Grouper les personnes par nationalités From 4c91bf5084c0a7d40972934f03f3e6023e3cff71 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 15:07:03 +0200 Subject: [PATCH 147/191] household position aggregator for person --- .../HouseholdPositionAggregator.php | 125 ++++++++++++++++++ .../config/services/exports_person.yaml | 7 + .../translations/messages.fr.yml | 5 +- 3 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php new file mode 100644 index 000000000..ec4a270ac --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/HouseholdPositionAggregator.php @@ -0,0 +1,125 @@ +translator = $translator; + $this->positionRepository = $positionRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->resetDQLPart('from'); + $qb->from('ChillPersonBundle:Household\HouseholdMember', 'hm'); + + $qb->join('hm.person', 'person'); + $qb->join('person.center', 'center'); + + $qb->andWhere($qb->expr()->andX( + $qb->expr()->lte('hm.startDate', ':date'), + $qb->expr()->orX( + $qb->expr()->isNull('hm.endDate'), + $qb->expr()->gte('hm.endDate', ':date') + ) + )); + + $qb->setParameter('date', $data['date_position']); + + $qb->addSelect('IDENTITY(hm.position) AS household_position_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('household_position_aggregator'); + } else { + $qb->groupBy('household_position_aggregator'); + } + + } + + public function applyOn() + { + return 'person'; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('date_position', ChillDateType::class, [ + 'label' => 'Household position in relation to this date', + 'data' => new DateTime(), + ]); + } + + public function getLabels($key, array $values, $data) + { + return function ($value) { + if ('_header' === $value) { + return 'Household position'; + } + + if (null === $value) { + return $this->translator->trans('without data'); + } + + $p = $this->positionRepository->find($value); + + return $this->translatableStringHelper->localize($p->getLabel()); + }; + } + + public function getQueryKeys($data) + { + return [ + 'household_position_aggregator', + ]; + } + + public function getTitle() + { + return 'Aggregate by household position'; + } + + public function validateForm($data, ExecutionContextInterface $context) + { + if (null === $data['date_position']) { + $context->buildViolation('The date should not be empty') + ->addViolation(); + } + } +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index 288cd1f15..c17dcaaf1 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -111,3 +111,10 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: person_marital_status_aggregator } + + chill.person.export.aggregator_household_position: + class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\HouseholdPositionAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: person_household_position_aggregator } diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 34921ec4b..df43b5922 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -388,7 +388,7 @@ Filter in relation to this date: Filtrer par rapport à cette date "Filtered by a state of %deadOrAlive% at this date %date_calc%": Filtré par personnes qui sont %deadOrAlive% à cette date %date_calc% Filter by person's age: Filtrer par âge de la personne -Filtered by person's age: Filtré par âge de la personne +"Filtered by person's age: between %min_age% and %max_age%": "Filtré par âge de la personne entre %min_age% et %max_age%" Minimum age: Âge minimum Maximum age: Âge maximum The minimum age should be less than the maximum age.: L'âge minimum doit être plus bas que l'âge maximum. @@ -570,6 +570,9 @@ Group by country: Grouper par pays Group people by gender: Grouper les personnes par genre Group people by their professional situation: Grouper les personnes par situation professionelle Group people by marital status: Grouper les personnes par état matrimonial +Aggregate by household position: Grouper par position dans le ménage +Household position in relation to this date: Position dans le ménage par rapport à cette date +Household position: Position dans le ménage Aggregate by age: Grouper par âge Calculate age in relation to this date: Calculer l'âge par rapport à cette date From 2c53f92a2ec447e37b19876d46d168b134eb5381 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 15:13:47 +0200 Subject: [PATCH 148/191] small refactorisations --- .../Export/Aggregator/PersonAggregators/AgeAggregator.php | 3 ++- .../PersonAggregators/CountryOfBirthAggregator.php | 3 ++- .../Export/Filter/PersonFilters/AgeFilter.php | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php index a8f57e022..00dd93a4b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/AgeAggregator.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface; use DateTime; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\Extension\Core\Type\DateType; +use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -45,7 +46,7 @@ final class AgeAggregator implements AggregatorInterface, ExportElementValidated return 'person'; } - public function buildForm(\Symfony\Component\Form\FormBuilderInterface $builder) + public function buildForm(FormBuilderInterface $builder) { $builder->add('date_age_calculation', DateType::class, [ 'label' => 'Calculate age in relation to this date', diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php index f0ae90f12..f54bffd0b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/PersonAggregators/CountryOfBirthAggregator.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Export\ExportElementValidatedInterface; use Chill\MainBundle\Repository\CountryRepository; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\MainBundle\Util\CountriesInfo; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use LogicException; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; @@ -122,7 +123,7 @@ final class CountryOfBirthAggregator implements AggregatorInterface, ExportEleme ->andWhere($qb->expr()->in('c.countryCode', ':countries')) ->setParameter('countries', $values) ->getQuery() - ->getResult(\Doctrine\ORM\Query::HYDRATE_SCALAR); + ->getResult(Query::HYDRATE_SCALAR); // initialize array and add blank key for null values $labels = [ diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php index 386b4f8b0..47fb37214 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/AgeFilter.php @@ -81,7 +81,11 @@ class AgeFilter implements ExportElementValidatedInterface, FilterInterface public function describeAction($data, $format = 'string') { - return ['Filtered by person\'s age']; + return ['Filtered by person\'s age: ' + . 'between %min_age% and %max_age%', [ + '%min_age%' => $data['min_age'], + '%max_age%' => $data['max_age'], + ], ]; } public function getTitle() From 8093c532d190957784127a84ebc76df0595d52db Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 16 Aug 2022 15:30:12 +0200 Subject: [PATCH 149/191] exports: overwrite activity translations --- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 1c9a37f99..881220538 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -211,9 +211,9 @@ List activities: Liste les activités List activities description: Créer la liste des activités Number of activities: Nombre d'activités Exports of activities: Exports des activités -Number of activities linked to an accompanying course: Nombre d'activités liés à un parcours. -Count activities linked to an accompanying period: Nombre d'activités liés à un parcours. -Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liés à un parcours en fonction de différents paramètres. +Number of activities linked to an accompanying course: Nombre d'activités liées à un parcours. +Count activities linked to an accompanying period: Nombre d'activités liées à un parcours. +Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. #filters Filter by reason: Filtrer par sujet d'activité From 42122f5832217bc2df7dc85a5b1483a721de15ef Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 16 Aug 2022 15:30:56 +0200 Subject: [PATCH 150/191] exports: use Declarations in activity exports --- .../Export/Aggregator/ActivityReasonAggregator.php | 5 +++-- .../Export/Aggregator/ActivityTypeAggregator.php | 5 +++-- .../Export/Aggregator/ActivityUserAggregator.php | 3 ++- .../ChillActivityBundle/Export/Export/CountActivity.php | 7 ++++++- .../Export/Export/CountActivityLinkedToACP.php | 2 +- .../ChillActivityBundle/Export/Export/ListActivity.php | 7 ++++++- .../Export/Export/StatActivityDuration.php | 8 ++++---- .../Export/Filter/ActivityDateFilter.php | 5 +++-- .../Export/Filter/ActivityReasonFilter.php | 5 +++-- .../Export/Filter/ActivityTypeFilter.php | 2 +- .../Filter/PersonHavingActivityBetweenDateFilter.php | 2 +- 11 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index 19811f584..b4d2f8e52 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Aggregator; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository; use Chill\ActivityBundle\Repository\ActivityReasonRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; @@ -104,9 +105,9 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali } } - public function applyOn() + public function applyOn(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 83b5f71e2..8a5ce4d01 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Aggregator; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityTypeRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\AggregatorInterface; @@ -51,9 +52,9 @@ class ActivityTypeAggregator implements AggregatorInterface $qb->addGroupBy(self::KEY); } - public function applyOn() + public function applyOn(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 312456104..3cdeee0f9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Aggregator; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; @@ -47,7 +48,7 @@ class ActivityUserAggregator implements AggregatorInterface public function applyOn(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php index 92e15e8bb..39710953c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php @@ -16,6 +16,8 @@ use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; +use Chill\ActivityBundle\Export\Declarations; +use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -98,7 +100,10 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function supportsModifiers() { - return ['person', 'activity']; + return [ + Declarations::ACTIVITY, + //PersonDeclarations::PERSON_TYPE, + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php index f17ced0fd..91a2dd285 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php @@ -101,7 +101,7 @@ class CountActivityLinkedToACP implements ExportInterface, GroupedExportInterfac { return [ Declarations::ACTIVITY, - PersonDeclarations::PERSON_TYPE, + //PersonDeclarations::PERSON_TYPE, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php index 438a879c4..773c4bee1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php @@ -28,6 +28,8 @@ use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Context\ExecutionContextInterface; use Symfony\Contracts\Translation\TranslatorInterface; +use Chill\ActivityBundle\Export\Declarations; +use Chill\PersonBundle\Export\Declarations as PersonDeclarations; use function array_key_exists; use function count; @@ -275,7 +277,10 @@ class ListActivity implements ListInterface, GroupedExportInterface public function supportsModifiers() { - return ['activity', 'person']; + return [ + Declarations::ACTIVITY, + //PersonDeclarations::PERSON_TYPE, + ]; } public function getGroup(): string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php index 5793c2b06..5f02928c6 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php @@ -17,8 +17,8 @@ use Chill\MainBundle\Entity\Center; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; -use Chill\PersonBundle\Export\Declarations as Person_Declarations; -use Chill\ActivityBundle\Export\Declarations as Activity_Declarations; +use Chill\PersonBundle\Export\Declarations as PersonDeclarations; +use Chill\ActivityBundle\Export\Declarations; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -130,8 +130,8 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function supportsModifiers() { return [ - Person_Declarations::PERSON_TYPE, - Activity_Declarations::ACTIVITY + Declarations::ACTIVITY, + //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 6048a1cc0..7a7fed3ee 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -11,6 +11,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Filter; +use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\Export\FilterType; use DateTime; @@ -57,9 +58,9 @@ class ActivityDateFilter implements FilterInterface $qb->setParameter('date_to', $data['date_to']); } - public function applyOn() + public function applyOn(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php index 467471a8d..de6baac03 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Entity\ActivityReason; +use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityReasonRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportElementValidatedInterface; @@ -79,9 +80,9 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt $qb->setParameter('selected_activity_reasons', $data['reasons']); } - public function applyOn() + public function applyOn(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 6b7e4eab5..9019bf3cd 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -62,7 +62,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter $qb->setParameter('selected_activity_types', $data['types']); } - public function applyOn() + public function applyOn(): string { return Declarations::ACTIVITY; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php index 312486b49..2c47d1c91 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php @@ -102,7 +102,7 @@ class PersonHavingActivityBetweenDateFilter implements ExportElementValidatedInt $qb->setParameter('person_having_activity_reasons', $data['reasons']); } - public function applyOn() + public function applyOn(): string { return Declarations::PERSON_IMPLIED_IN; } From b2c1c0ec76f4590a57b65e05272052099e885200 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 16 Aug 2022 16:19:39 +0200 Subject: [PATCH 151/191] add filter residential address at thirdparty of category --- .../ResidentialAddressAtThirdpartyFilter.php | 32 ++++++++++++++----- .../ResidentialAddressAtUserFilter.php | 3 +- .../config/services/exports_person.yaml | 7 ++++ .../translations/messages.fr.yml | 2 ++ 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php index 83f09bb0d..d8c0e1343 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtThirdpartyFilter.php @@ -12,15 +12,25 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\ThirdPartyBundle\Entity\ThirdPartyCategory; use DateTime; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; class ResidentialAddressAtThirdpartyFilter implements FilterInterface { + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(TranslatableStringHelper $translatableStringHelper) + { + $this->translatableStringHelper = $translatableStringHelper; + } + public function addRole() { return null; @@ -28,8 +38,9 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('thirdparty_type', EntityType::class, [ + $builder->add('thirdparty_cat', EntityType::class, [ 'class' => ThirdPartyCategory::class, + 'label' => 'Category', 'choice_label' => function (ThirdPartyCategory $tpc) { return $this->translatableStringHelper->localize($tpc->getName()); }, @@ -45,19 +56,19 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface public function alterQuery(QueryBuilder $qb, $data) { - - //TODO: Query is not finished... not clear what 'catégorie' corresponds with. Cannot get values to appear in table thirdparty_category $qb->resetDQLPart('from'); $qb->from('ChillPersonBundle:Person\ResidentialAddress', 'ra'); $qb->join('ra.person', 'person'); $qb->join('person.center', 'center'); - $qb->join('ra.hostThirdparty', 'thirdparty'); + $qb->join('ra.hostThirdParty', 't'); + $qb->join('t.categories', 'tc'); $where = $qb->getDQLPart('where'); $clause = $qb->expr()->andX( - $qb->expr()->isNotNull('ra.hostThirdparty'), - // $qb->expr()->in('thirdparty.categories') + $qb->expr()->isNotNull('ra.hostThirdParty'), + $qb->expr()->between(':date', 'ra.startDate', 'ra.endDate'), + $qb->expr()->in('tc.id', ':type') ); if ($where instanceof Expr\Andx) { @@ -66,6 +77,8 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface $where = $qb->expr()->andX($clause); } + $qb->setParameter('type', $data['thirdparty_cat']); + $qb->setParameter('date', $data['date_calc']); $qb->add('where', $where); } @@ -77,11 +90,14 @@ class ResidentialAddressAtThirdpartyFilter implements FilterInterface public function describeAction($data, $format = 'string') { - return ['Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type%']; + return ['Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type% and valid on %date_calc%', [ + '%thirdparty_type%' => $this->translatableStringHelper->localize($data['thirdparty_cat'][0]->getName()), + '%date_calc%' => $data['date_calc']->format('d-m-Y'), + ],]; } public function getTitle() { - return 'Filtered by person\'s who have a residential address located at a thirdparty of type %thirdparty_type%'; + return 'Filtered by person\'s who have a residential address located at a thirdparty of type'; } } \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php index 9558c5940..835185db5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/PersonFilters/ResidentialAddressAtUserFilter.php @@ -14,6 +14,7 @@ namespace Chill\PersonBundle\Export\Filter\PersonFilters; use Chill\MainBundle\Export\FilterInterface; use Chill\PersonBundle\Export\Declarations; use Doctrine\ORM\Query\Expr; +use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; class ResidentialAddressAtUserFilter implements FilterInterface @@ -34,7 +35,7 @@ class ResidentialAddressAtUserFilter implements FilterInterface $where = $qb->getDQLPart('where'); $clause = $qb->expr()->isNotNull('ra.hostPerson'); - if ($where instanceof Expr\Andx) { + if ($where instanceof Andx) { $where->add($clause); } else { $where = $qb->expr()->andX($clause); diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml index c17dcaaf1..ae8f90b78 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_person.yaml @@ -76,6 +76,13 @@ services: tags: - { name: chill.export_filter, alias: person_residential_address_at_user_filter } + chill.person.export.filter_residential_address_at_thirdparty: + class: Chill\PersonBundle\Export\Filter\PersonFilters\ResidentialAddressAtThirdpartyFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: person_residential_address_at_thirdparty_filter } + ## Aggregators chill.person.export.aggregator_nationality: class: Chill\PersonBundle\Export\Aggregator\PersonAggregators\NationalityAggregator diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index df43b5922..db79e6551 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -573,6 +573,8 @@ Group people by marital status: Grouper les personnes par état matrimonial Aggregate by household position: Grouper par position dans le ménage Household position in relation to this date: Position dans le ménage par rapport à cette date Household position: Position dans le ménage +Filtered by person's who have a residential address located at a thirdparty of type: Uniquement les usagers qui ont une addresse de résidence chez un tiers de catégorie "xxx" +"Filtered by person's who have a residential address located at a thirdparty of type %thirdparty_type% and valid on %date_calc%": "Uniquement les usagers qui ont une addresse de résidence chez un tiers de catégorie %thirdparty_type% et valide sur la date %date_calc%" Aggregate by age: Grouper par âge Calculate age in relation to this date: Calculer l'âge par rapport à cette date From fb18d9fb5651d4dcf2d7796097fdcc7f4fd0b426 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 16 Aug 2022 17:08:32 +0200 Subject: [PATCH 152/191] exports: improve activity translations --- .../Export/Export/CountActivity.php | 6 +++--- .../ChillActivityBundle/translations/messages.fr.yml | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php index 39710953c..3834bc819 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php @@ -44,7 +44,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getDescription() { - return 'Count activities by various parameters.'; + return 'Count activities linked to a person by various parameters.'; } public function getLabels($key, array $values, $data) @@ -53,7 +53,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface throw new LogicException("the key {$key} is not used by this export"); } - return static fn ($value) => '_header' === $value ? 'Number of activities' : $value; + return static fn ($value) => '_header' === $value ? 'Number of activities linked to a person' : $value; } public function getQueryKeys($data) @@ -68,7 +68,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getTitle() { - return 'Count activities'; + return 'Count activities linked to a person'; } public function getType() diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 881220538..9cc8d47af 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -203,16 +203,16 @@ Are you sure you want to remove the activity about "%name%" ?: Êtes-vous sûr d The activity has been successfully removed.: L'activité a été supprimée. # exports -Count activities: Nombre d'activités -Count activities by various parameters.: Compte le nombre d'activités enregistrées en fonction de différents paramètres. +Exports of activities: Exports des activités +Number of activities linked to a person: Nombre d'activités liées à une personne +Count activities linked to a person: Nombre d'activités liées à une personne +Count activities linked to a person by various parameters.: Compte le nombre d'activités enregistrées et liées à une personne en fonction de différents paramètres. Sum activity duration: Total de la durée des activités Sum activities duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. List activities: Liste les activités List activities description: Créer la liste des activités -Number of activities: Nombre d'activités -Exports of activities: Exports des activités -Number of activities linked to an accompanying course: Nombre d'activités liées à un parcours. -Count activities linked to an accompanying period: Nombre d'activités liées à un parcours. +Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours +Count activities linked to an accompanying period: Nombre d'activités liées à un parcours Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. #filters From 4ebe06453888892e9c16fa10a1714645c210f580 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 09:49:33 +0200 Subject: [PATCH 153/191] exports: improve translations --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index d9dad5f85..10e0e2539 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -346,7 +346,7 @@ Accompanying courses duration: Durée moyenne des parcours Create an average of accompanying courses duration according to various filters: Moyenne de la durée des parcours en jours, selon différents filtres. Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré -Exports of social work actions: Exports des actions d'accompangement +Exports of social work actions: Exports des actions d'accompagnement Count social work actions: Nombre d'actions d'accompagnement Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. @@ -356,7 +356,7 @@ Count evaluation by various parameters.: Compte le nombre d'évaluations selon d Exports of households: Exports des ménages Count households: Nombre de ménages -Count household by various parameters.: Compte le nombre de ménages selon différents filtres. +Count household by various parameters.: Compte le nombre de ménages impliqués dans un parcours selon différents filtres. ## filters Filter by person gender: Filtrer par genre de la personne From 94cee14a112328de2c6d5476edcc0dc57cc347bb Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 09:50:35 +0200 Subject: [PATCH 154/191] exports: complete modifiers --- src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php | 2 ++ src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php | 1 + 2 files changed, 3 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php index 3c7a0e319..1e703754e 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountEvaluation.php @@ -128,6 +128,8 @@ class CountEvaluation implements ExportInterface, GroupedExportInterface { return [ Declarations::EVAL_TYPE, + //Declarations::ACP_TYPE, + //Declarations::SOCIAL_WORK_ACTION_TYPE, ]; } diff --git a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php index 9767c17ed..a43345ff3 100644 --- a/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php +++ b/src/Bundle/ChillPersonBundle/Export/Export/CountHousehold.php @@ -130,6 +130,7 @@ class CountHousehold implements ExportInterface, GroupedExportInterface { return [ Declarations::HOUSEHOLD_TYPE, + //Declarations::ACP_TYPE ]; } From 57d00df46046f189d884f10e43d144190439beff Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 10:12:29 +0200 Subject: [PATCH 155/191] exports: split namespace between activity linked to person <> acp --- .../CountActivity.php} | 4 +-- .../{ => LinkedToPerson}/CountActivity.php | 2 +- .../{ => LinkedToPerson}/ListActivity.php | 2 +- .../StatActivityDuration.php | 2 +- .../config/services/export.yaml | 30 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) rename src/Bundle/ChillActivityBundle/Export/Export/{CountActivityLinkedToACP.php => LinkedToACP/CountActivity.php} (95%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/CountActivity.php (97%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/ListActivity.php (99%) rename src/Bundle/ChillActivityBundle/Export/Export/{ => LinkedToPerson}/StatActivityDuration.php (98%) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php similarity index 95% rename from src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 91a2dd285..35e52dbd5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivityLinkedToACP.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToACP; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityRepository; @@ -23,7 +23,7 @@ use LogicException; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -class CountActivityLinkedToACP implements ExportInterface, GroupedExportInterface +class CountActivity implements ExportInterface, GroupedExportInterface { protected ActivityRepository $activityRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php similarity index 97% rename from src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 3834bc819..425e15dea 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php similarity index 99% rename from src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 773c4bee1..b0112b24c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Repository\ActivityRepository; diff --git a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php similarity index 98% rename from src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php rename to src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 5f02928c6..be1e9d318 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Export; +namespace Chill\ActivityBundle\Export\Export\LinkedToPerson; use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 366c9c1b1..7d6570e07 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -4,26 +4,26 @@ services: autoconfigure: true ## Indicators - chill.activity.export.count_activity: - class: Chill\ActivityBundle\Export\Export\CountActivity + chill.activity.export.count_activity_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\CountActivity tags: - - { name: chill.export, alias: 'count_activity' } - + - { name: chill.export, alias: 'count_activity_linked_to_person' } + + chill.activity.export.sum_activity_duration_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\StatActivityDuration + tags: + - { name: chill.export, alias: 'sum_activity_duration_linked_to_person' } + + chill.activity.export.list_activity_linked_to_person: + class: Chill\ActivityBundle\Export\Export\LinkedToPerson\ListActivity + tags: + - { name: chill.export, alias: 'list_activity_linked_to_person' } + chill.activity.export.count_activity_linked_to_acp: - class: Chill\ActivityBundle\Export\Export\CountActivityLinkedToACP + class: Chill\ActivityBundle\Export\Export\LinkedToACP\CountActivity tags: - { name: chill.export, alias: 'count_activity_linked_to_acp' } - chill.activity.export.sum_activity_duration: - class: Chill\ActivityBundle\Export\Export\StatActivityDuration - tags: - - { name: chill.export, alias: 'sum_activity_duration' } - - chill.activity.export.list_activity: - class: Chill\ActivityBundle\Export\Export\ListActivity - tags: - - { name: chill.export, alias: 'list_activity' } - ## Filters chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter From d9b668e61461959486de9997d5c082de035a6302 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 11:44:15 +0200 Subject: [PATCH 156/191] exports: create new activity linked to acp exports indicators + title/descr/groups translations --- .../LinkedToACP/AvgActivityDuration.php | 79 +++++++++++++++++++ .../LinkedToACP/AvgActivityVisitDuration.php | 79 +++++++++++++++++++ .../Export/LinkedToACP/CountActivity.php | 22 +++--- .../LinkedToACP/SumActivityDuration.php | 79 +++++++++++++++++++ .../LinkedToACP/SumActivityVisitDuration.php | 78 ++++++++++++++++++ .../Export/LinkedToPerson/CountActivity.php | 2 +- .../Export/LinkedToPerson/ListActivity.php | 6 +- .../LinkedToPerson/StatActivityDuration.php | 6 +- .../config/services/export.yaml | 20 +++++ .../translations/messages.fr.yml | 26 ++++-- 10 files changed, 372 insertions(+), 25 deletions(-) create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php new file mode 100644 index 000000000..ec9c1aecb --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php new file mode 100644 index 000000000..f74dbda6d --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 35e52dbd5..faefaedfc 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -37,28 +37,28 @@ class CountActivity implements ExportInterface, GroupedExportInterface { } - public function getAllowedFormattersTypes() + public function getAllowedFormattersTypes(): array { return [FormatterInterface::TYPE_TABULAR]; } - public function getDescription() + public function getDescription(): string { return 'Count activities linked to an accompanying period by various parameters.'; } public function getLabels($key, array $values, $data) { - if ('export_count_activity_acp' !== $key) { + if ('export_count_activity' !== $key) { throw new LogicException("the key {$key} is not used by this export"); } return static fn ($value) => '_header' === $value ? 'Number of activities linked to an accompanying period' : $value; } - public function getQueryKeys($data) + public function getQueryKeys($data): array { - return ['export_count_activity_acp']; + return ['export_count_activity']; } public function getResult($qb, $data) @@ -66,12 +66,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); } - public function getTitle() + public function getTitle(): string { return 'Count activities linked to an accompanying period'; } - public function getType() + public function getType(): string { return Declarations::ACTIVITY; } @@ -83,7 +83,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface $qb = $this ->activityRepository ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity_acp'); + ->select('COUNT(activity.id) as export_count_activity'); $qb->andWhere( $qb->expr()->isNotNull('activity.accompanyingPeriod') @@ -92,12 +92,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface return $qb; } - public function requiredRole() + public function requiredRole(): Role { return new Role(ActivityStatsVoter::STATS); } - public function supportsModifiers() + public function supportsModifiers(): array { return [ Declarations::ACTIVITY, @@ -108,6 +108,6 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to an accompanying period'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php new file mode 100644 index 000000000..d32840d04 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -0,0 +1,79 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php new file mode 100644 index 000000000..94be1a546 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -0,0 +1,78 @@ +getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::ACTIVITY; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) + { + // TODO: Implement initiateQuery() method. + } + + public function requiredRole(): Role + { + return new Role(ActivityStatsVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::ACTIVITY, + //PersonDeclarations::ACP_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of activities linked to an accompanying period'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 425e15dea..18ef1671d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -108,6 +108,6 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index b0112b24c..3e8442a7e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -97,7 +97,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getDescription() { - return 'List activities description'; + return 'List activities linked to a person description'; } public function getLabels($key, array $values, $data) @@ -183,7 +183,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getTitle() { - return 'List activities'; + return 'List activities linked to a person'; } public function getType() @@ -285,6 +285,6 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index be1e9d318..80f1803c5 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -63,7 +63,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getDescription() { if (self::SUM === $this->action) { - return 'Sum activities duration by various parameters.'; + return 'Sum activities linked to a person duration by various parameters.'; } } @@ -91,7 +91,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getTitle() { if (self::SUM === $this->action) { - return 'Sum activity duration'; + return 'Sum activity linked to a person duration'; } } @@ -137,6 +137,6 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface public function getGroup(): string { - return 'Exports of activities'; + return 'Exports of activities linked to a person'; } } diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 7d6570e07..c6b0e9718 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -24,6 +24,26 @@ services: tags: - { name: chill.export, alias: 'count_activity_linked_to_acp' } + chill.activity.export.sum_activity_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityDuration + tags: + - { name: chill.export, alias: 'sum_activity_duration_linked_to_acp' } + + chill.activity.export.sum_activity_visit_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\SumActivityVisitDuration + tags: + - { name: chill.export, alias: 'sum_activity_visit_duration_linked_to_acp' } + + chill.activity.export.avg_activity_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityDuration + tags: + - { name: chill.export, alias: 'avg_activity_duration_linked_to_acp' } + + chill.activity.export.avg_activity_visit_duration_linked_to_acp: + class: Chill\ActivityBundle\Export\Export\LinkedToACP\AvgActivityVisitDuration + tags: + - { name: chill.export, alias: 'avg_activity_visit_duration_linked_to_acp' } + ## Filters chill.activity.export.reason_filter: class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 9cc8d47af..82c821f51 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -203,17 +203,29 @@ Are you sure you want to remove the activity about "%name%" ?: Êtes-vous sûr d The activity has been successfully removed.: L'activité a été supprimée. # exports -Exports of activities: Exports des activités +Exports of activities linked to a person: Exports des activités liées à une personne + Number of activities linked to a person: Nombre d'activités liées à une personne -Count activities linked to a person: Nombre d'activités liées à une personne +Count activities linked to a person: Nombre d'activités Count activities linked to a person by various parameters.: Compte le nombre d'activités enregistrées et liées à une personne en fonction de différents paramètres. -Sum activity duration: Total de la durée des activités -Sum activities duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. -List activities: Liste les activités -List activities description: Créer la liste des activités +Sum activity linked to a person duration: Total de la durée des activités +Sum activities linked to a person duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. +List activities linked to a person: Liste les activités +List activities linked to a person description: Crée la liste des activités en fonction de différents paramètres. + +Exports of activities linked to an accompanying period: Exports des activités liées à un parcours + Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours -Count activities linked to an accompanying period: Nombre d'activités liées à un parcours +Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. +Sum activity linked to an accompanying period duration: Somme de la durée des activités +Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. +Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités +Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. +Average activity linked to an accompanying period duration: Moyenne de la durée des activités +Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. +Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités +Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters Filter by reason: Filtrer par sujet d'activité From 01f6eb1a8f3773f200867702afa5f18922ccf35c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 17 Aug 2022 11:57:46 +0200 Subject: [PATCH 157/191] fix merge conflict in translations --- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 822bfa40e..58ed3204e 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -431,13 +431,7 @@ Filter by user job: Filtrer les parcours par métier du référent "Filtered by user job: only %job%": "Filtré par métier du référent: uniquement %job%" Group by user job: Grouper les parcours par métier du référent -<<<<<<< HEAD -Filter by scope: Filtrer par service - -Filter by social issue: Filtrer par problématiques sociales -======= Filter by social issue: Filtrer les parcours par problématiques sociales ->>>>>>> 111_exports Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" Group by social issue: Grouper les parcours par problématiques sociales From df9a5071c714b653dc4d7525c7f8f9268b465341 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 13:02:54 +0200 Subject: [PATCH 158/191] exports: display group as a breadcrumb in template add a private method in controller which could be moved maybe in ExportManager --- .../Controller/ExportController.php | 24 ++++++++++++++++++- .../Resources/views/Export/download.html.twig | 5 ++++ .../Resources/views/Export/new.html.twig | 5 ++++ .../views/Export/new_centers_step.html.twig | 5 ++++ .../views/Export/new_formatter_step.html.twig | 5 ++++ 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Controller/ExportController.php b/src/Bundle/ChillMainBundle/Controller/ExportController.php index 5dcd158f6..a7404b879 100644 --- a/src/Bundle/ChillMainBundle/Controller/ExportController.php +++ b/src/Bundle/ChillMainBundle/Controller/ExportController.php @@ -86,6 +86,9 @@ class ExportController extends AbstractController { /** @var \Chill\MainBundle\Export\ExportManager $exportManager */ $exportManager = $this->exportManager; + + $export = $exportManager->getExport($alias); + $key = $request->query->get('key', null); [$dataCenters, $dataExport, $dataFormatter] = $this->rebuildData($key); @@ -100,7 +103,8 @@ class ExportController extends AbstractController $viewVariables = [ 'alias' => $alias, - 'export' => $exportManager->getExport($alias), + 'export' => $export, + 'export_group' => $this->getExportGroup($export), ]; if ($formater instanceof \Chill\MainBundle\Export\Formatter\CSVListFormatter) { @@ -316,6 +320,7 @@ class ExportController extends AbstractController 'form' => $form->createView(), 'export_alias' => $alias, 'export' => $export, + 'export_group' => $this->getExportGroup($export), ]); } @@ -371,6 +376,7 @@ class ExportController extends AbstractController [ 'form' => $form->createView(), 'export' => $export, + 'export_group' => $this->getExportGroup($export), ] ); } @@ -514,6 +520,7 @@ class ExportController extends AbstractController [ 'form' => $form->createView(), 'export' => $export, + 'export_group' => $this->getExportGroup($export), ] ); } @@ -565,4 +572,19 @@ class ExportController extends AbstractController throw new LogicException("the step {$step} is not defined."); } } + + private function getExportGroup($target): string + { + $exportManager = $this->exportManager; + + $groups = $exportManager->getExportsGrouped(true); + + foreach ($groups as $group => $array) { + foreach ($array as $alias => $export) { + if ($export === $target) { + return $group; + } + } + } + } } diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig index 505c22ab4..fa568d857 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/download.html.twig @@ -36,6 +36,11 @@ window.addEventListener("DOMContentLoaded", function(e) { {% block content %}
    +
    + + {{ export_group|trans }} +
    +

    {{ export.title|trans }}

    {{ "Download export"|trans }}

    diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig index 4ee857f00..8aac6c253 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new.html.twig @@ -27,6 +27,11 @@ {% block content %}
    +
    + + {{ export_group|trans }} +
    +

    {{ export.title|trans }}

    {{ export.description|trans }}

    diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig index 9adad67df..4a2d9ab9e 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_centers_step.html.twig @@ -23,6 +23,11 @@ {% block content %}
    +
    + + {{ export_group|trans }} +
    +

    {{ export.title|trans }}

    {{ export.description|trans }}

    diff --git a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig index 4854b1c9d..443816611 100644 --- a/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig +++ b/src/Bundle/ChillMainBundle/Resources/views/Export/new_formatter_step.html.twig @@ -22,6 +22,11 @@ {% block content %}
    + +
    + + {{ export_group|trans }} +

    {{ export.title|trans }}

    From c09c7a9615adf3a875900442eb2e34c325819fc7 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 14:18:39 +0200 Subject: [PATCH 159/191] exports: add new modifiers declarations to split filter/aggregators between activities linked to person <> acp --- .../Export/Aggregator/ActivityReasonAggregator.php | 2 +- .../Export/Aggregator/ActivityTypeAggregator.php | 2 +- .../Export/Aggregator/ActivityUserAggregator.php | 2 +- src/Bundle/ChillActivityBundle/Export/Declarations.php | 4 ++++ .../Export/Export/LinkedToACP/AvgActivityDuration.php | 1 + .../Export/Export/LinkedToACP/AvgActivityVisitDuration.php | 1 + .../Export/Export/LinkedToACP/CountActivity.php | 2 +- .../Export/Export/LinkedToACP/SumActivityDuration.php | 1 + .../Export/Export/LinkedToACP/SumActivityVisitDuration.php | 1 + .../Export/Export/LinkedToPerson/CountActivity.php | 5 +++-- .../Export/Export/LinkedToPerson/ListActivity.php | 5 +++-- .../Export/Export/LinkedToPerson/StatActivityDuration.php | 5 +++-- .../ChillActivityBundle/Export/Filter/ActivityDateFilter.php | 2 +- .../Export/Filter/ActivityReasonFilter.php | 2 +- .../ChillActivityBundle/Export/Filter/ActivityTypeFilter.php | 2 +- 15 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php index b4d2f8e52..5c77159e3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php @@ -107,7 +107,7 @@ class ActivityReasonAggregator implements AggregatorInterface, ExportElementVali public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 8a5ce4d01..3d73e0648 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -54,7 +54,7 @@ class ActivityTypeAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 3cdeee0f9..be4149bf9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -48,7 +48,7 @@ class ActivityUserAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Declarations.php b/src/Bundle/ChillActivityBundle/Export/Declarations.php index 76335415f..7a5b47028 100644 --- a/src/Bundle/ChillActivityBundle/Export/Declarations.php +++ b/src/Bundle/ChillActivityBundle/Export/Declarations.php @@ -17,4 +17,8 @@ namespace Chill\ActivityBundle\Export; abstract class Declarations { public const ACTIVITY = 'activity'; + + public const ACTIVITY_ACP = "activity_linked_to_acp"; + + public const ACTIVITY_PERSON = "activity_linked_to_person"; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index ec9c1aecb..327dc9e30 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -67,6 +67,7 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index f74dbda6d..96c7941e9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -67,6 +67,7 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index faefaedfc..2cbd7ddd8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -101,7 +101,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, - //PersonDeclarations::PERSON_TYPE, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index d32840d04..40f8977a3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -67,6 +67,7 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index 94be1a546..1bbc83a86 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -67,6 +67,7 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_ACP, //PersonDeclarations::ACP_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 18ef1671d..96c79297e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -71,9 +71,9 @@ class CountActivity implements ExportInterface, GroupedExportInterface return 'Count activities linked to a person'; } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -102,6 +102,7 @@ class CountActivity implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 3e8442a7e..3ded55b56 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -186,9 +186,9 @@ class ListActivity implements ListInterface, GroupedExportInterface return 'List activities linked to a person'; } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -279,6 +279,7 @@ class ListActivity implements ListInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 80f1803c5..94903b282 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -95,9 +95,9 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface } } - public function getType() + public function getType(): string { - return 'activity'; + return Declarations::ACTIVITY; } public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) @@ -131,6 +131,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface { return [ Declarations::ACTIVITY, + Declarations::ACTIVITY_PERSON, //PersonDeclarations::PERSON_TYPE, ]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 7a7fed3ee..977fa2f9e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -60,7 +60,7 @@ class ActivityDateFilter implements FilterInterface public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php index de6baac03..eef032818 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php @@ -82,7 +82,7 @@ class ActivityReasonFilter implements ExportElementValidatedInterface, FilterInt public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index 9019bf3cd..bfd80ecc7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -64,7 +64,7 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function applyOn(): string { - return Declarations::ACTIVITY; + return Declarations::ACTIVITY_PERSON; } public function buildForm(FormBuilderInterface $builder) From c17036fcdaf2259bfc80435a513614c5559c4c27 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 15:27:37 +0200 Subject: [PATCH 160/191] exports: fix activitytype filter/aggregator appliedTo activity_person and too activity_acl --- .../Aggregator/ActivityTypeAggregator.php | 18 +++++++---- .../Export/LinkedToACP/CountActivity.php | 25 +++++++--------- .../Export/LinkedToPerson/CountActivity.php | 13 ++++---- .../Export/Filter/ActivityTypeFilter.php | 30 ++++++++----------- .../translations/messages.fr.yml | 2 +- .../translations/messages.nl.yaml | 2 +- 6 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php index 3d73e0648..cedd2df8c 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityTypeAggregator.php @@ -45,16 +45,24 @@ class ActivityTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - // add select element - $qb->addSelect(sprintf('IDENTITY(activity.type) AS %s', self::KEY)); + if (!in_array('type', $qb->getAllAliases())) { + $qb->join('activity.activityType', 'type'); + } - // add the "group by" part - $qb->addGroupBy(self::KEY); + $qb->addSelect(sprintf('IDENTITY(activity.activityType) AS %s', self::KEY)); + + $groupby = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy(self::KEY); + } else { + $qb->groupBy(self::KEY); + } } public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php index 2cbd7ddd8..55c0a1974 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/CountActivity.php @@ -11,13 +11,15 @@ declare(strict_types=1); namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; -use Chill\ActivityBundle\Repository\ActivityRepository; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Chill\PersonBundle\Export\Declarations as PersonDeclarations; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\Query; use LogicException; use Symfony\Component\Form\FormBuilderInterface; @@ -25,12 +27,12 @@ use Symfony\Component\Security\Core\Role\Role; class CountActivity implements ExportInterface, GroupedExportInterface { - protected ActivityRepository $activityRepository; + protected EntityRepository $repository; public function __construct( - ActivityRepository $activityRepository + EntityManagerInterface $em ) { - $this->activityRepository = $activityRepository; + $this->repository = $em->getRepository(Activity::class); } public function buildForm(FormBuilderInterface $builder) @@ -78,17 +80,12 @@ class CountActivity implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - $centers = array_map(static fn ($el) => $el['center'], $acl); - - $qb = $this - ->activityRepository - ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity'); - - $qb->andWhere( - $qb->expr()->isNotNull('activity.accompanyingPeriod') - ); + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + $qb->select('COUNT(activity.id) as export_count_activity'); + return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php index 96c79297e..75d3122c3 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/CountActivity.php @@ -80,15 +80,16 @@ class CountActivity implements ExportInterface, GroupedExportInterface { $centers = array_map(static fn ($el) => $el['center'], $acl); - $qb = $this - ->activityRepository - ->createQueryBuilder('activity') - ->select('COUNT(activity.id) as export_count_activity') - ->join('activity.person', 'person'); + $qb = $this->activityRepository->createQueryBuilder('activity') + ->join('activity.person', 'person') + ; + + $qb->select('COUNT(activity.id) as export_count_activity'); $qb ->where($qb->expr()->in('person.center', ':centers')) - ->setParameter('centers', $centers); + ->setParameter('centers', $centers) + ; return $qb; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php index bfd80ecc7..665515cb1 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityTypeFilter.php @@ -64,37 +64,31 @@ class ActivityTypeFilter implements ExportElementValidatedInterface, FilterInter public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) { - $builder->add( - 'types', - EntityType::class, - [ - 'class' => ActivityType::class, - 'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()), - 'multiple' => true, - 'expanded' => false, - ] - ); + $builder->add('types', EntityType::class, [ + 'class' => ActivityType::class, + 'choice_label' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getName()), + 'group_by' => fn (ActivityType $type) => $this->translatableStringHelper->localize($type->getCategory()->getName()), + 'multiple' => true, + 'expanded' => false, + ]); } public function describeAction($data, $format = 'string') { // collect all the reasons'name used in this filter in one array $reasonsNames = array_map( - fn (ActivityType $t): string => '"' . $this->translatableStringHelper->localize($t->getName()) . '"', + fn (ActivityType $t): string => $this->translatableStringHelper->localize($t->getName()), $this->activityTypeRepository->findBy(['id' => $data['types']->toArray()]) ); - return [ - 'Filtered by activity type: only %list%', - [ - '%list%' => implode(', ', $reasonsNames), - ], - ]; + return ['Filtered by activity type: only %list%', [ + '%list%' => implode(', ou ', $reasonsNames), + ]]; } public function getTitle() diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 82c821f51..7eacba1ce 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -230,7 +230,7 @@ Average activities linked to an accompanying period visit duration by various pa #filters Filter by reason: Filtrer par sujet d'activité 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' -'Filtered by activity type: only %list%': "Filtré par type d'activité: seulement %list%" +'Filtered by activity type: only %list%': "Filtré par type d'activité: uniquement %list%" Filtered by date activity: Filtrer par date d'activité Activities after this date: Activités après cette date Activities before this date: Activités avant cette date diff --git a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml index d24eacf0a..0403e55ee 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml +++ b/src/Bundle/ChillActivityBundle/translations/messages.nl.yaml @@ -195,7 +195,7 @@ Number of activities: Nombre d'activités #filters Filter by reason: Filtrer par sujet d'activité 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' -'Filtered by activity type: only %list%': "Filtré par type d'activity: seulement %list%" +'Filtered by activity type: only %list%': "Filtré par type d'activity: uniquement %list%" Filtered by date activity: Filtrer par date d'activité Activities after this date: Activités après cette date Activities before this date: Activités avant cette date From 50609065911ac8753e5d7051fd7680d9f1d6bd57 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 17 Aug 2022 16:03:58 +0200 Subject: [PATCH 161/191] more attempts to make dynamic form work --- .../SocialWorkTypeFilter.php | 32 +++++++++++-------- .../services/exports_social_actions.yaml | 22 ++++++------- .../translations/messages.fr.yml | 2 ++ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index b5b8fbfd1..4eec8dd69 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -6,9 +6,11 @@ use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Entity\SocialWork\Goal; use Chill\PersonBundle\Export\Declarations; +use Chill\PersonBundle\Repository\SocialWork\SocialActionRepository; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Templating\Entity\SocialActionRender; @@ -26,17 +28,26 @@ class SocialWorkTypeFilter implements FilterInterface private TranslatableStringHelper $translatableStringHelper; - public function __construct(SocialActionRender $socialActionRender, TranslatableStringHelper $translatableStringHelper) + private SocialActionRepository $socialActionRepository; + + public function __construct + ( + SocialActionRender $socialActionRender, + TranslatableStringHelper $translatableStringHelper, + SocialActionRepository $socialActionRepository + ) { $this->socialActionRender = $socialActionRender; $this->translatableStringHelper = $translatableStringHelper; + $this->socialActionRepository = $socialActionRepository; } public function buildForm(FormBuilderInterface $builder) { + $socialActions = $this->socialActionRepository->findAll(); - $builder->add('actionType', EntityType::class, [ - 'class' => SocialAction::class, + $builder->add('actionType', ChoiceType::class, [ + 'choices' => $socialActions, 'choice_label' => function (SocialAction $sa) { return $this->socialActionRender->renderString($sa, []); }, @@ -48,8 +59,7 @@ class SocialWorkTypeFilter implements FilterInterface $goals = null === $actionType ? [] : $actionType->getGoals(); - $form->add('goal', EntityType::class, [ - 'class' => Goal::class, + $form->add('goal', ChoiceType::class, [ 'placeholder' => '', 'choices' => $goals, 'choice_label' => function (Goal $g) { @@ -58,22 +68,18 @@ class SocialWorkTypeFilter implements FilterInterface ]); }; - $builder->addEventListener(FormEvents::POST_SUBMIT, function (PostSubmitEvent $event) use ($refreshGoals) { - dump($event); - $form = $event->getForm(); + $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($refreshGoals) { $data = $event->getData(); + dump($data); - $refreshGoals($form, $data); - + $refreshGoals($event->getForm(), $data); }); $builder->get('actionType')->addEventListener( FormEvents::POST_SUBMIT, function (FormEvent $event) use ($refreshGoals) { $actionType = $event->getForm()->getData(); - dump('after submit listener'); dump($actionType); - $refreshGoals($event->getForm()->getParent(), $actionType); } ); @@ -129,4 +135,4 @@ class SocialWorkTypeFilter implements FilterInterface { return Declarations::SOCIAL_WORK_ACTION_TYPE; } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml index ef86732ff..d5f7376db 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_social_actions.yaml @@ -1,4 +1,4 @@ -services: +services: chill.person.export.count_social_work_actions: class: Chill\PersonBundle\Export\Export\CountSocialWorkActions @@ -6,15 +6,15 @@ services: autoconfigure: true tags: - { name: chill.export, alias: count_social_work_actions } - + ## FILTERS - # chill.person.export.filter_social_work_type: - # class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter - # autowire: true - # autoconfigure: true - # tags: - # - { name: chill.export_filter, alias: social_work_type_filter } + chill.person.export.filter_social_work_type: + class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\SocialWorkTypeFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: social_work_type_filter } chill.person.export.filter_scope: class: Chill\PersonBundle\Export\Filter\SocialWorkFilters\ScopeFilter @@ -36,7 +36,7 @@ services: autoconfigure: true tags: - { name: chill.export_filter, alias: social_work_actions_treatingagent_filter } - + ## AGGREGATORS chill.person.export.aggregator_action_type: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ActionTypeAggregator @@ -65,14 +65,14 @@ services: autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_treatingagent_aggregator } - + chill.person.export.aggregator_goal: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\GoalAggregator autowire: true autoconfigure: true tags: - { name: chill.export_aggregator, alias: social_work_actions_goal_aggregator } - + chill.person.export.aggregator_result: class: Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators\ResultAggregator autowire: true diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 58ed3204e..c18e6ce29 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -352,6 +352,7 @@ Exports of social work actions: Exports des actions d'accompangement Count social work actions: Nombre d'actions d'accompagnement Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. + Exports of evaluations: Exports des évaluations Count evaluations: Nombre d'évaluations Count evaluation by various parameters.: Compte le nombre d'évaluations selon différents filtres. @@ -448,6 +449,7 @@ Filter by socialaction: Filtrer les parcours par action d'accompagnement Accepted socialactions: Actions d'accompagnement "Filtered by socialactions: only %socialactions%": "Filtré par action d'accompagnement: uniquement %socialactions%" Group by social action: Grouper les parcours par action d'accompagnement +Filter by type of action, objectives and results: "Filtrer par type d'action, objectif et résultat" Filter by evaluation: Filtrer les parcours par évaluation Accepted evaluations: Évaluations From 3c5d533c580b4ff0784d8b47971ce0805832a0d2 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 17 Aug 2022 16:04:46 +0200 Subject: [PATCH 162/191] first indicator for calendar exports --- .../ChillCalendarExtension.php | 1 + .../Export/Declarations.php | 20 ++++ .../Export/Export/CountAppointments.php | 111 ++++++++++++++++++ .../Resources/config/services/exports.yaml | 9 ++ .../translations/messages.fr.yml | 4 + 5 files changed, 145 insertions(+) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Declarations.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php create mode 100644 src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml diff --git a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php index 165365597..e33e6c3c3 100644 --- a/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php +++ b/src/Bundle/ChillCalendarBundle/DependencyInjection/ChillCalendarExtension.php @@ -32,6 +32,7 @@ class ChillCalendarExtension extends Extension implements PrependExtensionInterf $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yml'); + $loader->load('services/exports.yaml'); $loader->load('services/controller.yml'); $loader->load('services/fixtures.yml'); $loader->load('services/form.yml'); diff --git a/src/Bundle/ChillCalendarBundle/Export/Declarations.php b/src/Bundle/ChillCalendarBundle/Export/Declarations.php new file mode 100644 index 000000000..616d70a1a --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Declarations.php @@ -0,0 +1,20 @@ +calendarRepository = $calendarRepository; + } + + public function buildForm(FormBuilderInterface $builder) + { + // No form necessary + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'Count appointments by various parameters.'; + } + + public function getLabels($key, array $values, $data): \Closure + { + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(AbstractQuery::HYDRATE_SCALAR); + } + + public function getTitle(): string + { + return 'Count appointments'; + } + + 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 function ($el) { + return $el['center']; + }, $acl); + + $qb = $this->calendarRepository->createQueryBuilder('appointment'); + + $qb->select('COUNT(appointment.id) AS export_result'); + + return $qb; + } + + public function requiredRole(): Role + { + + // which role should we give here? + return new Role(PersonVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::CALENDAR_TYPE, + ]; + } + + public function getGroup(): string + { + return 'Exports of calendar'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml new file mode 100644 index 000000000..ee8f444a5 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -0,0 +1,9 @@ +services: + + ## Indicators + chill.calendar.export.count_appointments: + class: Chill\CalendarBundle\Export\Export\CountAppointments + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: count_appointments } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index da244fd13..5d32bc5d1 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -38,3 +38,7 @@ crud: add_new: Ajouter un nouveau title_new: Nouveau motif d'annulation title_edit: Modifier le motif d'annulation + +# exports +Exports of calendar: Exports des rendez-vous +Count appointments: Nombre des rendez-vous From 26cd677501bf04c1ad61e3fa142e0c6e55ad3f11 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 16:07:20 +0200 Subject: [PATCH 163/191] exports: activity new indicators works + improve translations --- .../LinkedToACP/AvgActivityDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/AvgActivityVisitDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/SumActivityDuration.php | 27 +++++++++++++++++-- .../LinkedToACP/SumActivityVisitDuration.php | 27 +++++++++++++++++-- .../translations/messages.fr.yml | 8 ++++++ 5 files changed, 108 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php index 327dc9e30..1ae5d1830 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class AvgActivityDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_avg_activity_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class AvgActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('AVG(activity.durationTime) as export_avg_activity_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php index 96c7941e9..b03378b16 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/AvgActivityVisitDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_avg_activity_visit_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Average activities linked to an accompanying period visit duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class AvgActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('AVG(activity.travelTime) as export_avg_activity_visit_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php index 40f8977a3..3ab192702 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class SumActivityDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_sum_activity_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class SumActivityDuration implements ExportInterface, GroupedExportInterface public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('SUM(activity.durationTime) as export_sum_activity_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php index 1bbc83a86..452fc4de7 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToACP/SumActivityVisitDuration.php @@ -2,17 +2,30 @@ namespace Chill\ActivityBundle\Export\Export\LinkedToACP; +use Chill\ActivityBundle\Entity\Activity; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\ExportInterface; +use Chill\MainBundle\Export\FormatterInterface; use Chill\MainBundle\Export\GroupedExportInterface; use Closure; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; class SumActivityVisitDuration implements ExportInterface, GroupedExportInterface { + protected EntityRepository $repository; + + public function __construct( + EntityManagerInterface $em + ) { + $this->repository = $em->getRepository(Activity::class); + } + public function buildForm(FormBuilderInterface $builder) { // TODO: Implement buildForm() method. @@ -35,7 +48,11 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function getLabels($key, array $values, $data) { - // TODO: Implement getLabels() method. + if ('export_sum_activity_visit_duration' !== $key) { + throw new LogicException("the key {$key} is not used by this export"); + } + + return static fn ($value) => '_header' === $value ? 'Sum activities linked to an accompanying period visit duration' : $value; } public function getQueryKeys($data): array @@ -55,7 +72,13 @@ class SumActivityVisitDuration implements ExportInterface, GroupedExportInterfac public function initiateQuery(array $requiredModifiers, array $acl, array $data = []) { - // TODO: Implement initiateQuery() method. + $qb = $this->repository->createQueryBuilder('activity') + ->join('activity.accompanyingPeriod', 'acp') + ; + + $qb->select('SUM(activity.travelTime) as export_sum_activity_visit_duration'); + + return $qb; } public function requiredRole(): Role diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 7eacba1ce..1d7d61592 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -218,13 +218,21 @@ Exports of activities linked to an accompanying period: Exports des activités l Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. + Sum activity linked to an accompanying period duration: Somme de la durée des activités +Sum activities linked to an accompanying period duration: Somme de la durée des activités liées à un parcours Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. + Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités +Sum activities linked to an accompanying period visit duration: Somme de la durée de déplacement des activités liées à un parcours Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. + Average activity linked to an accompanying period duration: Moyenne de la durée des activités +Average activities linked to an accompanying period duration: Moyenne de la durée des activités liées à un parcours Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. + Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités +Average activities linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités liées à un parcours Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters From c199bb55347ad38a59facad5e2376a8de90adc4f Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 16:51:21 +0200 Subject: [PATCH 164/191] exports: activity improve translations --- .../Export/LinkedToPerson/ListActivity.php | 2 +- .../LinkedToPerson/StatActivityDuration.php | 2 +- .../translations/messages.fr.yml | 24 ++++++++----------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php index 3ded55b56..21a68fb93 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/ListActivity.php @@ -183,7 +183,7 @@ class ListActivity implements ListInterface, GroupedExportInterface public function getTitle() { - return 'List activities linked to a person'; + return 'List activity linked to a person'; } public function getType(): string diff --git a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php index 94903b282..5fae246f8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php +++ b/src/Bundle/ChillActivityBundle/Export/Export/LinkedToPerson/StatActivityDuration.php @@ -73,7 +73,7 @@ class StatActivityDuration implements ExportInterface, GroupedExportInterface throw new LogicException(sprintf('The key %s is not used by this export', $key)); } - $header = self::SUM === $this->action ? 'Sum of activities duration' : false; + $header = self::SUM === $this->action ? 'Sum activities linked to a person duration' : false; return static fn (string $value) => '_header' === $value ? $header : $value; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 1d7d61592..f6bfafc41 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -204,42 +204,38 @@ The activity has been successfully removed.: L'activité a été supprimée. # exports Exports of activities linked to a person: Exports des activités liées à une personne - Number of activities linked to a person: Nombre d'activités liées à une personne Count activities linked to a person: Nombre d'activités Count activities linked to a person by various parameters.: Compte le nombre d'activités enregistrées et liées à une personne en fonction de différents paramètres. -Sum activity linked to a person duration: Total de la durée des activités +Sum activity linked to a person duration: Durée des activités +Sum activities linked to a person duration: Durée des activités liés à un usager Sum activities linked to a person duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. -List activities linked to a person: Liste les activités +List activity linked to a person: Liste les activités +List activities linked to a person: Liste des activités liés à un usager List activities linked to a person description: Crée la liste des activités en fonction de différents paramètres. Exports of activities linked to an accompanying period: Exports des activités liées à un parcours - Number of activities linked to an accompanying period: Nombre d'activités liées à un parcours Count activities linked to an accompanying period: Nombre d'activités Count activities linked to an accompanying period by various parameters.: Compte le nombre d'activités enregistrées et liées à un parcours en fonction de différents paramètres. - Sum activity linked to an accompanying period duration: Somme de la durée des activités Sum activities linked to an accompanying period duration: Somme de la durée des activités liées à un parcours Sum activities linked to an accompanying period duration by various parameters.: Additionne la durée des activités en fonction de différents paramètres. - Sum activity linked to an accompanying period visit duration: Somme de la durée de déplacement des activités Sum activities linked to an accompanying period visit duration: Somme de la durée de déplacement des activités liées à un parcours Sum activities linked to an accompanying period visit duration by various parameters.: Additionne la durée de déplacement des activités en fonction de différents paramètres. - Average activity linked to an accompanying period duration: Moyenne de la durée des activités Average activities linked to an accompanying period duration: Moyenne de la durée des activités liées à un parcours Average activities linked to an accompanying period duration by various parameters.: Moyenne de la durée des activités en fonction de différents paramètres. - Average activity linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités Average activities linked to an accompanying period visit duration: Moyenne de la durée de déplacement des activités liées à un parcours Average activities linked to an accompanying period visit duration by various parameters.: Moyenne de la durée de déplacement des activités en fonction de différents paramètres. #filters -Filter by reason: Filtrer par sujet d'activité +Filter by reason: Filtrer les activités par sujet 'Filtered by reasons: only %list%': 'Filtré par sujet: seulement %list%' 'Filtered by activity type: only %list%': "Filtré par type d'activité: uniquement %list%" -Filtered by date activity: Filtrer par date d'activité +Filtered by date activity: Filtrer les activités par date Activities after this date: Activités après cette date Activities before this date: Activités avant cette date "Filtered by date of activity: only between %date_from% and %date_to%": "Filtré par date de l'activité: uniquement entre %date_from% et %date_to%" @@ -251,7 +247,7 @@ Implied in an activity before this date: Impliqué dans une activité avant cett Filtered by person having an activity between %date_from% and %date_to% with reasons %reasons_name%: Filtré par personnes associées à une activité entre %date_from% et %date_to% avec les sujets %reasons_name% Activity reasons for those activities: Sujets de ces activités -Filter by activity type: Filtrer par type d'activité +Filter by activity type: Filtrer les activités par type #aggregators Activity type: Type d'activité @@ -260,9 +256,9 @@ By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet Group by reasons: Sujet d'activité -Aggregate by activity user: Grouper par utilisateur lié à l'activité -Aggregate by activity type: Grouper par type d'activité -Aggregate by activity reason: Grouper par sujet de l'activité +Aggregate by activity user: Grouper les activités par utilisateur +Aggregate by activity type: Grouper les activités par type +Aggregate by activity reason: Grouper les activités par sujet Last activities: Les dernières activités From d04d758f27a3457edf178ad8e06965d367f39fa9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 17 Aug 2022 17:14:24 +0200 Subject: [PATCH 165/191] exports: activityDate filter enable to activity linked to acl --- .../Export/Filter/ActivityDateFilter.php | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php index 977fa2f9e..4b20553af 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ActivityDateFilter.php @@ -13,11 +13,11 @@ namespace Chill\ActivityBundle\Export\Filter; use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\FilterInterface; +use Chill\MainBundle\Form\Type\ChillDateType; use Chill\MainBundle\Form\Type\Export\FilterType; use DateTime; use Doctrine\ORM\Query\Expr; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\Extension\Core\Type\DateType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormEvent; @@ -60,34 +60,21 @@ class ActivityDateFilter implements FilterInterface public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) { - $builder->add( - 'date_from', - DateType::class, - [ + $builder + ->add('date_from', ChillDateType::class, [ 'label' => 'Activities after this date', 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', - ] - ); - - $builder->add( - 'date_to', - DateType::class, - [ + ]) + ->add('date_to', ChillDateType::class, [ 'label' => 'Activities before this date', 'data' => new DateTime(), - 'attr' => ['class' => 'datepicker'], - 'widget' => 'single_text', - 'format' => 'dd-MM-yyyy', - ] - ); + ]) + ; $builder->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) { /** @var \Symfony\Component\Form\FormInterface $filterForm */ From dfbaaef77871b2dc062cdb30ba327cd4b5e22d81 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 17 Aug 2022 17:36:42 +0200 Subject: [PATCH 166/191] add average duration indicator calendar --- .../Export/Export/StatAppointmentDuration.php | 103 ++++++++++++++++++ .../Resources/config/services/exports.yaml | 9 +- .../translations/messages.fr.yml | 2 + 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php new file mode 100644 index 000000000..c46aaaf0c --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php @@ -0,0 +1,103 @@ +calendarRepository = $calendarRepository; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // no form needed + } + + public function getTitle(): string + { + return 'Average appointment duration'; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'Get the average of appointment duration according to various filters'; + } + + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::CALENDAR_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $qb = $this->calendarRepository->createQueryBuilder('cal'); + + $qb + ->select('AVG(cal.endDate - cal.startDate) AS export_result'); + + return $qb; + } + + public function requiredRole(): Role + { + return new Role(AccompanyingPeriodVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::CALENDAR_TYPE + ]; + } + + public function getGroup(): string + { + return 'Exports of calendar'; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml index ee8f444a5..ef0b43089 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -6,4 +6,11 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export, alias: count_appointments } \ No newline at end of file + - { name: chill.export, alias: count_appointments } + + chill.calendar.export.average_duration_appointments: + class: Chill\CalendarBundle\Export\Export\StatAppointmentDuration + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: average_duration_appointments } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 5d32bc5d1..353b2e851 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -42,3 +42,5 @@ crud: # exports Exports of calendar: Exports des rendez-vous Count appointments: Nombre des rendez-vous +Average appointment duration: Moyenne des durées des rendez-vous +Get the average of appointment duration according to various filters: Calculer la moyenne des durées des rendez-vous From 62562cc57efc1753e721c16796440ba6c624b778 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 17 Aug 2022 17:37:05 +0200 Subject: [PATCH 167/191] rename querybuilder calendar --- .../ChillCalendarBundle/Export/Export/CountAppointments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php index c4531a298..d212a58f1 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php @@ -82,7 +82,7 @@ class CountAppointments implements ExportInterface, GroupedExportInterface return $el['center']; }, $acl); - $qb = $this->calendarRepository->createQueryBuilder('appointment'); + $qb = $this->calendarRepository->createQueryBuilder('cal'); $qb->select('COUNT(appointment.id) AS export_result'); From 05fd35cfb4a856e436106574f66bd1b214483f0e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Aug 2022 10:55:28 +0200 Subject: [PATCH 168/191] all indicators added --- ...ion.php => StatAppointmentAvgDuration.php} | 2 +- .../Export/StatAppointmentSumDuration.php | 102 ++++++++++++++++++ 2 files changed, 103 insertions(+), 1 deletion(-) rename src/Bundle/ChillCalendarBundle/Export/Export/{StatAppointmentDuration.php => StatAppointmentAvgDuration.php} (96%) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php similarity index 96% rename from src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php rename to src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php index c46aaaf0c..854172a2a 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentDuration.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentAvgDuration.php @@ -13,7 +13,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Security\Core\Role\Role; -class StatAppointmentDuration implements ExportInterface, GroupedExportInterface +class StatAppointmentAvgDuration implements ExportInterface, GroupedExportInterface { private CalendarRepository $calendarRepository; diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php new file mode 100644 index 000000000..0e362d766 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Export/StatAppointmentSumDuration.php @@ -0,0 +1,102 @@ +calendarRepository = $calendarRepository; + } + + public function buildForm(FormBuilderInterface $builder): void + { + // no form needed + } + + public function getTitle(): string + { + return 'Sum of appointment durations'; + } + + public function getAllowedFormattersTypes(): array + { + return [FormatterInterface::TYPE_TABULAR]; + } + + public function getDescription(): string + { + return 'Get the sum of appointment durations according to various filters'; + } + + 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 function ($value) use ($labels) { + return $labels[$value]; + }; + } + + public function getQueryKeys($data): array + { + return ['export_result']; + } + + public function getResult($qb, $data) + { + return $qb->getQuery()->getResult(Query::HYDRATE_SCALAR); + } + + public function getType(): string + { + return Declarations::CALENDAR_TYPE; + } + + public function initiateQuery(array $requiredModifiers, array $acl, array $data = []): QueryBuilder + { + $qb = $this->calendarRepository->createQueryBuilder('cal'); + + $qb + ->select('SUM(cal.endDate - cal.startDate) AS export_result'); + + return $qb; + } + + public function requiredRole(): Role + { + return new Role(AccompanyingPeriodVoter::STATS); + } + + public function supportsModifiers(): array + { + return [ + Declarations::CALENDAR_TYPE + ]; + } + + public function getGroup(): string + { + return 'Exports of calendar'; + } + +} \ No newline at end of file From 3eb07121cec3cd388b6acf3a278b7fd6c2e5ea0b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Aug 2022 10:56:47 +0200 Subject: [PATCH 169/191] filters added --- .../Export/Filter/AgentFilter.php | 79 +++++++++++++++ .../Export/Filter/BetweenDatesFilter.php | 70 +++++++++++++ .../Export/Filter/JobFilter.php | 99 +++++++++++++++++++ .../Export/Filter/ScopeFilter.php | 99 +++++++++++++++++++ .../Resources/config/services/exports.yaml | 41 +++++++- .../translations/messages.fr.yml | 13 +++ 6 files changed, 399 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php new file mode 100644 index 000000000..5c16d0728 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/AgentFilter.php @@ -0,0 +1,79 @@ +userRender = $userRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_agents', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true + ]); + + } + + public function getTitle(): string + { + return 'Filter by agent'; + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_agents'] as $r) { + $users[] = $r; + } + + return [ + 'Filtered by agent: only %agents%', [ + '%agents' => implode(", ou ", $users) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('cal.user', ':agents'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('agents', $data['accepted_agents']); + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php new file mode 100644 index 000000000..a23c76d98 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/BetweenDatesFilter.php @@ -0,0 +1,70 @@ +add('date_from', ChillDateType::class, [ + 'data' => new \DateTime(), + ]) + ->add('date_to', ChillDateType::class, [ + 'data' => new \DateTime(), + ]) + ; + } + + public function getTitle(): string + { + return 'Filter by appointments between certain dates'; + } + + public function describeAction($data, $format = 'string'): array + { + return ['Filtered by appointments between %dateFrom% and %dateTo%', [ + '%dateFrom%' => $data['date_from']->format('d-m-Y'), + '%dateTo%' => $data['date_to']->format('d-m-Y'), + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->andX( + $qb->expr()->gte('cal.startDate', ':dateFrom'), + $qb->expr()->lte('cal.endDate', ':dateTo') + ); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('dateFrom', $data['date_from']); + // modify dateTo so that entire day is also taken into account up until the beginning of the next day. + $qb->setParameter('dateTo', $data['date_to']->modify('+1 day')); + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php new file mode 100644 index 000000000..42e03e239 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/JobFilter.php @@ -0,0 +1,99 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('job', EntityType::class, [ + 'class' => UserJob::class, + 'choice_label' => function (UserJob $j) { + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function describeAction($data, $format = 'string'): array + { + $userJobs = []; + + foreach ($data['job'] as $j) { + $userJobs[] = $this->translatableStringHelper->localize( + $j->getLabel()); + } + + return ['Filtered by agent job: only %jobs%', [ + '%jobs%' => implode(', ou ', $userJobs) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.user', 'u'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('u.userJob', ':job'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('job', $data['job']); + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } + + + public function getTitle(): string + { + return 'Filter by agent job'; + } +} diff --git a/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php new file mode 100644 index 000000000..c3fc7b1e4 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Filter/ScopeFilter.php @@ -0,0 +1,99 @@ +translator = $translator; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('scope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function describeAction($data, $format = 'string') + { + $scopes = []; + + foreach ($data['scope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName()); + } + + return ['Filtered by agent scope: only %scopes%', [ + '%scopes%' => implode(', ou ', $scopes) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.user', 'u'); + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('u.mainScope', ':scope'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('scope', $data['scope']); + } + + public function applyOn() + { + return Declarations::CALENDAR_TYPE; + } + + + public function getTitle() + { + return 'Filter by agent scope'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml index ef0b43089..834cdfa78 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -9,8 +9,45 @@ services: - { name: chill.export, alias: count_appointments } chill.calendar.export.average_duration_appointments: - class: Chill\CalendarBundle\Export\Export\StatAppointmentDuration + class: Chill\CalendarBundle\Export\Export\StatAppointmentAvgDuration autowire: true autoconfigure: true tags: - - { name: chill.export, alias: average_duration_appointments } \ No newline at end of file + - { name: chill.export, alias: average_duration_appointments } + + chill.calendar.export.sum_duration_appointments: + class: Chill\CalendarBundle\Export\Export\StatAppointmentSumDuration + autowire: true + autoconfigure: true + tags: + - { name: chill.export, alias: sum_duration_appointments } + + ## Filters + + 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.job_filter: + class: Chill\CalendarBundle\Export\Filter\JobFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: job_filter } + + 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.between_dates_filter: + class: Chill\CalendarBundle\Export\Filter\BetweenDatesFilter + autowire: true + autoconfigure: true + tags: + - { name: chill.export_filter, alias: between_dates_filter } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 353b2e851..a1c848ad7 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -42,5 +42,18 @@ crud: # exports Exports of calendar: Exports des rendez-vous Count appointments: Nombre des rendez-vous + Average appointment duration: Moyenne des durées des rendez-vous Get the average of appointment duration according to various filters: Calculer la moyenne des durées des rendez-vous + +Sum of appointment durations: Somme des durées des rendez-vous +Get the sum of appointment durations according to various filters: Calculer la somme des durées des rendez-vous + +'Filtered by agent: only %agents%': "Filtré par agents: uniquement %agents%" +Filter by agent: Filtrer par agents +Filter by agent job: Filtrer par métiers des agents +'Filtered by agent job: only %jobs%': 'Filtré par métiers des agents: uniquement les %jobs%' +Filter by agent scope: Filtrer par services des agents +'Filtered by agent scope: only %scopes%': 'Filtré par services des agents: uniquement les services %scopes%' +Filter by appointments between certain dates: Filtrer par date du rendez-vous +'Filtered by appointments between %dateFrom% and %dateTo%': 'Filtré par rendez-vous entre %dateFrom% et %dateTo%' From 1de853a88ba9d0f707764e598016cb26b35e4989 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Aug 2022 10:58:05 +0200 Subject: [PATCH 170/191] fix count appointment indicator --- .../ChillCalendarBundle/Export/Export/CountAppointments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php index d212a58f1..e47288edc 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php +++ b/src/Bundle/ChillCalendarBundle/Export/Export/CountAppointments.php @@ -84,7 +84,7 @@ class CountAppointments implements ExportInterface, GroupedExportInterface $qb = $this->calendarRepository->createQueryBuilder('cal'); - $qb->select('COUNT(appointment.id) AS export_result'); + $qb->select('COUNT(cal.id) AS export_result'); return $qb; } From 03d098e5e1407095c3384a32062bea85490f29b0 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 18 Aug 2022 12:15:30 +0200 Subject: [PATCH 171/191] aggregators added - monthYearAggregator not finished --- .../Export/Aggregator/AgentAggregator.php | 79 ++++++++++++++++++ .../Export/Aggregator/JobAggregator.php | 80 ++++++++++++++++++ .../Export/Aggregator/LocationAggregator.php | 75 +++++++++++++++++ .../Aggregator/LocationTypeAggregator.php | 81 +++++++++++++++++++ .../Export/Aggregator/MonthYearAggregator.php | 49 +++++++++++ .../Export/Aggregator/ScopeAggregator.php | 80 ++++++++++++++++++ .../Resources/config/services/exports.yaml | 39 ++++++++- .../translations/messages.fr.yml | 10 +++ 8 files changed, 492 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/ScopeAggregator.php diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php new file mode 100644 index 000000000..ed7c265ff --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/AgentAggregator.php @@ -0,0 +1,79 @@ +userRepository = $userRepository; + $this->userRender = $userRender; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.user', 'u'); + + $qb->addSelect('u.id AS agent_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('agent_aggregator'); + } else { + $qb->groupBy('agent_aggregator'); + } + + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getLabels($key, array $values, $data): \Closure + { + return function ($value): string { + if ('_header' === $value) { + return 'Agent'; + } + + $r = $this->userRepository->find($value); + + return $this->userRender->renderString($r, []); + }; + } + + public function getQueryKeys($data): array + { + return ['agent_aggregator']; + } + + public function getTitle(): string + { + return 'Group by agent'; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php new file mode 100644 index 000000000..b019cc21b --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/JobAggregator.php @@ -0,0 +1,80 @@ +jobRepository = $jobRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data): \Closure + { + return function($value): string { + if ($value === '_header') { + return 'Job'; + } + + $j = $this->jobRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getLabel() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['job_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group by agent job'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.user', 'u'); + + $qb->addSelect('IDENTITY(u.userJob) as job_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('job_aggregator'); + } else { + $qb->groupBy('job_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php new file mode 100644 index 000000000..bc921c9c7 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationAggregator.php @@ -0,0 +1,75 @@ +locationRepository = $locationRepository; + } + + public function getLabels($key, array $values, $data): \Closure + { + return function($value): string { + if ($value === '_header') { + return 'Location'; + } + + $l = $this->locationRepository->find($value); + + return $l->getName(); + + }; + } + + public function getQueryKeys($data): array + { + return ['location_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group by location'; + } + + public function addRole(): ?Role + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.location', 'l'); + $qb->addSelect('IDENTITY(cal.location) as location_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('location_aggregator'); + } else { + $qb->groupBy('location_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php new file mode 100644 index 000000000..3b3b9105a --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/LocationTypeAggregator.php @@ -0,0 +1,81 @@ +locationTypeRepository = $locationTypeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data): \Closure + { + return function($value): string { + if ($value === '_header') { + return 'Location type'; + } + + $j = $this->locationTypeRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getTitle() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['location_type_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group by location type'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.location', 'l'); + + $qb->addSelect('IDENTITY(l.locationType) as location_type_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('location_type_aggregator'); + } else { + $qb->groupBy('location_type_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php new file mode 100644 index 000000000..b24120c15 --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -0,0 +1,49 @@ +scopeRepository = $scopeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data): \Closure + { + return function ($value): string { + if ($value === '_header') { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['scope_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group by agent scope'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.user', 'u'); + + $qb->addSelect('IDENTITY(u.mainScope) as scope_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('scope_aggregator'); + } else { + $qb->groupBy('scope_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml index 834cdfa78..e86194ea6 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -50,4 +50,41 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export_filter, alias: between_dates_filter } \ No newline at end of file + - { name: chill.export_filter, alias: between_dates_filter } + + ## 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.job_aggregator: + class: Chill\CalendarBundle\Export\Aggregator\JobAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: job_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.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.location_aggregator: + class: Chill\CalendarBundle\Export\Aggregator\LocationAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: location_aggregator } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index a1c848ad7..b0add946d 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -57,3 +57,13 @@ Filter by agent scope: Filtrer par services des agents 'Filtered by agent scope: only %scopes%': 'Filtré par services des agents: uniquement les services %scopes%' Filter by appointments between certain dates: Filtrer par date du rendez-vous 'Filtered by appointments between %dateFrom% and %dateTo%': 'Filtré par rendez-vous entre %dateFrom% et %dateTo%' + +Group by agent: Grouper par agent +Group by agent job: Grouper par métier de l'agent +Group by agent scope: Grouper par service de l'agent +Group by location type: Grouper par type de localisation +Group by location: Grouper par lieu de rendez-vous +Scope: Service +Job: Métier +Location type: Type de localisation +Location: Lieu de rendez-vous \ No newline at end of file From 4a1615afd520cdc363ab4558dbe704c6c143e85b Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 10:02:07 +0200 Subject: [PATCH 172/191] export, fix merge translations --- .../translations/messages.fr.yml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 34cc1c8af..e70c11139 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -349,7 +349,7 @@ Create an average of accompanying courses duration according to various filters: Closingdate to apply: Date de fin à prendre en compte lorsque le parcours n'est pas clotûré Exports of social work actions: Exports des actions d'accompagnement -Count social work actions: Nombre d'actions d'accompagnement +Count social work actions: Nombre d'actions Count social work actions by various parameters: Compte le nombre d'actions d'accompagnement en fonction de différents filtres. @@ -361,7 +361,7 @@ Exports of households: Exports des ménages Count households: Nombre de ménages Count household by various parameters.: Compte le nombre de ménages impliqués dans un parcours selon différents filtres. -## filters +## persons filters Filter by person gender: Filtrer par genre de la personne Accepted genders: Genres acceptés 'Filtering by genders: only %genders%': 'Filtré par genre: seulement %genders%' @@ -424,6 +424,7 @@ Having an accompanying period closed after this date: Ayant une période d'accom "Having an accompanying period closed before this date": "Ayant une période d'accompagnement fermée avant cette date" "Filtered by accompanying period: persons having an accompanying period closed between the %date_from% and %date_to%": "Filtrer par période d'accompagnement: ayant une période fermée entre le %date_from% et le %date_to%" +## accompanying course filters/aggr Filter by user scope: Filtrer les parcours par service du référent "Filtered by user main scope: only %scope%": "Filtré par service du référent: uniquement %scope%" Group by user scope: Grouper les parcours par service du référent @@ -433,7 +434,6 @@ Filter by user job: Filtrer les parcours par métier du référent Group by user job: Grouper les parcours par métier du référent Filter by social issue: Filtrer les parcours par problématiques sociales -Filter by scope: Filtrer par service Accepted socialissues: Problématiques sociales "Filtered by socialissues: only %socialissues%": "Filtré par problématique sociale: uniquement %socialissues%" Group by social issue: Grouper les parcours par problématiques sociales @@ -458,10 +458,6 @@ Evaluation: Évaluation "Filtered by evaluations: only %evals%": "Filtré par évaluation: uniquement %evals%" Group by evaluation: Grouper les parcours par évaluation -Group social work actions by action type: Grouper par type d'action -Group social work actions by goal: Grouper par objectif -Group social work actions by result: Grouper par résultat - Filter accompanying course by activity type: Filtrer les parcours par type d'activité Accepted activitytypes: Types d'activités "Filtered by activity types: only %activitytypes%": "Filtré par type d'activité: seulement %activitytypes%" @@ -531,10 +527,13 @@ Date from: Date de début Date to: Date de fin "Filtered by opening dates: between %datefrom% and %dateto%": "Filtrer les parcours ouverts entre deux dates: entre le %datefrom% et le %dateto%" +## social actions filters/aggr Filter by treating agent scope: Filtrer les actions par service de l'agent traitant "Filtered by treating agent scope: only %scopes%": "Filtré par service de l'agent traitant: uniquement %scopes%" Group by treating agent scope: Grouper les actions par service de l'agent traitant +Filter by scope: Filtrer par service + Filter by treating agent job: Filtrer les actions par métier de l'agent traitant "Filtered by treating agent job: only %jobs%": "Filtré par métier de l'agent traitant: uniquement %jobs%" Group by treating agent job: Grouper les actions par métier de l'agent traitant @@ -544,6 +543,11 @@ Accepted agents: Agent traitant "Filtered by treating agent: only %agents%": "Filtré par agent traitant: uniquement %agents%" Group by treating agent: Grouper les actions par agent traitant +Group social work actions by action type: Grouper les actions par type +Group social work actions by goal: Grouper les actions par objectif +Group social work actions by result: Grouper les actions par résultat + +## evaluations filters/aggr Filter by evaluation type: Filtrer les évaluations par type Accepted evaluationtype: Évaluations "Filtered by evaluation type: only %evals%": "Filtré par type d'évaluation: uniquement %evals%" @@ -556,6 +560,7 @@ is specified: La date d'échéance est spécifiée is not specified: La date d'échéance n'est pas spécifiée "Filtered by maxdate: only %choice%": "Filtré par date d'échéance: uniquement si %choice%" +## household filters/aggr Filter by composition: Filtrer les ménages par composition familiale Accepted composition: Composition familiale "Filtered by composition: only %compositions% on %ondate%": "Filtré par composition familiale: uniquement %compositions%, en date du %ondate%" @@ -563,7 +568,7 @@ Group by composition: Grouper les ménages par composition familiale Group by number of children: Grouper les ménages par nombre d'enfants -## aggregators +## persons aggregators Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau Group by continents: Grouper par continent From 9af620ece5be98bddc67ac75ac10d25d2d68b968 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 10:17:44 +0200 Subject: [PATCH 173/191] fix translations --- .../ChillCalendarBundle/translations/messages.fr.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index b0add946d..7068168b5 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -41,13 +41,14 @@ crud: # exports Exports of calendar: Exports des rendez-vous -Count appointments: Nombre des rendez-vous +Count appointments: Nombre de rendez-vous +Count appointments by various parameters.: Compte le nombre de rendez-vous en fonction de différents paramètres. -Average appointment duration: Moyenne des durées des rendez-vous -Get the average of appointment duration according to various filters: Calculer la moyenne des durées des rendez-vous +Average appointment duration: Moyenne de la durée des rendez-vous +Get the average of appointment duration according to various filters: Calcule la moyenne des durées des rendez-vous en fonction de différents paramètres. -Sum of appointment durations: Somme des durées des rendez-vous -Get the sum of appointment durations according to various filters: Calculer la somme des durées des rendez-vous +Sum of appointment durations: Somme de la durée des rendez-vous +Get the sum of appointment durations according to various filters: Calcule la somme des durées des rendez-vous en fonction de différents paramètres. 'Filtered by agent: only %agents%': "Filtré par agents: uniquement %agents%" Filter by agent: Filtrer par agents From 248d56e59833c72b9a1e178dc8b67d1cd96ab148 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 11:49:27 +0200 Subject: [PATCH 174/191] exports: add activity linked_to_acp new filters --- .../ACPFilters/BySocialActionFilter.php | 81 +++++++++++++++++ .../Filter/ACPFilters/BySocialIssueFilter.php | 81 +++++++++++++++++ .../Export/Filter/ACPFilters/ByUserFilter.php | 80 +++++++++++++++++ .../Filter/ACPFilters/EmergencyFilter.php | 86 ++++++++++++++++++ .../Filter/ACPFilters/LocationTypeFilter.php | 85 ++++++++++++++++++ .../Filter/ACPFilters/SentReceivedFilter.php | 82 +++++++++++++++++ .../Export/Filter/ACPFilters/UserFilter.php | 82 +++++++++++++++++ .../Filter/ACPFilters/UserScopeFilter.php | 89 +++++++++++++++++++ .../config/services/export.yaml | 40 +++++++++ .../translations/messages.fr.yml | 26 ++++++ 10 files changed, 732 insertions(+) create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php new file mode 100644 index 000000000..ea125adb2 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -0,0 +1,81 @@ +actionRender = $actionRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialactions', EntityType::class, [ + 'class' => SocialAction::class, + 'choice_label' => function (SocialAction $sa) { + return $this->actionRender->renderString($sa, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by linked socialaction'; + } + + public function describeAction($data, $format = 'string'): array + { + $actions = []; + + foreach ($data['accepted_socialactions'] as $sa) { + $actions[] = $this->actionRender->renderString($sa, []); + } + + return ['Filtered activity by linked socialaction: only %actions%', [ + '%actions%' => implode(", ou", $actions) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('activity.socialActions', ':socialactions'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('socialactions', $data['accepted_socialactions']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php new file mode 100644 index 000000000..247b0ea32 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -0,0 +1,81 @@ +issueRender = $issueRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_socialissues', EntityType::class, [ + 'class' => SocialIssue::class, + 'choice_label' => function(SocialIssue $si) { + return $this->issueRender->renderString($si, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by linked socialissue'; + } + + public function describeAction($data, $format = 'string'): array + { + $issues = []; + + foreach ($data['accepted_socialissues'] as $si) { + $issues[] = $this->issueRender->renderString($si, []); + } + + return ['Filtered activity by linked socialissue: only %issues%', [ + '%issues%' => implode(", ou", $issues) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('activity.socialIssues', ':socialissues'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('socialissues', $data['accepted_socialissues']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php new file mode 100644 index 000000000..9fef06f72 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -0,0 +1,80 @@ +userRender = $userRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_users', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by linked users'; + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_users'] as $u) { + $users[] = $this->userRender->renderString($u, []); + } + + return ['Filtered activity by linked users: only %users%', [ + '%users%' => implode(", ou", $users) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('activity.users', ':users'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('users', $data['accepted_users']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php new file mode 100644 index 000000000..d7a823891 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/EmergencyFilter.php @@ -0,0 +1,86 @@ + true, + 'activity is not emergency' => false, + ]; + + private CONST DEFAULT_CHOICE = false; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_emergency', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by emergency'; + } + + public function describeAction($data, $format = 'string'): array + { + foreach (self::CHOICES as $k => $v) { + if ($v === $data['accepted_emergency']) { + $choice = $k; + } + } + + return ['Filtered activity by emergency: only %emergency%', [ + '%emergency%' => $this->translator->trans($choice) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->eq('activity.emergency', ':emergency'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('emergency', $data['accepted_emergency']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php new file mode 100644 index 000000000..22e1f3c30 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -0,0 +1,85 @@ +translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_locationtype', EntityType::class, [ + 'class' => LocationType::class, + 'choice_label' => function(LocationType $type) { + return $this->translatableStringHelper->localize($type->getTitle()); + }, + 'multiple' => true, + 'expanded' => true, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by locationtype'; + } + + public function describeAction($data, $format = 'string'): array + { + $types = []; + + foreach ($data['accepted_locationtype'] as $type) { + $types[] = $this->translatableStringHelper->localize( + $type->getTitle() + ); + } + + return ['Filtered activity by locationtype: only %types%', [ + '%types%' => implode(", ou", $types) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + if (!in_array('location', $qb->getAllAliases())) { + $qb->join('activity.location', 'location'); + } + + $where = $qb->getDQLPart('where'); + $clause = $qb->expr()->in('location.locationType', ':locationtype'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('locationtype', $data['accepted_locationtype']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php new file mode 100644 index 000000000..409c974ac --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/SentReceivedFilter.php @@ -0,0 +1,82 @@ + Activity::SENTRECEIVED_SENT, + 'is received' => Activity::SENTRECEIVED_RECEIVED, + ]; + + private CONST DEFAULT_CHOICE = Activity::SENTRECEIVED_SENT; + + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_sentreceived', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Filter activity by sentreceived'; + } + + public function describeAction($data, $format = 'string'): array + { + $sentreceived = array_flip(self::CHOICES)[$data['accepted_sentreceived']]; + + return ['Filtered activity by sentreceived: only %sentreceived%', [ + '%sentreceived%' => $this->translator->trans($sentreceived) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->eq('activity.sentReceived', ':sentreceived'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('sentreceived', $data['accepted_sentreceived']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php new file mode 100644 index 000000000..02aff8cad --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -0,0 +1,82 @@ +userRender = $userRender; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_users', EntityType::class, [ + 'class' => User::class, + 'choice_label' => function (User $u) { + return $this->userRender->renderString($u, []); + }, + 'multiple' => true, + 'expanded' => true, + 'label' => 'Creators' + ]); + } + + public function getTitle(): string + { + return 'Filter activity by user'; + } + + public function describeAction($data, $format = 'string'): array + { + $users = []; + + foreach ($data['accepted_users'] as $u) { + $users[] = $this->userRender->renderString($u, []); + } + + return ['Filtered activity by user: only %users%', [ + '%users%' => implode(", ou", $users) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('activity.user', ':users'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('users', $data['accepted_users']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php new file mode 100644 index 000000000..abc26d418 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -0,0 +1,89 @@ +translatableStringHelper = $translatableStringHelper; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('accepted_userscope', EntityType::class, [ + 'class' => Scope::class, + 'choice_label' => function (Scope $s) { + return $this->translatableStringHelper->localize( + $s->getName() + ); + }, + 'multiple' => true, + 'expanded' => true + ]); + } + + public function getTitle(): string + { + return 'Filter activity by userscope'; + } + + public function describeAction($data, $format = 'string'): array + { + $scopes = []; + + foreach ($data['accepted_userscope'] as $s) { + $scopes[] = $this->translatableStringHelper->localize( + $s->getName() + ); + } + + return ['Filtered activity by userscope: only %scopes%', [ + '%scopes%' => implode(", ou", $scopes) + ]]; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.user', 'user'); + } + + $where = $qb->getDQLPart('where'); + + $clause = $qb->expr()->in('user.mainScope', ':userscope'); + + if ($where instanceof Andx) { + $where->add($clause); + } else { + $where = $qb->expr()->andX($clause); + } + + $qb->add('where', $where); + $qb->setParameter('userscope', $data['accepted_userscope']); + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index c6b0e9718..393e452e6 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -67,6 +67,46 @@ services: name: chill.export_filter alias: 'activity_person_having_ac_bw_date_filter' + chill.activity.export.locationtype_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\LocationTypeFilter + tags: + - { name: chill.export_filter, alias: 'activity_locationtype_filter' } + + chill.activity.export.byuser_filter: # TMS (M2M) + class: Chill\ActivityBundle\Export\Filter\ACPFilters\ByUserFilter + tags: + - { name: chill.export_filter, alias: 'activity_byuser_filter' } + + chill.activity.export.emergency_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\EmergencyFilter + tags: + - { name: chill.export_filter, alias: 'activity_emergency_filter' } + + chill.activity.export.sentreceived_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\SentReceivedFilter + tags: + - { name: chill.export_filter, alias: 'activity_sentreceived_filter' } + + chill.activity.export.bysocialaction_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\BySocialActionFilter + tags: + - { name: chill.export_filter, alias: 'activity_bysocialaction_filter' } + + chill.activity.export.bysocialissue_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\BySocialIssueFilter + tags: + - { name: chill.export_filter, alias: 'activity_bysocialissue_filter' } + + chill.activity.export.user_filter: # Creator (M2O) + class: Chill\ActivityBundle\Export\Filter\ACPFilters\UserFilter + tags: + - { name: chill.export_filter, alias: 'activity_user_filter' } + + chill.activity.export.userscope_filter: + class: Chill\ActivityBundle\Export\Filter\ACPFilters\UserScopeFilter + tags: + - { name: chill.export_filter, alias: 'activity_userscope_filter' } + ## Aggregators chill.activity.export.reason_aggregator: class: Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index f6bfafc41..b66c606d5 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -249,6 +249,32 @@ Activity reasons for those activities: Sujets de ces activités Filter by activity type: Filtrer les activités par type +Filter activity by locationtype: Filtrer les activités par type de localisation +'Filtered activity by locationtype: only %types%': "Filtré par type de localisation: uniquement %types%" +Accepted locationtype: Types de localisation +Filter activity by linked users: Filtrer les activités par TMS +'Filtered activity by linked users: only %users%': "Filtré par TMS: uniquement %users%" +Accepted users: TMS(s) +Filter activity by emergency: Filtrer les activités par urgence +'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement %emergency%" +activity is emergency: l'activité est urgente +activity is not emergency: l'activité n'est pas urgente +Filter activity by sentreceived: Filtrer les activités par envoyé/reçu +'Filtered activity by sentreceived: only %sentreceived%': "Filtré par envoyé/reçu: uniquement %sentreceived%" +Accepted sentreceived: '' +is sent: envoyé +is received: reçu +Filter activity by linked socialaction: Filtrer les activités par action liée +'Filtered activity by linked socialaction: only %actions%': "Filtré par action liée: uniquement %actions%" +Filter activity by linked socialissue: Filtrer les activités par problématique liée +'Filtered activity by linked socialissue: only %issues%': "Filtré par problématique liée: uniquement %issues%" +Filter activity by user: Filtrer les activités par créateur +'Filtered activity by user: only %users%': "Filtré par créateur: uniquement %users%" +Creators: Créateurs +Filter activity by userscope: Filtrer les activités par service du créateur +'Filtered activity by userscope: only %scopes%': "Filtré par service du créateur: uniquement %scopes%" +Accepted userscope: Services + #aggregators Activity type: Type d'activité Activity user: Utilisateur lié à l'activity From 95ea3bf30e8b05b1a7100bb84a01d00fd64042aa Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 13:29:22 +0200 Subject: [PATCH 175/191] refactor builder form in a filter --- .../Filter/AccompanyingCourseFilters/EmergencyFilter.php | 8 ++++---- src/Bundle/ChillPersonBundle/translations/messages.fr.yml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php index fc1f3d002..ed874be2b 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/EmergencyFilter.php @@ -13,8 +13,8 @@ use Symfony\Contracts\Translation\TranslatorInterface; class EmergencyFilter implements FilterInterface { private const CHOICES = [ - 'is not emergency' => false, 'is emergency' => true, + 'is not emergency' => false, ]; private CONST DEFAULT_CHOICE = false; @@ -28,7 +28,7 @@ class EmergencyFilter implements FilterInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('accepted_emergencies', ChoiceType::class, [ + $builder->add('accepted_emergency', ChoiceType::class, [ 'choices' => self::CHOICES, 'multiple' => false, 'expanded' => true, @@ -45,7 +45,7 @@ class EmergencyFilter implements FilterInterface public function describeAction($data, $format = 'string'): array { foreach (self::CHOICES as $k => $v) { - if ($v === $data['accepted_emergencies']) { + if ($v === $data['accepted_emergency']) { $choice = $k; } } @@ -74,7 +74,7 @@ class EmergencyFilter implements FilterInterface } $qb->add('where', $where); - $qb->setParameter('emergency', $data['accepted_emergencies']); + $qb->setParameter('emergency', $data['accepted_emergency']); } public function applyOn(): string diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index e70c11139..9bb2c7e3f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -495,7 +495,7 @@ Confidentiality: Confidentialité Group by confidential: Grouper les parcours par confidentialité Filter by emergency: Filtrer les parcours par urgence -Accepted emergencies: '' +Accepted emergency: '' is emergency: le parcours est urgent is not emergency: le parcours n'est pas urgent "Filtered by emergency: only %emergency%": "Filtré par urgence: uniquement si %emergency%" From f8f17a6a0669cef3850aabb71591af98f039b871 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 13:37:20 +0200 Subject: [PATCH 176/191] exports: move activity old filters in PersonFilters folder --- .../{ => PersonFilters}/ActivityReasonFilter.php | 2 +- .../PersonHavingActivityBetweenDateFilter.php | 2 +- .../ChillActivityBundle/config/services/export.yaml | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) rename src/Bundle/ChillActivityBundle/Export/Filter/{ => PersonFilters}/ActivityReasonFilter.php (98%) rename src/Bundle/ChillActivityBundle/Export/Filter/{ => PersonFilters}/PersonHavingActivityBetweenDateFilter.php (99%) diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php similarity index 98% rename from src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php rename to src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php index eef032818..c0845573a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ActivityReasonFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/ActivityReasonFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Filter; +namespace Chill\ActivityBundle\Export\Filter\PersonFilters; use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Export\Declarations; diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php similarity index 99% rename from src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php rename to src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php index 2c47d1c91..c8c21f385 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/PersonHavingActivityBetweenDateFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/PersonFilters/PersonHavingActivityBetweenDateFilter.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Filter; +namespace Chill\ActivityBundle\Export\Filter\PersonFilters; use Chill\ActivityBundle\Entity\ActivityReason; use Chill\ActivityBundle\Repository\ActivityReasonRepository; diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 393e452e6..4db7b7406 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -45,11 +45,6 @@ services: - { name: chill.export, alias: 'avg_activity_visit_duration_linked_to_acp' } ## Filters - chill.activity.export.reason_filter: - class: Chill\ActivityBundle\Export\Filter\ActivityReasonFilter - tags: - - { name: chill.export_filter, alias: 'activity_reason_filter' } - chill.activity.export.type_filter: class: Chill\ActivityBundle\Export\Filter\ActivityTypeFilter tags: @@ -60,8 +55,13 @@ services: tags: - { name: chill.export_filter, alias: 'activity_date_filter' } + chill.activity.export.reason_filter: + class: Chill\ActivityBundle\Export\Filter\PersonFilters\ActivityReasonFilter + tags: + - { name: chill.export_filter, alias: 'activity_reason_filter' } + chill.activity.export.person_having_an_activity_between_date_filter: - class: Chill\ActivityBundle\Export\Filter\PersonHavingActivityBetweenDateFilter + class: Chill\ActivityBundle\Export\Filter\PersonFilters\PersonHavingActivityBetweenDateFilter tags: - #0 register as a filter name: chill.export_filter From c4944cce17ced568dd8255e142934dba7ffce5df Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 17:11:02 +0200 Subject: [PATCH 177/191] exports: move activity old aggregators in PersonAggregators folder --- .../Export/Aggregator/ActivityUserAggregator.php | 2 +- .../{ => PersonAggregators}/ActivityReasonAggregator.php | 2 +- src/Bundle/ChillActivityBundle/config/services/export.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename src/Bundle/ChillActivityBundle/Export/Aggregator/{ => PersonAggregators}/ActivityReasonAggregator.php (98%) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index be4149bf9..3cdeee0f9 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -48,7 +48,7 @@ class ActivityUserAggregator implements AggregatorInterface public function applyOn(): string { - return Declarations::ACTIVITY_PERSON; + return Declarations::ACTIVITY; } public function buildForm(FormBuilderInterface $builder) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php similarity index 98% rename from src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php rename to src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php index 5c77159e3..8db93265d 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityReasonAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/PersonAggregators/ActivityReasonAggregator.php @@ -9,7 +9,7 @@ declare(strict_types=1); -namespace Chill\ActivityBundle\Export\Aggregator; +namespace Chill\ActivityBundle\Export\Aggregator\PersonAggregators; use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Repository\ActivityReasonCategoryRepository; diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 4db7b7406..517e85767 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -109,7 +109,7 @@ services: ## Aggregators chill.activity.export.reason_aggregator: - class: Chill\ActivityBundle\Export\Aggregator\ActivityReasonAggregator + class: Chill\ActivityBundle\Export\Aggregator\PersonAggregators\ActivityReasonAggregator tags: - { name: chill.export_aggregator, alias: activity_reason_aggregator } From dea7982ca882a8ea2106f922212e6fedb31b715a Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Mon, 22 Aug 2022 18:48:34 +0200 Subject: [PATCH 178/191] exports: add activity linked_to_acp new aggregators (wip) --- .../BySocialActionAggregator.php | 79 +++++++++++++++ .../BySocialIssueAggregator.php | 80 +++++++++++++++ .../ACPAggregators/ByThirdpartyAggregator.php | 79 +++++++++++++++ .../ACPAggregators/ByUserAggregator.php | 79 +++++++++++++++ .../ACPAggregators/DateAggregator.php | 99 +++++++++++++++++++ .../ACPAggregators/LocationTypeAggregator.php | 82 +++++++++++++++ .../ACPAggregators/UserScopeAggregator.php | 86 ++++++++++++++++ .../config/services/export.yaml | 35 +++++++ .../translations/messages.fr.yml | 8 ++ 9 files changed, 627 insertions(+) create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php create mode 100644 src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php new file mode 100644 index 000000000..a5cbc16f1 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -0,0 +1,79 @@ +actionRender = $actionRender; + $this->actionRepository = $actionRepository; + } + + public function getLabels($key, array $values, $data) + { + return function($value) { + if ('_header' === $value) { + return 'Social action'; + } + + $sa = $this->actionRepository->find($value); + + return $this->actionRender->renderString($sa, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialaction_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by linked socialaction'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('IDENTITY(activity.socialActions) AS socialaction_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('socialaction_aggregator'); + } else { + $qb->groupBy('socialaction_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php new file mode 100644 index 000000000..193f93f5c --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -0,0 +1,80 @@ +issueRepository = $issueRepository; + $this->issueRender = $issueRender; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + + if ($value === '_header') { + return 'Social issues'; + } + + $i = $this->issueRepository->find($value); + + return $this->issueRender->renderString($i, []); + }; + } + + public function getQueryKeys($data): array + { + return ['socialissue_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by linked socialissue'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('IDENTITY(activity.socialIssues) AS socialissue_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('socialissue_aggregator'); + } else { + $qb->groupBy('socialissue_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php new file mode 100644 index 000000000..583e3589a --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -0,0 +1,79 @@ +thirdPartyRepository = $thirdPartyRepository; + $this->thirdPartyRender = $thirdPartyRender; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Thirdparty'; + } + + $tp = $this->thirdPartyRepository->find($value); + + return $this->thirdPartyRender->renderString($tp, []); + }; + } + + public function getQueryKeys($data): array + { + return ['thirdparty_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by linked thirdparties'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('IDENTITY(activity.thirdParties) AS thirdparty_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('thirdparty_aggregator'); + } else { + $qb->groupBy('thirdparty_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php new file mode 100644 index 000000000..9cd6601c1 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -0,0 +1,79 @@ +userRepository = $userRepository; + $this->userRender = $userRender; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Accepted users'; + } + + $u = $this->userRepository->find($value); + + return $this->userRender->renderString($u, []); + }; + } + + public function getQueryKeys($data): array + { + return ['users_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by linked users'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('IDENTITY(activity.users) AS users_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('users_aggregator'); + } else { + $qb->groupBy('users_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php new file mode 100644 index 000000000..ef866f4f6 --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -0,0 +1,99 @@ + 'month', + 'by week' => 'week', // sur base du numéro de la semaine + 'by year' => 'year', + ]; + + private CONST DEFAULT_CHOICE = 'year'; + + private TranslatorInterface $translator; + + public function __construct( + TranslatorInterface $translator + ) { + $this->translator = $translator; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + switch ($value) { + case '_header': + return 'By date'; + + case 'month': + return $this->translator->trans('by month'); + + case 'week': + return $this->translator->trans('by week'); + + case 'year': + return $this->translator->trans('by year'); + + default: + throw new LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + public function getQueryKeys($data): array + { + return ['date_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + $builder->add('by_date', ChoiceType::class, [ + 'choices' => self::CHOICES, + 'multiple' => false, + 'expanded' => true, + 'empty_data' => self::DEFAULT_CHOICE, + 'data' => self::DEFAULT_CHOICE, + ]); + } + + public function getTitle(): string + { + return 'Group activity by date'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('activity.date AS date_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('date_aggregator'); + } else { + $qb->groupBy('date_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php new file mode 100644 index 000000000..088ac0e4a --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -0,0 +1,82 @@ +locationTypeRepository = $locationTypeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Accepted locationtype'; + } + + $lt = $this->locationTypeRepository->find($value); + + return $this->translatableStringHelper->localize( + $lt->getTitle() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['locationtype_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by locationtype'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->addSelect('IDENTITY(activity.location) AS locationtype_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('locationtype_aggregator'); + } else { + $qb->groupBy('locationtype_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php new file mode 100644 index 000000000..4d6cef24a --- /dev/null +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/UserScopeAggregator.php @@ -0,0 +1,86 @@ +scopeRepository = $scopeRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data) + { + return function ($value): string { + if ($value === '_header') { + return 'Scope'; + } + + $s = $this->scopeRepository->find($value); + + return $this->translatableStringHelper->localize( + $s->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['userscope_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group activity by userscope'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.user', 'user'); + } + + $qb->addSelect('IDENTITY(user.mainScope) AS userscope_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('userscope_aggregator'); + } else { + $qb->groupBy('userscope_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::ACTIVITY_ACP; + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillActivityBundle/config/services/export.yaml b/src/Bundle/ChillActivityBundle/config/services/export.yaml index 517e85767..c88046c5f 100644 --- a/src/Bundle/ChillActivityBundle/config/services/export.yaml +++ b/src/Bundle/ChillActivityBundle/config/services/export.yaml @@ -122,3 +122,38 @@ services: class: Chill\ActivityBundle\Export\Aggregator\ActivityUserAggregator tags: - { name: chill.export_aggregator, alias: activity_user_aggregator } + + chill.activity.export.locationtype_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\LocationTypeAggregator + tags: + - { name: chill.export_aggregator, alias: activity_locationtype_aggregator } + + chill.activity.export.date_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\DateAggregator + tags: + - { name: chill.export_aggregator, alias: activity_date_aggregator } + + chill.activity.export.byuser_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByUserAggregator + tags: + - { name: chill.export_aggregator, alias: activity_byuser_aggregator } + + chill.activity.export.bythirdparty_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\ByThirdpartyAggregator + tags: + - { name: chill.export_aggregator, alias: activity_bythirdparty_aggregator } + + chill.activity.export.bysocialaction_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialActionAggregator + tags: + - { name: chill.export_aggregator, alias: activity_bysocialaction_aggregator } + + chill.activity.export.bysocialissue_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\BySocialIssueAggregator + tags: + - { name: chill.export_aggregator, alias: activity_bysocialissue_aggregator } + + chill.activity.export.userscope_aggregator: + class: Chill\ActivityBundle\Export\Aggregator\ACPAggregators\UserScopeAggregator + tags: + - { name: chill.export_aggregator, alias: activity_userscope_aggregator } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index b66c606d5..0bef84ba0 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -286,6 +286,14 @@ Aggregate by activity user: Grouper les activités par utilisateur Aggregate by activity type: Grouper les activités par type Aggregate by activity reason: Grouper les activités par sujet +Group activity by locationtype: Grouper les activités par type de localisation +Group activity by date: Grouper les activités par date +Group activity by linked users: Grouper les activités par TMS impliqué +Group activity by linked thirdparties: Grouper les activités par tiers impliqué +Group activity by linked socialaction: Grouper les activités par action liée +Group activity by linked socialissue: Grouper les activités par problématique liée +Group activity by userscope: Grouper les activités par service du créateur + Last activities: Les dernières activités See activity in accompanying course context: Voir l'activité dans le contexte du parcours d'accompagnement From 52902e905a294f15221c6d6f808089b8ab78d9d1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 24 Aug 2022 11:22:54 +0200 Subject: [PATCH 179/191] exports: test all activity filters/aggregators and fix errors --- .../ACPAggregators/BySocialActionAggregator.php | 6 +++++- .../ACPAggregators/BySocialIssueAggregator.php | 6 +++++- .../ACPAggregators/ByThirdpartyAggregator.php | 8 ++++++-- .../Aggregator/ACPAggregators/ByUserAggregator.php | 6 +++++- .../Aggregator/ACPAggregators/DateAggregator.php | 3 ++- .../ACPAggregators/LocationTypeAggregator.php | 6 +++++- .../Export/Aggregator/ActivityUserAggregator.php | 13 ++++++++++--- .../Filter/ACPFilters/BySocialActionFilter.php | 8 ++++++-- .../Filter/ACPFilters/BySocialIssueFilter.php | 8 ++++++-- .../Export/Filter/ACPFilters/ByUserFilter.php | 8 ++++++-- .../Export/Filter/ACPFilters/LocationTypeFilter.php | 2 +- .../Export/Filter/ACPFilters/UserFilter.php | 2 +- .../Export/Filter/ACPFilters/UserScopeFilter.php | 2 +- .../translations/messages.fr.yml | 9 +++++++-- 14 files changed, 66 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php index a5cbc16f1..269924a8a 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialActionAggregator.php @@ -61,7 +61,11 @@ class BySocialActionAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.socialActions) AS socialaction_aggregator'); + if(!in_array('socialaction', $qb->getAllAliases())) { + $qb->join('activity.socialActions', 'socialaction'); + } + + $qb->addSelect('socialaction.id AS socialaction_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php index 193f93f5c..0e4b9ab8e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/BySocialIssueAggregator.php @@ -62,7 +62,11 @@ class BySocialIssueAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.socialIssues) AS socialissue_aggregator'); + if (!in_array('socialissue', $qb->getAllAliases())) { + $qb->join('activity.socialIssues', 'socialissue'); + } + + $qb->addSelect('socialissue.id AS socialissue_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php index 583e3589a..5a9e633ef 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByThirdpartyAggregator.php @@ -30,7 +30,7 @@ class ByThirdpartyAggregator implements AggregatorInterface { return function ($value): string { if ($value === '_header') { - return 'Thirdparty'; + return 'Accepted thirdparty'; } $tp = $this->thirdPartyRepository->find($value); @@ -61,7 +61,11 @@ class ByThirdpartyAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.thirdParties) AS thirdparty_aggregator'); + if (!in_array('thirdparty', $qb->getAllAliases())) { + $qb->join('activity.thirdParties', 'thirdparty'); + } + + $qb->addSelect('thirdparty.id AS thirdparty_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php index 9cd6601c1..95c9998b8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/ByUserAggregator.php @@ -61,7 +61,11 @@ class ByUserAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.users) AS users_aggregator'); + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.users', 'user'); + } + + $qb->addSelect('user.id AS users_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index ef866f4f6..11e508b88 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -16,7 +16,7 @@ class DateAggregator implements AggregatorInterface { private const CHOICES = [ 'by month' => 'month', - 'by week' => 'week', // sur base du numéro de la semaine + 'by week' => 'week', // numéro de la semaine 'by year' => 'year', ]; @@ -60,6 +60,7 @@ class DateAggregator implements AggregatorInterface public function buildForm(FormBuilderInterface $builder) { $builder->add('by_date', ChoiceType::class, [ + 'label' => 'Frequency', 'choices' => self::CHOICES, 'multiple' => false, 'expanded' => true, diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php index 088ac0e4a..aa5052aaa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/LocationTypeAggregator.php @@ -63,7 +63,11 @@ class LocationTypeAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('IDENTITY(activity.location) AS locationtype_aggregator'); + if (!in_array('location', $qb->getAllAliases())) { + $qb->join('activity.location', 'location'); + } + + $qb->addSelect('IDENTITY(location.locationType) AS locationtype_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php index 3cdeee0f9..675098c60 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ActivityUserAggregator.php @@ -15,6 +15,7 @@ use Chill\ActivityBundle\Export\Declarations; use Chill\ActivityBundle\Security\Authorization\ActivityStatsVoter; use Chill\MainBundle\Export\AggregatorInterface; use Chill\MainBundle\Repository\UserRepository; +use Chill\MainBundle\Templating\Entity\UserRender; use Closure; use Doctrine\ORM\QueryBuilder; use Symfony\Component\Form\FormBuilderInterface; @@ -26,10 +27,14 @@ class ActivityUserAggregator implements AggregatorInterface private UserRepository $userRepository; + private UserRender $userRender; + public function __construct( - UserRepository $userRepository + UserRepository $userRepository, + UserRender $userRender ) { $this->userRepository = $userRepository; + $this->userRender = $userRender; } public function addRole() @@ -63,10 +68,12 @@ class ActivityUserAggregator implements AggregatorInterface return function ($value) { if ('_header' === $value) { - return 'activity user'; + return 'Activity user'; } - return $this->userRepository->find($value)->getUsername(); + $u = $this->userRepository->find($value); + + return $this->userRender->renderString($u, []); }; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php index ea125adb2..58d77c73e 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialActionFilter.php @@ -48,7 +48,7 @@ class BySocialActionFilter implements FilterInterface } return ['Filtered activity by linked socialaction: only %actions%', [ - '%actions%' => implode(", ou", $actions) + '%actions%' => implode(", ou ", $actions) ]]; } @@ -61,7 +61,11 @@ class BySocialActionFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.socialActions', ':socialactions'); + if (!in_array('socialaction', $qb->getAllAliases())) { + $qb->join('activity.socialActions', 'socialaction'); + } + + $clause = $qb->expr()->in('socialaction.id', ':socialactions'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php index 247b0ea32..052b780ff 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/BySocialIssueFilter.php @@ -48,7 +48,7 @@ class BySocialIssueFilter implements FilterInterface } return ['Filtered activity by linked socialissue: only %issues%', [ - '%issues%' => implode(", ou", $issues) + '%issues%' => implode(", ou ", $issues) ]]; } @@ -61,7 +61,11 @@ class BySocialIssueFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.socialIssues', ':socialissues'); + if (!in_array('socialissue', $qb->getAllAliases())) { + $qb->join('activity.socialIssues', 'socialissue'); + } + + $clause = $qb->expr()->in('socialissue.id', ':socialissues'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php index 9fef06f72..b128b03aa 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/ByUserFilter.php @@ -48,7 +48,7 @@ class ByUserFilter implements FilterInterface } return ['Filtered activity by linked users: only %users%', [ - '%users%' => implode(", ou", $users) + '%users%' => implode(", ou ", $users) ]]; } @@ -61,7 +61,11 @@ class ByUserFilter implements FilterInterface { $where = $qb->getDQLPart('where'); - $clause = $qb->expr()->in('activity.users', ':users'); + if (!in_array('user', $qb->getAllAliases())) { + $qb->join('activity.users', 'user'); + } + + $clause = $qb->expr()->in('user.id', ':users'); if ($where instanceof Andx) { $where->add($clause); diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php index 22e1f3c30..cf29f20f2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/LocationTypeFilter.php @@ -50,7 +50,7 @@ class LocationTypeFilter implements FilterInterface } return ['Filtered activity by locationtype: only %types%', [ - '%types%' => implode(", ou", $types) + '%types%' => implode(", ou ", $types) ]]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php index 02aff8cad..d1455ea89 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserFilter.php @@ -49,7 +49,7 @@ class UserFilter implements FilterInterface } return ['Filtered activity by user: only %users%', [ - '%users%' => implode(", ou", $users) + '%users%' => implode(", ou ", $users) ]]; } diff --git a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php index abc26d418..987704ab8 100644 --- a/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php +++ b/src/Bundle/ChillActivityBundle/Export/Filter/ACPFilters/UserScopeFilter.php @@ -52,7 +52,7 @@ class UserScopeFilter implements FilterInterface } return ['Filtered activity by userscope: only %scopes%', [ - '%scopes%' => implode(", ou", $scopes) + '%scopes%' => implode(", ou ", $scopes) ]]; } diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 0bef84ba0..4041b97dc 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -256,7 +256,7 @@ Filter activity by linked users: Filtrer les activités par TMS 'Filtered activity by linked users: only %users%': "Filtré par TMS: uniquement %users%" Accepted users: TMS(s) Filter activity by emergency: Filtrer les activités par urgence -'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement %emergency%" +'Filtered activity by emergency: only %emergency%': "Filtré par urgence: uniquement si %emergency%" activity is emergency: l'activité est urgente activity is not emergency: l'activité n'est pas urgente Filter activity by sentreceived: Filtrer les activités par envoyé/reçu @@ -277,7 +277,7 @@ Accepted userscope: Services #aggregators Activity type: Type d'activité -Activity user: Utilisateur lié à l'activity +Activity user: Utilisateur lié à l'activité By reason: Par sujet By category of reason: Par catégorie de sujet Reason's level: Niveau du sujet @@ -288,8 +288,13 @@ Aggregate by activity reason: Grouper les activités par sujet Group activity by locationtype: Grouper les activités par type de localisation Group activity by date: Grouper les activités par date +Frequency: Fréquence +by month: par mois +by week: par semaine +by year: par année Group activity by linked users: Grouper les activités par TMS impliqué Group activity by linked thirdparties: Grouper les activités par tiers impliqué +Accepted thirdparty: Tiers impliqué Group activity by linked socialaction: Grouper les activités par action liée Group activity by linked socialissue: Grouper les activités par problématique liée Group activity by userscope: Grouper les activités par service du créateur From 7173e4be4a998eeec46f5fcb26436b1904b9cb5e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 24 Aug 2022 15:44:18 +0200 Subject: [PATCH 180/191] exports: fix activity DateAggregator; add customs DQL Date/Time functions --- .../ACPAggregators/DateAggregator.php | 62 +++++++++++++++---- .../translations/messages.fr.yml | 8 ++- .../ChillMainExtension.php | 6 ++ .../ChillMainBundle/Doctrine/DQL/Extract.php | 47 ++++++++++++++ .../ChillMainBundle/Doctrine/DQL/ToChar.php | 38 ++++++++++++ 5 files changed, 145 insertions(+), 16 deletions(-) create mode 100644 src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php create mode 100644 src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index 11e508b88..6dda268e2 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -8,6 +8,7 @@ use Chill\ActivityBundle\Export\Declarations; use Chill\MainBundle\Export\AggregatorInterface; use Closure; use Doctrine\ORM\QueryBuilder; +use RuntimeException; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Contracts\Translation\TranslatorInterface; @@ -16,7 +17,7 @@ class DateAggregator implements AggregatorInterface { private const CHOICES = [ 'by month' => 'month', - 'by week' => 'week', // numéro de la semaine + 'by week' => 'week', 'by year' => 'year', ]; @@ -32,22 +33,32 @@ class DateAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { - return function ($value): string { - switch ($value) { - case '_header': - return 'By date'; - + return function ($value) use ($data): string { + switch ($data['frequency']) { case 'month': - return $this->translator->trans('by month'); + if ($value === '_header') { + return 'by month'; + } + $month = \DateTime::createFromFormat('!m', $value); + return + sprintf("%02d", $value) .'/'. + $month->format('F') // TODO translation ?!? + ; case 'week': - return $this->translator->trans('by week'); + if ($value === '_header') { + return 'by week'; + } + return $this->translator->trans('for week') .' '. $value ; case 'year': - return $this->translator->trans('by year'); + if ($value === '_header') { + return 'by year'; + } + return $this->translator->trans('in year') .' '. $value ; default: - throw new LogicException(sprintf('The value %s is not valid', $value)); + throw new RuntimeException(sprintf('The value %s is not valid', $value)); } }; } @@ -59,8 +70,7 @@ class DateAggregator implements AggregatorInterface public function buildForm(FormBuilderInterface $builder) { - $builder->add('by_date', ChoiceType::class, [ - 'label' => 'Frequency', + $builder->add('frequency', ChoiceType::class, [ 'choices' => self::CHOICES, 'multiple' => false, 'expanded' => true, @@ -81,7 +91,33 @@ class DateAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('activity.date AS date_aggregator'); + switch ($data['frequency']) { + case 'month': + $qb + //->addSelect("TO_CHAR(activity.date,'Mon') AS MON") + ->addSelect('EXTRACT(month FROM activity.date) AS date_aggregator') + //->orderBy('date_aggregator') + ; + break; + + case 'week': + $qb + ->addSelect("TO_CHAR(activity.date, 'IW') AS date_aggregator") + //->orderBy('date_aggregator') + ; + break; + + case 'year': + $qb + //->addSelect("TO_CHAR(activity.date, 'YYYY') AS date_aggregator") + ->addSelect('EXTRACT(year FROM activity.date) AS date_aggregator') + //->orderBy('date_aggregator', 'ASC') + ; + break; + + default: + throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); + } $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index 4041b97dc..9f8ed3d7c 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -289,9 +289,11 @@ Aggregate by activity reason: Grouper les activités par sujet Group activity by locationtype: Grouper les activités par type de localisation Group activity by date: Grouper les activités par date Frequency: Fréquence -by month: par mois -by week: par semaine -by year: par année +by month: Par mois +by week: Par semaine +for week: Semaine +by year: Par année +in year: En Group activity by linked users: Grouper les activités par TMS impliqué Group activity by linked thirdparties: Grouper les activités par tiers impliqué Accepted thirdparty: Tiers impliqué diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php index df0affa86..30bda0ab6 100644 --- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php +++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php @@ -22,6 +22,7 @@ use Chill\MainBundle\Controller\UserController; use Chill\MainBundle\Controller\UserJobApiController; use Chill\MainBundle\Controller\UserJobController; use Chill\MainBundle\DependencyInjection\Widget\Factory\WidgetFactoryInterface; +use Chill\MainBundle\Doctrine\DQL\Extract; use Chill\MainBundle\Doctrine\DQL\GetJsonFieldByKey; use Chill\MainBundle\Doctrine\DQL\JsonAggregate; use Chill\MainBundle\Doctrine\DQL\JsonbArrayLength; @@ -31,6 +32,7 @@ use Chill\MainBundle\Doctrine\DQL\Replace; use Chill\MainBundle\Doctrine\DQL\Similarity; use Chill\MainBundle\Doctrine\DQL\STContains; use Chill\MainBundle\Doctrine\DQL\StrictWordSimilarityOPS; +use Chill\MainBundle\Doctrine\DQL\ToChar; use Chill\MainBundle\Doctrine\DQL\Unaccent; use Chill\MainBundle\Doctrine\ORM\Hydration\FlatHierarchyEntityHydrator; use Chill\MainBundle\Doctrine\Type\NativeDateIntervalType; @@ -238,6 +240,10 @@ class ChillMainExtension extends Extension implements 'ST_CONTAINS' => STContains::class, 'JSONB_ARRAY_LENGTH' => JsonbArrayLength::class, ], + 'datetime_functions' => [ + 'EXTRACT' => Extract::class, + 'TO_CHAR' => ToChar::class, + ], ], 'hydrators' => [ 'chill_flat_hierarchy_list' => FlatHierarchyEntityHydrator::class, diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php new file mode 100644 index 000000000..44d20724b --- /dev/null +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php @@ -0,0 +1,47 @@ +field, + $this->value->dispatch($sqlWalker) + ); + } + + public function parse(Parser $parser) + { + $parser->match(Lexer::T_IDENTIFIER); + $parser->match(Lexer::T_OPEN_PARENTHESIS); + + $parser->match(Lexer::T_IDENTIFIER); + $this->field = $parser->getLexer()->token['value']; + + $parser->match(Lexer::T_FROM); + + $this->value = $parser->ScalarExpression(); + + $parser->match(Lexer::T_CLOSE_PARENTHESIS); + } + +} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php new file mode 100644 index 000000000..c634555dc --- /dev/null +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/ToChar.php @@ -0,0 +1,38 @@ +walkArithmeticPrimary($this->datetime), + $sqlWalker->walkArithmeticPrimary($this->fmt) + ); + } + + public function parse(Parser $parser) + { + $parser->match(Lexer::T_IDENTIFIER); + $parser->match(Lexer::T_OPEN_PARENTHESIS); + $this->datetime = $parser->ArithmeticExpression(); + $parser->match(Lexer::T_COMMA); + $this->fmt = $parser->StringExpression(); + $parser->match(Lexer::T_CLOSE_PARENTHESIS); + } + +} \ No newline at end of file From 9854fb0664e8677d51ee31393488d4d0f532635f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 25 Aug 2022 09:27:30 +0200 Subject: [PATCH 181/191] cancel reason aggregator + start of monthYearAggregator --- .../Aggregator/CancelReasonAggregator.php | 80 +++++++++++++++++++ .../Export/Aggregator/MonthYearAggregator.php | 24 +++++- .../Resources/config/services/exports.yaml | 16 +++- .../translations/messages.fr.yml | 4 +- 4 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php new file mode 100644 index 000000000..f63be8b5d --- /dev/null +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -0,0 +1,80 @@ +cancelReasonRepository = $cancelReasonRepository; + $this->translatableStringHelper = $translatableStringHelper; + } + + public function getLabels($key, array $values, $data): \Closure + { + return function($value): string { + if ($value === '_header') { + return 'Cancel reason'; + } + + $j = $this->cancelReasonRepository->find($value); + + return $this->translatableStringHelper->localize( + $j->getName() + ); + }; + } + + public function getQueryKeys($data): array + { + return ['cancel_reason_aggregator']; + } + + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + public function getTitle(): string + { + return 'Group by cancel reason'; + } + + public function addRole() + { + return null; + } + + public function alterQuery(QueryBuilder $qb, $data) + { + $qb->join('cal.cancelReason', 'cr'); + + $qb->addSelect('IDENTITY(cal.cancelReason) as cancel_reason_aggregator'); + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('cancel_reason_aggregator'); + } else { + $qb->groupBy('cancel_reason_aggregator'); + } + } + + public function applyOn(): string + { + return Declarations::CALENDAR_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index b24120c15..fa83d8398 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -14,12 +14,20 @@ class MonthYearAggregator implements AggregatorInterface public function getQueryKeys($data): array { - return ['monty_year_aggregator']; + return ['month_year_aggregator']; } public function getLabels($key, array $values, $data): Closure { + dump($values); + + $labels = []; + + return static function (string $value) use ($labels): string { + return $labels[$value]; + }; + } public function buildForm(FormBuilderInterface $builder) @@ -39,11 +47,21 @@ class MonthYearAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - // TODO: Implement alterQuery() method. + $qb->addSelect('MONTH(:startDate), YEAR(:startDate) as month_year_aggregator'); +// $qb->addSelect('YEAR(cal.startDate) as year_aggregator'); + + $qb->setParameter('startDate', 'cal.startDate'); + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('month_year_aggregator'); + } else { + $qb->groupBy('month_year_aggregator'); + } } public function applyOn(): string { - return [ Declarations::CALENDAR_TYPE ]; + return Declarations::CALENDAR_TYPE; } } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml index e86194ea6..0f9ed1a49 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -87,4 +87,18 @@ services: autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: location_aggregator } \ No newline at end of file + - { 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_year_aggregator: + class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: month_year_aggregator } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index b0add946d..320be80f5 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -63,7 +63,9 @@ Group by agent job: Grouper par métier de l'agent Group by agent scope: Grouper par service de l'agent Group by location type: Grouper par type de localisation Group by location: Grouper par lieu de rendez-vous +Group by cancel reason: Grouper par motif d'annulation +Group by month and year: Grouper par mois et année Scope: Service Job: Métier Location type: Type de localisation -Location: Lieu de rendez-vous \ No newline at end of file +Location: Lieu de rendez-vous From cf642d278336d379a6daf00a157ceebc6a3c4342 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 25 Aug 2022 13:08:24 +0200 Subject: [PATCH 182/191] month year aggregator working --- .../Export/Aggregator/MonthYearAggregator.php | 19 +++++++++---------- .../Resources/config/services/exports.yaml | 4 ++-- .../translations/messages.fr.yml | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php index fa83d8398..71a0e75bb 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/MonthYearAggregator.php @@ -19,15 +19,16 @@ class MonthYearAggregator implements AggregatorInterface public function getLabels($key, array $values, $data): Closure { + return function($value): string { + if ($value === '_header') { + return 'by month and year'; + } - dump($values); + $month = substr($value,0, 2); + $year = substr($value, 3, 4); - $labels = []; - - return static function (string $value) use ($labels): string { - return $labels[$value]; + return strftime('%B %G', mktime(0, 0, 0, $month, '1', $year)); }; - } public function buildForm(FormBuilderInterface $builder) @@ -47,10 +48,8 @@ class MonthYearAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { - $qb->addSelect('MONTH(:startDate), YEAR(:startDate) as month_year_aggregator'); -// $qb->addSelect('YEAR(cal.startDate) as year_aggregator'); - - $qb->setParameter('startDate', 'cal.startDate'); + $qb->addSelect("to_char(cal.startDate, 'MM-YYYY') AS month_year_aggregator"); + // $qb->addSelect("extract(month from age(cal.startDate, cal.endDate)) AS month_aggregator"); $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { diff --git a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml index 0f9ed1a49..56580dba1 100644 --- a/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml +++ b/src/Bundle/ChillCalendarBundle/Resources/config/services/exports.yaml @@ -96,9 +96,9 @@ services: tags: - { name: chill.export_aggregator, alias: cancel_reason_aggregator } - chill.calendar.export.month_year_aggregator: + chill.calendar.export.month_aggregator: class: Chill\CalendarBundle\Export\Aggregator\MonthYearAggregator autowire: true autoconfigure: true tags: - - { name: chill.export_aggregator, alias: month_year_aggregator } \ No newline at end of file + - { name: chill.export_aggregator, alias: month_aggregator } \ No newline at end of file diff --git a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml index 48f17be76..11937d2b7 100644 --- a/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillCalendarBundle/translations/messages.fr.yml @@ -70,3 +70,4 @@ Scope: Service Job: Métier Location type: Type de localisation Location: Lieu de rendez-vous +by month and year: Par mois et année From 2c151c2ec9ba8bdacd36c986506a5150dbd4a4b9 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Tue, 9 Aug 2022 14:30:34 +0200 Subject: [PATCH 183/191] exports: add new duration aggregator (wip) --- .../DurationAggregator.php | 99 +++++++++++++++++++ .../services/exports_accompanying_course.yaml | 7 ++ .../translations/messages.fr.yml | 1 + 3 files changed, 107 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php new file mode 100644 index 000000000..edf4dc24c --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -0,0 +1,99 @@ + 1 mois, + * - jusqu'à 45 jours => 1 mois, + * 15 | 45 | 75 + * --+----o----+----o----+---- + * | 30 | 60 | + * etc.) + */ +class DurationAggregator implements AggregatorInterface +{ + + /** + * @inheritDoc + */ + public function getLabels($key, array $values, $data) + { + return function ($value): string { + switch ($value) { + + case '_header': + return 'Duration'; + + + default: + throw new \LogicException(sprintf('The value %s is not valid', $value)); + } + }; + } + + /** + * @inheritDoc + */ + public function getQueryKeys($data): array + { + return ['duration_aggregator']; + } + + /** + * @inheritDoc + */ + public function buildForm(FormBuilderInterface $builder) + { + // no form + } + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return 'Group by duration'; + } + + /** + * @inheritDoc + */ + public function addRole() + { + return null; + } + + /** + * @inheritDoc + */ + public function alterQuery(QueryBuilder $qb, $data) + { + $qb + ->addSelect('(acp.closingDate - acp.openingDate) AS duration_aggregator') + ; + + $groupBy = $qb->getDQLPart('groupBy'); + + if (!empty($groupBy)) { + $qb->addGroupBy('duration_aggregator'); + } else { + $qb->groupBy('duration_aggregator'); + } + + $qb->orderBy('duration_aggregator'); + } + + /** + * @inheritDoc + */ + public function applyOn(): string + { + return Declarations::ACP_TYPE; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml index 155ad11df..2b578b4f9 100644 --- a/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml +++ b/src/Bundle/ChillPersonBundle/config/services/exports_accompanying_course.yaml @@ -241,3 +241,10 @@ services: tags: - { name: chill.export_aggregator, alias: accompanyingcourse_referrer_aggregator } + chill.person.export.aggregator_duration: + class: Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators\DurationAggregator + autowire: true + autoconfigure: true + tags: + - { name: chill.export_aggregator, alias: accompanyingcourse_duration_aggregator } + diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 9bb2c7e3f..fdddd5c6c 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -569,6 +569,7 @@ Group by composition: Grouper les ménages par composition familiale Group by number of children: Grouper les ménages par nombre d'enfants ## persons aggregators +Group by duration: Grouper par durée du parcours Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau Group by continents: Grouper par continent From e1ec2dc25c05bdac13226faec200c3a14ff289af Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 25 Aug 2022 12:38:00 +0200 Subject: [PATCH 184/191] exports: DurationAggregator: test qb addSelect for compute date interval --- .../ChillMainBundle/Doctrine/DQL/Extract.php | 13 +++-- .../DurationAggregator.php | 51 ++++++++++++++++--- 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php index 44d20724b..72ca2b461 100644 --- a/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php +++ b/src/Bundle/ChillMainBundle/Doctrine/DQL/Extract.php @@ -2,7 +2,9 @@ namespace Chill\MainBundle\Doctrine\DQL; +use Doctrine\ORM\Query\AST\Functions\DateDiffFunction; use Doctrine\ORM\Query\AST\Functions\FunctionNode; +use Doctrine\ORM\Query\AST\Node; use Doctrine\ORM\Query\AST\PathExpression; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; @@ -12,13 +14,17 @@ use Doctrine\ORM\Query\SqlWalker; * Extract postgresql function * https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT * - * Usage : EXTRACT(field FROM value) + * Usage : EXTRACT(field FROM timestamp) + * TODO allow interval usage -> EXTRACT(field FROM interval) */ class Extract extends FunctionNode { private string $field; - private PathExpression $value; + private $value; + //private PathExpression $value; + //private FunctionNode $value; + //private DateDiffFunction $value; public function getSql(SqlWalker $sqlWalker) { @@ -39,7 +45,8 @@ class Extract extends FunctionNode $parser->match(Lexer::T_FROM); - $this->value = $parser->ScalarExpression(); + //$this->value = $parser->ScalarExpression(); + $this->value = $parser->ArithmeticPrimary(); $parser->match(Lexer::T_CLOSE_PARENTHESIS); } diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index edf4dc24c..163c318c5 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -3,8 +3,12 @@ namespace Chill\PersonBundle\Export\Aggregator\AccompanyingCourseAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Export\Declarations; +use Doctrine\ORM\EntityRepository; use Doctrine\ORM\QueryBuilder; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; +use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -24,16 +28,17 @@ class DurationAggregator implements AggregatorInterface */ public function getLabels($key, array $values, $data) { - return function ($value): string { - switch ($value) { + dump($key, $values, $data); - case '_header': - return 'Duration'; - - - default: - throw new \LogicException(sprintf('The value %s is not valid', $value)); + return function ($value) use ($data): string { + if ($value === '_header') { + return 'Duration'; } + if ($value === null) { + return 'current'; // when closingDate is null + } + return $value; + //sprintf("%02d", $value) . ' days'; }; } @@ -75,7 +80,37 @@ class DurationAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { $qb + // OUI ->addSelect('(acp.closingDate - acp.openingDate) AS duration_aggregator') + //->addSelect('DATE_DIFF(acp.closingDate, acp.openingDate) AS duration_aggregator') + //->addSelect('EXTRACT(month FROM acp.openingDate) AS duration_aggregator') + //->addSelect("DATE_SUB(acp.openingDate, 6, 'day') AS duration_aggregator") + + // TODO adapter la fonction extract pour l'utiliser avec des intervals: extract(month from interval) + // et ajouter une fonction custom qui calcule les intervals, comme doctrineum/date-interval + // https://packagist.org/packages/doctrineum/date-interval#3.1.0 + // (composer fait un conflit de dépendance) + + //->addSelect(" + // EXTRACT( + // month FROM + // DATE_INTERVAL(acp.closingDate, acp.openingDate) + // ) + // AS duration_aggregator") + + // NON + //->addSelect("BETWEEN acp.openingDate AND acp.closingDate AS duration_aggregator") + //->addSelect("EXTRACT(month FROM DATE_SUB(acp.openingDate, 6, 'day')) AS duration_aggregator") + //->addSelect('EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) AS duration_aggregator') + /* + ->addSelect(' + ( CASE + WHEN EXTRACT(day FROM DATE_DIFF(acp.closingDate, acp.openingDate)) > 15 + THEN EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) +1 + ELSE EXTRACT(month FROM DATE_DIFF(acp.closingDate, acp.openingDate)) + END ) AS duration_aggregator + ') + */ ; $groupBy = $qb->getDQLPart('groupBy'); From f5baa2c152ff684bdeeabc4e25d64c5663a09b42 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 25 Aug 2022 13:06:10 +0200 Subject: [PATCH 185/191] exports: DurationAggregator with approximative(*) date interval (*) for more precise, we need dql interval function --- .../DurationAggregator.php | 28 ++++++++++++++----- .../translations/messages.fr.yml | 4 +++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php index 163c318c5..2a0215e82 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/AccompanyingCourseAggregators/DurationAggregator.php @@ -10,6 +10,7 @@ use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Contracts\Translation\TranslatorInterface; /** * Les regroupements seront un nombre de mois, arrondi à l'unité la plus proche (donc @@ -22,23 +23,33 @@ use Symfony\Component\Form\FormBuilderInterface; */ class DurationAggregator implements AggregatorInterface { + private TranslatorInterface $translator; + + public function __construct(TranslatorInterface $translator) + { + $this->translator = $translator; + } /** * @inheritDoc */ public function getLabels($key, array $values, $data) { - dump($key, $values, $data); - return function ($value) use ($data): string { + if ($value === '_header') { - return 'Duration'; + return $this->translator->trans('Rounded month duration'); } + if ($value === null) { - return 'current'; // when closingDate is null + return $this->translator->trans('current duration'); // when closingDate is null } - return $value; - //sprintf("%02d", $value) . ' days'; + + if ($value === 0) { + return $this->translator->trans("duration 0 month"); + } + + return ''. $value . $this->translator->trans(' months'); }; } @@ -81,7 +92,10 @@ class DurationAggregator implements AggregatorInterface { $qb // OUI - ->addSelect('(acp.closingDate - acp.openingDate) AS duration_aggregator') + ->addSelect(' + (acp.closingDate - acp.openingDate +15) *12/365 + AS duration_aggregator' + ) //->addSelect('DATE_DIFF(acp.closingDate, acp.openingDate) AS duration_aggregator') //->addSelect('EXTRACT(month FROM acp.openingDate) AS duration_aggregator') //->addSelect("DATE_SUB(acp.openingDate, 6, 'day') AS duration_aggregator") diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index fdddd5c6c..e105dd45f 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -570,6 +570,10 @@ Group by number of children: Grouper les ménages par nombre d'enfants ## persons aggregators Group by duration: Grouper par durée du parcours +Rounded month duration: Durée en mois (arrondie) +current duration: en cours +duration 0 month: 0 mois (<15 jours) +' months': ' mois' Group people by nationality: Grouper les personnes par nationalités Group by level: Grouper par niveau Group by continents: Grouper par continent From b5139ec460aa5567e634e7d360326fabbe99308e Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 25 Aug 2022 14:10:06 +0200 Subject: [PATCH 186/191] exports: improve activity DateAggregator - put orderby at the end - addSelect with TO_CHAR() function (cancel EXRACT()) - uniformize addSelect cases - orderBy with variable - improve getLabels --- .../ACPAggregators/DateAggregator.php | 59 ++++++++----------- 1 file changed, 26 insertions(+), 33 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php index 6dda268e2..1c2f02d3b 100644 --- a/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php +++ b/src/Bundle/ChillActivityBundle/Export/Aggregator/ACPAggregators/DateAggregator.php @@ -34,31 +34,26 @@ class DateAggregator implements AggregatorInterface public function getLabels($key, array $values, $data) { return function ($value) use ($data): string { + if ($value === '_header') { + return 'by '. $data['frequency']; + } switch ($data['frequency']) { case 'month': - if ($value === '_header') { - return 'by month'; - } $month = \DateTime::createFromFormat('!m', $value); - return - sprintf("%02d", $value) .'/'. - $month->format('F') // TODO translation ?!? - ; + return sprintf( + "%02d (%s)", + $value, + $month->format('M') + ); case 'week': - if ($value === '_header') { - return 'by week'; - } - return $this->translator->trans('for week') .' '. $value ; + //return $this->translator->trans('for week') .' '. $value ; case 'year': - if ($value === '_header') { - return 'by year'; - } - return $this->translator->trans('in year') .' '. $value ; + //return $this->translator->trans('in year') .' '. $value ; default: - throw new RuntimeException(sprintf('The value %s is not valid', $value)); + return $value; } }; } @@ -91,34 +86,24 @@ class DateAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { + $order = null; + switch ($data['frequency']) { case 'month': - $qb - //->addSelect("TO_CHAR(activity.date,'Mon') AS MON") - ->addSelect('EXTRACT(month FROM activity.date) AS date_aggregator') - //->orderBy('date_aggregator') - ; - break; + $fmt = 'MM'; break; case 'week': - $qb - ->addSelect("TO_CHAR(activity.date, 'IW') AS date_aggregator") - //->orderBy('date_aggregator') - ; - break; + $fmt = 'IW'; break; case 'year': - $qb - //->addSelect("TO_CHAR(activity.date, 'YYYY') AS date_aggregator") - ->addSelect('EXTRACT(year FROM activity.date) AS date_aggregator') - //->orderBy('date_aggregator', 'ASC') - ; - break; + $fmt = 'YYYY'; $order = 'DESC'; break; default: throw new RuntimeException(sprintf("The frequency data '%s' is invalid.", $data['frequency'])); } + $qb->addSelect(sprintf("TO_CHAR(activity.date, '%s') AS date_aggregator", $fmt)); + $groupBy = $qb->getDQLPart('groupBy'); if (!empty($groupBy)) { @@ -126,6 +111,14 @@ class DateAggregator implements AggregatorInterface } else { $qb->groupBy('date_aggregator'); } + + $orderBy = $qb->getDQLPart('orderBy'); + + if (!empty($orderBy)) { + $qb->addOrderBy('date_aggregator', $order); + } else { + $qb->orderBy('date_aggregator', $order); + } } public function applyOn(): string From f99f6d5240e4cea9dba5cfd77467e8103c3613d4 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 29 Aug 2022 15:21:05 +0200 Subject: [PATCH 187/191] export: add a geographical unit entity --- .../Entity/GeographicalUnit.php | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php diff --git a/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php new file mode 100644 index 000000000..9e119e30d --- /dev/null +++ b/src/Bundle/ChillMainBundle/Entity/GeographicalUnit.php @@ -0,0 +1,72 @@ +id; + } + + public function getLayerName(): ?string + { + return $this->layerName; + } + + public function getUnitName(): ?string + { + return $this->unitName; + } + + public function setLayerName(?string $layerName): self + { + $this->layerName = $layerName; + + return $this; + } + + public function setUnitName(?string $unitName): self + { + $this->unitName = $unitName; + + return $this; + } +} From 81f04d01843b34964b51c16f4e359ef0eed3edd1 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 29 Aug 2022 15:34:33 +0200 Subject: [PATCH 188/191] export: add a geographical unit entity (migration file) --- .../migrations/Version20220829132409.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/migrations/Version20220829132409.php diff --git a/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php b/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php new file mode 100644 index 000000000..0bb09ef74 --- /dev/null +++ b/src/Bundle/ChillMainBundle/migrations/Version20220829132409.php @@ -0,0 +1,31 @@ +addSql('CREATE SEQUENCE chill_main_geographical_unit_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE chill_main_geographical_unit (id INT NOT NULL, geom TEXT DEFAULT NULL, layerName VARCHAR(255) DEFAULT NULL, unitName VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); + } + + public function down(Schema $schema): void + { + $this->addSql('DROP SEQUENCE chill_main_geographical_unit_id_seq CASCADE'); + $this->addSql('DROP TABLE chill_main_geographical_unit'); + } +} From bf44b6b90decff0cb66aa08e850dc674d6dec0ed Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 29 Aug 2022 16:22:36 +0200 Subject: [PATCH 189/191] export: geographical unit filter --- .../GeographicalUnitStatFilter.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php index 8a18eb2fe..5445e20a4 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/AccompanyingCourseFilters/GeographicalUnitStatFilter.php @@ -2,13 +2,14 @@ namespace Chill\PersonBundle\Export\Filter\AccompanyingCourseFilters; +use Chill\MainBundle\Entity\GeographicalUnit; use Chill\MainBundle\Export\FilterInterface; use Chill\MainBundle\Form\Type\ChillDateType; use Chill\PersonBundle\Export\Declarations; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\FormBuilderInterface; /** @@ -23,12 +24,6 @@ use Symfony\Component\Form\FormBuilderInterface; */ class GeographicalUnitStatFilter implements FilterInterface { - - private const LOCTYPE = [ - 'center' => 'center', - // TODO not yet implemented: https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/626 - ]; - /** * @inheritDoc */ @@ -38,9 +33,12 @@ class GeographicalUnitStatFilter implements FilterInterface ->add('date', ChillDateType::class, [ 'data' => new \DateTime(), ]) - ->add('accepted_loctype', ChoiceType::class, [ - 'choices' => self::LOCTYPE, - 'multiple' => false, + ->add('accepted_loctype', EntityType::class, [ + 'class' => GeographicalUnit::class, + 'choice_label' => function (GeographicalUnit $u) { + return $u->getUnitName(); + }, + 'multiple' => true, 'expanded' => true, ]) ; From 72b5fcf9980a30f1fb03ac0cfda364e34923357b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 30 Aug 2022 13:14:40 +0200 Subject: [PATCH 190/191] minor changes --- .../Export/Aggregator/CancelReasonAggregator.php | 1 + .../SocialWorkAggregators/ResultAggregator.php | 10 ++++++++-- .../Filter/SocialWorkFilters/SocialWorkTypeFilter.php | 7 ++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php index f63be8b5d..583153a7d 100644 --- a/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php +++ b/src/Bundle/ChillCalendarBundle/Export/Aggregator/CancelReasonAggregator.php @@ -60,6 +60,7 @@ class CancelReasonAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { + // TODO: still needs to take into account appointments without a cancel reason somehow $qb->join('cal.cancelReason', 'cr'); $qb->addSelect('IDENTITY(cal.cancelReason) as cancel_reason_aggregator'); diff --git a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php index 424010138..fc602f973 100644 --- a/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php +++ b/src/Bundle/ChillPersonBundle/Export/Aggregator/SocialWorkAggregators/ResultAggregator.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\Export\Aggregator\SocialWorkAggregators; use Chill\MainBundle\Export\AggregatorInterface; +use Chill\MainBundle\Templating\TranslatableStringHelper; use Chill\PersonBundle\Export\Declarations; use Chill\PersonBundle\Repository\SocialWork\ResultRepository; use Doctrine\ORM\QueryBuilder; @@ -21,9 +22,12 @@ final class ResultAggregator implements AggregatorInterface { private ResultRepository $resultRepository; - public function __construct(ResultRepository $resultRepository) + private TranslatableStringHelper $translatableStringHelper; + + public function __construct(ResultRepository $resultRepository, TranslatableStringHelper $translatableStringHelper) { $this->resultRepository = $resultRepository; + $this->translatableStringHelper = $translatableStringHelper; } public function addRole() @@ -34,7 +38,9 @@ final class ResultAggregator implements AggregatorInterface public function alterQuery(QueryBuilder $qb, $data) { $qb->join('acpw.results', 'res'); - $qb->addSelect('res.id as result_aggregator'); + $qb->join('acpw.goals', 'g'); + $qb->join('g.results', 'gres'); + $qb->addSelect('res.id, IDENTITY(g.results) as result_aggregator'); $groupBy = $qb->getDQLPart('groupBy'); diff --git a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php index 4eec8dd69..efd8c93af 100644 --- a/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php +++ b/src/Bundle/ChillPersonBundle/Export/Filter/SocialWorkFilters/SocialWorkTypeFilter.php @@ -11,6 +11,7 @@ use Doctrine\ORM\Query\Expr\Andx; use Doctrine\ORM\QueryBuilder; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Component\Form\Extension\Core\Type\ChoiceType; +use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\FormBuilderInterface; use Chill\PersonBundle\Entity\SocialWork\SocialAction; use Chill\PersonBundle\Templating\Entity\SocialActionRender; @@ -68,21 +69,21 @@ class SocialWorkTypeFilter implements FilterInterface ]); }; - $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($refreshGoals) { + $builder->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($refreshGoals) { $data = $event->getData(); dump($data); $refreshGoals($event->getForm(), $data); }); - $builder->get('actionType')->addEventListener( +/* $builder->get('actionType')->addEventListener( FormEvents::POST_SUBMIT, function (FormEvent $event) use ($refreshGoals) { $actionType = $event->getForm()->getData(); dump($actionType); $refreshGoals($event->getForm()->getParent(), $actionType); } - ); + );*/ } public function getTitle(): string From da2d68a45d74bd68e001f5343e01f3656ab54334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 6 Sep 2022 15:22:30 +0200 Subject: [PATCH 191/191] [documentation] new how-to to switch into branch, and add info about gitlab tokens --- docs/source/installation/index.rst | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/docs/source/installation/index.rst b/docs/source/installation/index.rst index a962148f7..e3791394d 100644 --- a/docs/source/installation/index.rst +++ b/docs/source/installation/index.rst @@ -104,6 +104,29 @@ The password is always ``password``. Now, read `Operations` below. +Prepare for development +*********************** + +Add a Gitlab token to ensure that you get always the source code: + +1. generate a gitlab token there: https://gitlab.com/oauth/token +2. run this command (in php container, at the app's root): :code:`composer config gitlab-token.gitlab.com ` + +The auth token should appears now in the directory :code:`.composer`: + +... code-block: bash + + $ cat .composer/auth.json + { + "gitlab-token": { + "gitlab.com": "" + } + } + + +See also "how to switch branch and get new dependencies". + + Operations ********** @@ -211,6 +234,25 @@ How to run webpack interactively Executing :code:`bash docker-node.sh` will open a terminal in a node container, with volumes mounted. +How to switch the branch for chill-bundles, and get new dependencies +==================================================================== + +During development, you will switch to new branches for chill-bundles. As long as the dependencies are equals, this does not cause any problem. But sometimes, a new branch introduces a new dependency, and you must download it. + +In order to do that without pain, use those steps: + +0. Ensuire you have a token, set +1. at the app's root, update the `composer.json` to your current branch: + +.. code-block:: json + { + "require": { + "chill-bundles": "dev-@dev" + } +``` + +2. mount into the php container, and run `composer update` + Build the documentation API ===========================