From af3847366b58d0fe5b8125b19a2bd3b244f17132 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 27 Jan 2022 12:33:50 +0100 Subject: [PATCH 01/26] 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 02/26] 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 03/26] 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 04/26] 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 05/26] 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 11/26] 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 4d1a553474e512ed0b9b9cff3a0dbced1ed0f177 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 28 Jan 2022 11:40:08 +0100 Subject: [PATCH 12/26] =?UTF-8?q?show=20activity=20attendee=20(pr=C3=A9sen?= =?UTF-8?q?ce)=20in=20the=20activity=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/views/Activity/_list_item.html.twig | 11 +++++++++++ .../Resources/views/Activity/show.html.twig | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig index 6b2e33dfb..fadf7ff14 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/_list_item.html.twig @@ -41,6 +41,17 @@
    {% endif %} + {% if activity.attendee and t.attendeeVisible %} +
    +

    {{ 'Attendee'|trans }}

    +
    +

    + {{ activity.attendee.name|localize_translatable_string }} +

    +
    +
    + {% endif %} + {% if activity.sentReceived is not empty and t.sentReceivedVisible %}

    {{ 'Sent received'|trans }}

    diff --git a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig index 546ba99ce..a5e3bd1fd 100644 --- a/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig +++ b/src/Bundle/ChillActivityBundle/Resources/views/Activity/show.html.twig @@ -165,11 +165,7 @@
    {{ 'Attendee'|trans }}
    {% if entity.attendee is not null %} - {% if entity.attendee %} - {{ 'present'|trans|capitalize }} - {% else %} - {{ 'not present'|trans|capitalize }} - {% endif %} + {{ entity.attendee.name|localize_translatable_string }} {% else %} {{ 'None'|trans|capitalize }} {% endif %} From 105fe16122711fb7f69917040a6c807a27968460 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 28 Jan 2022 11:40:30 +0100 Subject: [PATCH 13/26] upd CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f2fb4a22..3683260d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to ## Unreleased +* [activity] show activity attendee (présence) in the activity list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/412) +* [activity] admin: change validation rule for social action visible field (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/413) * [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 From ad4153a07e47e315dcb2fd0cb800842290af4c42 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Fri, 28 Jan 2022 17:05:41 +0100 Subject: [PATCH 14/26] 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 15/26] 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 16/26] 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 @@ -