From b9c2d63a53653ac8731ef67fb9b4a3992b6bbc92 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:42:14 +0100 Subject: [PATCH 01/27] mes parcours page created --- .../UserAccompanyingPeriodController.php | 41 +++++++++++ .../Menu/UserMenuBuilder.php | 72 +++++++++++++++++++ .../user_periods_list.html.twig | 25 +++++++ .../ChillPersonBundle/config/routes.yaml | 4 ++ .../translations/messages.fr.yml | 3 + 5 files changed, 145 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php create mode 100644 src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php create mode 100644 src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php new file mode 100644 index 000000000..956849efc --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -0,0 +1,41 @@ +accompanyingPeriodRepository = $accompanyingPeriodRepository; + } + + public function listAction(Request $request) + { + $userId = $this->getUser()->getId(); + + $accompanyingPeriods = []; + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $userId]); + + return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ + 'accompanyingPeriods' => $accompanyingPeriods + ]); + + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php new file mode 100644 index 000000000..9030b9264 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -0,0 +1,72 @@ +counter = $counter; + $this->tokenStorage = $tokenStorage; + $this->translator = $translator; + $this->authorizationChecker = $authorizationChecker; + } + + public function buildMenu($menuId, MenuItem $menu, array $parameters) + { + if ($this->authorizationChecker->isGranted('ROLE_USER')) { + $menu->addChild('My accompanying periods', [ + 'route' => 'chill_person_accompanying_period_user', + ]) + ->setExtras([ + 'order' => 20, + 'icon' => 'tasks', + ]); + } + } + + public static function getMenuIds(): array + { + return ['user']; + } +} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig new file mode 100644 index 000000000..12faf739a --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/user_periods_list.html.twig @@ -0,0 +1,25 @@ +{% extends "@ChillMain/layout.html.twig" %} + +{% set activeRouteKey = 'chill_person_accompanying_period_user_list' %} + +{% block title %}{{ 'Accompanying period list'|trans }}{% endblock title %} + +{% macro recordAction(period) %} +
  • + +
  • +{% endmacro %} + + +{% block content %} + +

    {{ 'Accompanying period list'|trans }}

    + +
    + {% for period in accompanyingPeriods %} + {% include '@ChillPerson/AccompanyingPeriod/_list_item.html.twig' with {'period': period, 'recordAction': _self.recordAction(period)} %} + {% endfor %} +
    + +{% endblock %} \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 13d1c1227..13539f6c2 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -55,6 +55,10 @@ chill_person_accompanying_period_re_open: path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction +chill_person_accompanying_period_user: + path: /{_locale}/accompanying-periods + controller: Chill\PersonBundle\Controller\UserAccompanyingPeriodController::listAction + chill_person_resource_list: path: /{_locale}/person/{person_id}/resources/list controller: Chill\PersonBundle\Controller\PersonResourceController::listAction diff --git a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml index 90d8da5cf..fe904cec4 100644 --- a/src/Bundle/ChillPersonBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillPersonBundle/translations/messages.fr.yml @@ -533,3 +533,6 @@ household_composition: # docgen Linked evaluations: Évaluations associées + +# Accompanying period per user +My accompanying periods: Mes parcours From 14463dcd38afb4d7a29d62cc19e71eaa5075243f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:45:03 +0100 Subject: [PATCH 02/27] changelog updated --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1e466b6..d59109a0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,8 @@ and this project adheres to * [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) * [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) -* [person ressources]: module added +* [person ressources]: module added (same as above?) +* [user]: page with accompanying periods to which is user is referent (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/408) ## Test releases From d70f8aa712cedf577b67f19687aae7bab8ac1179 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 11:50:26 +0100 Subject: [PATCH 03/27] phpstan fixes --- .../Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php | 2 +- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php index e5a37c430..bd812e036 100644 --- a/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php +++ b/src/Bundle/ChillMainBundle/Serializer/Normalizer/CommentEmbeddableDocGenNormalizer.php @@ -55,7 +55,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa $user = $this->userRepository->find($object->getUserId()); return [ - 'comment' => (string) $object->getComment(), + 'comment' => $object->getComment(), 'isNull' => false, 'date' => $this->normalizer->normalize($object->getDate(), $format, array_merge($context, [ 'docgen:expects' => DateTime::class, diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index 9030b9264..e7dd210df 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -16,7 +16,7 @@ use Chill\TaskBundle\Templating\UI\CountNotificationTask; use Knp\Menu\MenuItem; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; -use Symfony\Component\Translation\TranslatorInterface; +use Symfony\Contracts\Translation\TranslatorInterface; class UserMenuBuilder implements LocalMenuBuilderInterface { From af3847366b58d0fe5b8125b19a2bd3b244f17132 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 12:33:50 +0100 Subject: [PATCH 04/27] adding age in renderbox and renderstring, implementation of renderbox option in household summary --- .../Resources/views/Entity/person.html.twig | 6 ++++++ .../views/Household/_render_member.html.twig | 1 + .../Templating/Entity/PersonRender.php | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 622318643..b60325bec 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -11,6 +11,7 @@ * addCenter bool * hLevel integer * addDeath bool + * addAgeBadge bool * address_multiline bool * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -40,6 +41,11 @@ {%- endfor -%} {%- endif -%} + {%- if options['addAgeBadge'] -%} + {% if person.age is not null and person.deathDate is null %} + ({{- 'years_old'|trans({ 'age': person.age }) -}}) + {% endif %} + {% endif %} {% endmacro raw %} {% macro label(person, options) %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig index 5b41a15e3..fdd1e0717 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig @@ -14,6 +14,7 @@ 'render': 'label', 'addLink': true, 'addInfo': true, + 'addAgeBadge': true, 'customArea': { 'afterLabel': _self.addHolder(member.holder) } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 6464500c2..ff239f0d6 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; use Symfony\Component\Templating\EngineInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use function array_key_exists; @@ -27,12 +28,16 @@ class PersonRender extends AbstractChillEntityRender private EngineInterface $engine; + private TranslatorInterface $translator; + public function __construct( ConfigPersonAltNamesHelper $configAltNamesHelper, - EngineInterface $engine + EngineInterface $engine, + TranslatorInterface $translator ) { $this->configAltNamesHelper = $configAltNamesHelper; $this->engine = $engine; + $this->translator = $translator; } /** @@ -53,6 +58,7 @@ class PersonRender extends AbstractChillEntityRender 'customButtons' => $options['customButtons'] ?? [], 'customArea' => $options['customArea'] ?? [], 'addDeath' => $options['addDeath'] ?? true, + 'addAgeBadge' => $options['addAgeBadge'] ?? false, ]; return @@ -70,6 +76,11 @@ class PersonRender extends AbstractChillEntityRender */ public function renderString($person, array $options): string { + if (null !== $person->getAge() && $person->getDeathDate() === null) { + return $person->getFirstName() . ' ' . $person->getLastName() + . $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')'; + } + return $person->getFirstName() . ' ' . $person->getLastName() . $this->addAltNames($person, false); } From 6ef7d9b47b31dc98308ff64e7d96fd8d1ce72f37 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 12:33:50 +0100 Subject: [PATCH 05/27] adding age in renderbox and renderstring, implementation of renderbox option in household summary --- .../Resources/views/Entity/person.html.twig | 6 ++++++ .../views/Household/_render_member.html.twig | 1 + .../Templating/Entity/PersonRender.php | 13 ++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index 622318643..b60325bec 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -11,6 +11,7 @@ * addCenter bool * hLevel integer * addDeath bool + * addAgeBadge bool * address_multiline bool * customButtons [ 'before' Twig\Markup, (injected with macro) @@ -40,6 +41,11 @@ {%- endfor -%} {%- endif -%} + {%- if options['addAgeBadge'] -%} + {% if person.age is not null and person.deathDate is null %} + ({{- 'years_old'|trans({ 'age': person.age }) -}}) + {% endif %} + {% endif %} {% endmacro raw %} {% macro label(person, options) %} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig index 5b41a15e3..fdd1e0717 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/_render_member.html.twig @@ -14,6 +14,7 @@ 'render': 'label', 'addLink': true, 'addInfo': true, + 'addAgeBadge': true, 'customArea': { 'afterLabel': _self.addHolder(member.holder) } diff --git a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php index 6464500c2..ff239f0d6 100644 --- a/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php +++ b/src/Bundle/ChillPersonBundle/Templating/Entity/PersonRender.php @@ -15,6 +15,7 @@ use Chill\MainBundle\Templating\Entity\AbstractChillEntityRender; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Entity\Person; use Symfony\Component\Templating\EngineInterface; +use Symfony\Contracts\Translation\TranslatorInterface; use function array_key_exists; @@ -27,12 +28,16 @@ class PersonRender extends AbstractChillEntityRender private EngineInterface $engine; + private TranslatorInterface $translator; + public function __construct( ConfigPersonAltNamesHelper $configAltNamesHelper, - EngineInterface $engine + EngineInterface $engine, + TranslatorInterface $translator ) { $this->configAltNamesHelper = $configAltNamesHelper; $this->engine = $engine; + $this->translator = $translator; } /** @@ -53,6 +58,7 @@ class PersonRender extends AbstractChillEntityRender 'customButtons' => $options['customButtons'] ?? [], 'customArea' => $options['customArea'] ?? [], 'addDeath' => $options['addDeath'] ?? true, + 'addAgeBadge' => $options['addAgeBadge'] ?? false, ]; return @@ -70,6 +76,11 @@ class PersonRender extends AbstractChillEntityRender */ public function renderString($person, array $options): string { + if (null !== $person->getAge() && $person->getDeathDate() === null) { + return $person->getFirstName() . ' ' . $person->getLastName() + . $this->addAltNames($person, false) . ' (' . $this->translator->trans('years_old', ['age' => $person->getAge()]) . ')'; + } + return $person->getFirstName() . ' ' . $person->getLastName() . $this->addAltNames($person, false); } From 8d663cdee6fca77d0ae6089ca80e61c507c846b1 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 16:18:35 +0100 Subject: [PATCH 06/27] creation of vue component person-text --- .../Resources/public/vuejs/_js/i18n.js | 5 +- .../vuejs/_components/Entity/PersonText.vue | 53 +++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js index 1ab8eb29a..c1eac0b06 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_js/i18n.js @@ -61,14 +61,15 @@ const messages = { woman: "Née le" }, deathdate: "Date de décès", - years_old: "ans", household_without_address: "Le ménage de l'usager est sans adresse", no_data: "Aucune information renseignée", type: { thirdparty: "Tiers", person: "Usager" }, - holder: "Titulaire" + holder: "Titulaire", + years_old: "an | {n} an | {n} ans", + } } }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue new file mode 100644 index 000000000..c9e98c55b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -0,0 +1,53 @@ + + + From 44d1535bfb48ab39c3a45d0926ccdf024fad6ca5 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 16:18:54 +0100 Subject: [PATCH 07/27] style fixes --- .../Resources/public/chill/scss/badge.scss | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss index 4d213645e..48e3b25ae 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/chill/scss/badge.scss @@ -12,6 +12,7 @@ display: block; top: calc(50% - 7px); right: 10px; + line-height: 11px; } } @@ -62,6 +63,11 @@ ul.list-suggest { & span:hover { color: $chill-l-gray; } + .person-text { + span { + padding-left: 0px; + } + } } } &.remove-items { @@ -69,7 +75,7 @@ ul.list-suggest { position: relative; span { display: block; - padding-right: .75rem; + padding-right: 1.75rem; @include remove_link; } } From 8720cc730e5d6ef14a44a8e83a661dd960b2169e Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 16:19:19 +0100 Subject: [PATCH 08/27] implementation of person-text --- .../Activity/components/ConcernedGroups.vue | 56 +++--- .../ConcernedGroups/PersonBadge.vue | 20 +- .../components/PersonsAssociated.vue | 22 ++- .../components/Requestor.vue | 11 +- .../components/Resources.vue | 7 +- .../components/Positioning.vue | 9 +- .../_components/Entity/PersonRenderBox.vue | 184 +++++++++--------- 7 files changed, 166 insertions(+), 143 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue index f5057eb25..29efe998d 100644 --- a/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue +++ b/src/Bundle/ChillActivityBundle/Resources/public/vuejs/Activity/components/ConcernedGroups.vue @@ -1,45 +1,47 @@ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue index 3ea64bd67..202d5b376 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated.vue @@ -27,7 +27,7 @@ :value="p.person.id" /> @@ -50,9 +50,9 @@
    • - {{ p.text }} -
    • -
    + + +
    @@ -76,12 +76,14 @@ import {mapGetters, mapState} from 'vuex'; import ParticipationItem from "./PersonsAssociated/ParticipationItem.vue"; import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; export default { name: 'PersonsAssociated', components: { ParticipationItem, - AddPersons + AddPersons, + PersonText }, data() { return { @@ -110,15 +112,15 @@ export default { ) // filter persons appearing twice in requestor and resources .filter( - (e, index, suggested) => { + (e, index, suggested) => { for (let i = 0; i < suggested.length; i = i+1) { - if (i < index && e.id === suggested[i].id) { - return false - } + if (i < index && e.id === suggested[i].id) { + return false + } } return true; - } + } ) }), ...mapGetters([ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue index a5d6791fb..8b13df7aa 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -136,9 +136,9 @@
    • - {{ p.text }} -
    • -
    + + +
    @@ -162,6 +162,8 @@ import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue'; import ThirdPartyRenderBox from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyRenderBox.vue'; import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue'; import { mapState } from 'vuex'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; + export default { name: 'Requestor', @@ -170,7 +172,8 @@ export default { OnTheFly, PersonRenderBox, ThirdPartyRenderBox, - Confidential + Confidential, + PersonText }, props: ['isAnonymous'], data() { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue index ed1f85cf3..069e4d590 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources.vue @@ -22,7 +22,7 @@
    • - {{ p.text }} +
    @@ -45,12 +45,15 @@ import { mapState } from 'vuex'; import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue'; import ResourceItem from './Resources/ResourceItem.vue'; +import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue'; + export default { name: 'Resources', components: { AddPersons, - ResourceItem + ResourceItem, + PersonText }, data() { return { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue index 487fb230e..005d46122 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Positioning.vue @@ -6,12 +6,13 @@
    -

    {{ conc.person.text }}

    + +

    @@ -202,24 +202,24 @@ export default { getUrl: function() { return `/fr/person/${this.person.id}/general`; }, - getAge: function() { - // TODO only one abstract function - if(this.person.birthdate && !this.person.deathdate){ - const birthday = new Date(this.person.birthdate.datetime) - const now = new Date() - return (now.getFullYear() - birthday.getFullYear()) - } else if(this.person.birthdate && this.person.deathdate){ - const birthday = new Date(this.person.birthdate.datetime) - const deathdate = new Date(this.person.deathdate.datetime) - return (deathdate.getFullYear() - birthday.getFullYear()) - } else if(!this.person.birthdate && this.person.deathdate.datetime) { - // todo: change this - return "Age unknown" - } else { - // todo: change this - return "Age unknown" - } - }, + // getAge: function() { + // // TODO only one abstract function + // if(this.person.birthdate && !this.person.deathdate){ + // const birthday = new Date(this.person.birthdate.datetime) + // const now = new Date() + // return (now.getFullYear() - birthday.getFullYear()) + // } else if(this.person.birthdate && this.person.deathdate){ + // const birthday = new Date(this.person.birthdate.datetime) + // const deathdate = new Date(this.person.deathdate.datetime) + // return (deathdate.getFullYear() - birthday.getFullYear()) + // } else if(!this.person.birthdate && this.person.deathdate.datetime) { + // // todo: change this + // return "Age unknown" + // } else { + // // todo: change this + // return "Age unknown" + // } + // }, getCurrentHouseholdUrl: function() { let returnPath = this.returnPath ? `?returnPath=${this.returnPath}` : ``; return `/fr/person/household/${this.person.current_household_id}/summary${returnPath}` diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue index d597f5205..0dde47235 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/Entity/PersonText.vue @@ -21,7 +21,6 @@ export default { for(let i = 0; i < this.person.altNames.length; i++){ return this.person.altNames[i].label } - console.log(this.person.altNames) }, altNameKey: function() { for(let i = 0; i < this.person.altNames.length; i++){ From feaee8a0b10dff745a4086b404e4b79bc0b87ca6 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 10:07:34 +0100 Subject: [PATCH 13/27] a few more implementations in twig templates --- .../Resources/views/Activity/list_recent.html.twig | 2 +- .../list_recent_by_accompanying_period.html.twig | 2 +- .../ChillPersonBundle/Resources/views/Entity/person.html.twig | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig index 0f426c5a9..e8be2c49e 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/list_recent.html.twig @@ -48,7 +48,7 @@
  • {{ 'Participants'|trans ~ ' : ' }} {% for p in activity.personsAssociated %} - {{ p|chill_entity_render_box }} + {{ p|chill_entity_render_box({'addAgeBadge': true}) }} {% endfor %}
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_recent_by_accompanying_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_recent_by_accompanying_period.html.twig index d45ba40ca..7f2fb0177 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_recent_by_accompanying_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourseWork/list_recent_by_accompanying_period.html.twig @@ -31,7 +31,7 @@
  • {{ 'Participants'|trans ~ ' : ' }} {% for p in w.persons %} - {{ p|chill_entity_render_box }} + {{ p|chill_entity_render_box({'addAgeBadge': true}) }} {% endfor %}
  • diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig index b60325bec..9bee504a9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Entity/person.html.twig @@ -43,7 +43,7 @@ {%- endif -%} {%- if options['addAgeBadge'] -%} {% if person.age is not null and person.deathDate is null %} - ({{- 'years_old'|trans({ 'age': person.age }) -}}) + ({{- 'years_old'|trans({ 'age': person.age }) -}}) {% endif %} {% endif %} {% endmacro raw %} From 5bfdee0c286d8bd32f37a1cdab3b97ab55f710ff Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 11:09:14 +0100 Subject: [PATCH 14/27] corrections review --- .../Controller/PersonResourceController.php | 2 -- .../Controller/UserAccompanyingPeriodController.php | 8 +++++--- src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php | 6 ------ .../Resources/views/PersonResource/list.html.twig | 4 +--- src/Bundle/ChillPersonBundle/config/routes.yaml | 4 ---- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php index 577a271e8..210b507e5 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonResourceController.php @@ -148,8 +148,6 @@ final class PersonResourceController extends AbstractController $comment = $form['comment']->getData(); $kind = $form['kind']->getData(); - dump($person); - $personResource->setKind($kind); $personResource->setPerson($person); $personResource->setThirdParty($thirdparty); diff --git a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php index 956849efc..9c24e127f 100644 --- a/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php +++ b/src/Bundle/ChillPersonBundle/Controller/UserAccompanyingPeriodController.php @@ -15,6 +15,7 @@ namespace Chill\PersonBundle\Controller; use Chill\PersonBundle\Repository\AccompanyingPeriodRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Annotation\Route; class UserAccompanyingPeriodController extends AbstractController { @@ -26,12 +27,13 @@ class UserAccompanyingPeriodController extends AbstractController $this->accompanyingPeriodRepository = $accompanyingPeriodRepository; } + /** + * @Route("/{_locale}/accompanying-periods", name="chill_person_accompanying_period_user") + */ public function listAction(Request $request) { - $userId = $this->getUser()->getId(); - $accompanyingPeriods = []; - $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $userId]); + $accompanyingPeriods = $this->accompanyingPeriodRepository->findBy(['user' => $this->getUser()]); return $this->render('@ChillPerson/AccompanyingPeriod/user_periods_list.html.twig', [ 'accompanyingPeriods' => $accompanyingPeriods diff --git a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php index e7dd210df..1b86135b8 100644 --- a/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php +++ b/src/Bundle/ChillPersonBundle/Menu/UserMenuBuilder.php @@ -41,14 +41,8 @@ class UserMenuBuilder implements LocalMenuBuilderInterface public $translator; public function __construct( - CountNotificationTask $counter, - TokenStorageInterface $tokenStorage, - TranslatorInterface $translator, AuthorizationCheckerInterface $authorizationChecker ) { - $this->counter = $counter; - $this->tokenStorage = $tokenStorage; - $this->translator = $translator; $this->authorizationChecker = $authorizationChecker; } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig index 5964cef54..820da9179 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/PersonResource/list.html.twig @@ -52,9 +52,7 @@ {% if resource.comment.comment is not empty %}
    -
    -
    {{ resource.comment.comment }}
    -
    +
    {{ resource.comment|chill_entity_render_box }}
    {% endif %} diff --git a/src/Bundle/ChillPersonBundle/config/routes.yaml b/src/Bundle/ChillPersonBundle/config/routes.yaml index 13539f6c2..13d1c1227 100644 --- a/src/Bundle/ChillPersonBundle/config/routes.yaml +++ b/src/Bundle/ChillPersonBundle/config/routes.yaml @@ -55,10 +55,6 @@ chill_person_accompanying_period_re_open: path: /{_locale}/person/{person_id}/accompanying-period/{period_id}/re-open controller: Chill\PersonBundle\Controller\AccompanyingPeriodController::reOpenAction -chill_person_accompanying_period_user: - path: /{_locale}/accompanying-periods - controller: Chill\PersonBundle\Controller\UserAccompanyingPeriodController::listAction - chill_person_resource_list: path: /{_locale}/person/{person_id}/resources/list controller: Chill\PersonBundle\Controller\PersonResourceController::listAction From 0cda5d637d5917b7c4c0f897731854cccbcd0910 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 12:16:32 +0100 Subject: [PATCH 15/27] styling of parcours list in person search changed --- .../views/Person/list_with_period.html.twig | 63 ++++++++++--------- 1 file changed, 34 insertions(+), 29 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig index cc83dc6ed..5dc1793de 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/list_with_period.html.twig @@ -78,16 +78,25 @@ {% set app = person.findParticipationForPeriod(acp) %}
    - - + {% if acp.requestorPerson == person %} +
    +
    +

    + + {{ 'Requestor'|trans({'gender': person.gender}) }} + +

    +
    +
    + +
    +
    + {% endif %}
    @@ -97,7 +106,7 @@ {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
    {% endif %} - + {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %} {% if notif_counter.total > 0 %} {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }} @@ -107,18 +116,22 @@ {% if acp.emergency %} {{- 'Emergency'|trans|upper -}} {% endif %} - + {% if acp.confidential %} {{- 'Confidential'|trans|upper -}} {% endif %} - + {% if acp.step == 'DRAFT' %} {{ 'course.draft'|trans }} {% endif %} + + {% if acp.step == 'CLOSED' %} + {{ 'course.closed'|trans }} + {% endif %}
    - + {% if acp.user is not null %}
    @@ -131,7 +144,7 @@
    {% endif %} - + {% if acp.socialIssues|length > 0 %}
    @@ -144,24 +157,7 @@
    {% endif %} - - {# ???? - {% if acp.requestorPerson == person %} -
    -
    -

    - -

    -
    -
    - - {{ 'Requestor'|trans({'gender': person.gender}) }} - -
    -
    - {% endif %} - #} - + {% if acp.currentParticipations|length > 1 %}
    @@ -190,7 +186,16 @@
    {% endif %} - + + + {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
    From 4620e32b82753d5c03f0f7afc8f7a7fd489ddf1c Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 12:20:29 +0100 Subject: [PATCH 16/27] changelog updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1e466b6..4d228aa42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to * [parcours] comments truncated if too long + link added (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/406) * [person]: possibility to add person resources (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/382) * [person ressources]: module added +* [search]: listing of parcours display changed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/410) ## Test releases From ad4153a07e47e315dcb2fd0cb800842290af4c42 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 17:05:41 +0100 Subject: [PATCH 17/27] New component for parcours startDate --- .../public/vuejs/AccompanyingCourse/App.vue | 3 ++ .../components/StartDate.vue | 50 +++++++++++++++++++ .../vuejs/AccompanyingCourse/js/i18n.js | 4 ++ .../vuejs/AccompanyingCourse/store/index.js | 20 ++++++++ 4 files changed, 77 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue index c0f279760..51fc2c1d0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/App.vue @@ -14,6 +14,7 @@ + @@ -39,6 +40,7 @@ import Referrer from './components/Referrer.vue'; import Resources from './components/Resources.vue'; import Comment from './components/Comment.vue'; import Confirm from './components/Confirm.vue'; +import StartDate from './components/StartDate.vue'; export default { name: 'App', @@ -56,6 +58,7 @@ export default { Resources, Comment, Confirm, + StartDate }, computed: { ...mapState([ diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue new file mode 100644 index 000000000..26b2e9640 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue @@ -0,0 +1,50 @@ + + + \ No newline at end of file diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js index 297642c24..249cd7d41 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/js/i18n.js @@ -151,6 +151,10 @@ const appMessages = { placeholder: "Choisir un métier", not_valid: "Sélectionnez un métier du référent" }, + startdate: { + change: "Modifier la date de début", + date: "Date de début", + }, // catch errors 'Error while updating AccompanyingPeriod Course.': "Erreur du serveur lors de la mise à jour du parcours d'accompagnement.", 'Error while retriving AccompanyingPeriod Course.': "Erreur du serveur lors du chargement du parcours d'accompagnement.", diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js index 1413aa9e6..6c1f7a138 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/store/index.js @@ -8,6 +8,7 @@ import { getAccompanyingCourse, import { patchPerson } from "ChillPersonAssets/vuejs/_api/OnTheFly"; import { patchThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly"; import { makeFetch } from 'ChillMainAssets/lib/api/apiMethods'; +import { datetimeToISO, ISOToDate, ISOToDatetime } from 'ChillMainAssets/chill/js/date.js'; const debug = process.env.NODE_ENV !== 'production'; @@ -278,6 +279,10 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) if (scopeIds.includes(scope.id)) { state.scopesAtBackend = state.scopesAtBackend.filter(s => s.id !== scope.id); } + }, + updateStartDate(state, date) { + console.log('new state date', date) + state.accompanyingCourse.openingDate.datetime = date; } }, actions: { @@ -701,6 +706,21 @@ let initPromise = Promise.all([scopesPromise, accompanyingCoursePromise]) throw error; }) }, + updateStartDate({commit}, payload) { + console.log('payload', payload) + const date = ISOToDate(payload); + const url = `/api/1.0/person/accompanying-course/${id}.json`; + const body = { type: "accompanying_period", openingDate: { datetime: datetimeToISO(date) }}; + console.log('body', body) + return makeFetch('PATCH', url, body) + .then((response) => { + commit('updateStartDate', ISOToDatetime(response.openingDate.datetime)); + }) + .catch((error) => { + commit('catchError', error); + throw error; + }) + }, async fetchReferrersSuggested({ state, commit}) { let users = await getReferrersSuggested(state.accompanyingCourse); commit('setReferrersSuggested', users); From cb17a7e8a5ae2c615dcf84124ba035457a9ae575 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 17:06:09 +0100 Subject: [PATCH 18/27] Visual improvements of date input fields in social action create form --- .../AccompanyingCourseWorkCreate/App.vue | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue index 74ed0467c..5f4973f3e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkCreate/App.vue @@ -5,7 +5,7 @@
    -
    +

    {{ $t('pick_social_issue_linked_with_action') }}

    {{ si.text }} @@ -33,7 +33,7 @@
    -
    +

    {{ $t('pick_an_action') }}

    -
    +

    {{ $t('persons_involved') }}

      @@ -64,14 +64,27 @@
    -
    + +
    +
    + +
    + +
    -
    + +
    + +
    + +
    +
    -

    {{ $t('form_has_errors') }}

    From fe4eaa92bed4466d37872d33a857af4866a6e502 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 17:36:59 +0100 Subject: [PATCH 19/27] fix bug display current openingDate in datepicker --- .../AccompanyingCourse/components/StartDate.vue | 17 +++++++++-------- .../vuejs/AccompanyingCourse/store/index.js | 12 ++++++------ 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue index 26b2e9640..c5ebc3513 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/StartDate.vue @@ -17,7 +17,7 @@