From 438cb7317adc5fdab7b1623cec0355e9a2e3fb01 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 26 Nov 2021 12:20:22 +0100 Subject: [PATCH 01/45] person: add api point for altname config --- .../DependencyInjection/ChillPersonExtension.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index 1e4d5022f..a1d2ab0b3 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -738,6 +738,20 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], + [ + 'class' => \Chill\PersonBundle\Entity\PersonAltName::class, + 'name' => 'person_alt_names', + 'base_path' => '/api/1.0/person/config/alt_names', + 'base_role' => 'ROLE_USER', + 'actions' => [ + '_index' => [ + 'methods' => [ + Request::METHOD_GET => true, + Request::METHOD_HEAD => true, + ], + ], + ], + ], ], ]); } From 3d3ce7814bb9749dc23f87c637cbf85defffd2d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 26 Nov 2021 12:48:55 +0100 Subject: [PATCH 02/45] person: add api endpoint for altname + implement getValidationGroups --- .../Controller/PersonApiController.php | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 23f6ec95d..3a3613c8b 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -78,4 +78,35 @@ class PersonApiController extends ApiController new Role(PersonVoter::CREATE)); $person->setCenter($centers[0]); */ } + + /** + * @Route("/api/1.0/person/config/alt_names.{_format}", + * name="chill_person_config_alt_names", + * requirements={ + * "_format": "json" + * } + * ) + */ + public function configAltNames(Request $request, string $_format): Response + { + + //TODO get alt_name config from chill person + $configAltNames = ["key" => "jeune_fille", "labels" => ["fr" => "Nom de naisssance" ]]; //TODO fake data + + return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]); + } + + public function getValidationGroups(string $action, Request $request, string $_format, $entity): ?array + { + if ($action === '_entity'){ + if ($request->getMethod() === Request::METHOD_POST){ + return ["creation"]; + } + if (($request->getMethod() === Request::METHOD_PATCH) || ($request->getMethod() === Request::METHOD_PUT)){ + return ["general"]; + } + }; + return parent::getValidationGroups($action, $request, $_format, $entity); + } + } From d71d1beb428110b7eb5383cf4964107a92c89307 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 26 Nov 2021 12:53:07 +0100 Subject: [PATCH 03/45] person: remove api endpoint (was a mistake) --- .../DependencyInjection/ChillPersonExtension.php | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php index a1d2ab0b3..1e4d5022f 100644 --- a/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php +++ b/src/Bundle/ChillPersonBundle/DependencyInjection/ChillPersonExtension.php @@ -738,20 +738,6 @@ class ChillPersonExtension extends Extension implements PrependExtensionInterfac ], ], ], - [ - 'class' => \Chill\PersonBundle\Entity\PersonAltName::class, - 'name' => 'person_alt_names', - 'base_path' => '/api/1.0/person/config/alt_names', - 'base_role' => 'ROLE_USER', - 'actions' => [ - '_index' => [ - 'methods' => [ - Request::METHOD_GET => true, - Request::METHOD_HEAD => true, - ], - ], - ], - ], ], ]); } From 780b7db8cb424122a4202c5a5f7b144d054ada77 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 26 Nov 2021 18:04:46 +0100 Subject: [PATCH 04/45] person: add altnames in the person creation modal --- .../Controller/PersonApiController.php | 5 +++- .../Resources/public/vuejs/_api/OnTheFly.js | 8 ++++++ .../vuejs/_components/OnTheFly/Person.vue | 28 +++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index 3a3613c8b..1d7726867 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -91,7 +91,10 @@ class PersonApiController extends ApiController { //TODO get alt_name config from chill person - $configAltNames = ["key" => "jeune_fille", "labels" => ["fr" => "Nom de naisssance" ]]; //TODO fake data + $configAltNames = [ + ["key" => "jeune_fille", "labels" => ["fr" => "Nom de naissance" ]], + ["key" => "surnom", "labels" => ["fr" => "Surnom" ]] + ]; //TODO fake data return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js index c8031da58..20ed1c8da 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_api/OnTheFly.js @@ -10,6 +10,13 @@ const getPerson = (id) => { }); }; +const getPersonAltNames = () => + fetch('/api/1.0/person/config/alt_names.json').then(response => { + if (response.ok) { return response.json(); } + throw Error('Error with request resource response'); + });; + + /* * POST a new person */ @@ -48,6 +55,7 @@ const patchPerson = (id, body) => { export { getPerson, + getPersonAltNames, postPerson, patchPerson }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue index d0627753a..9f1729dd4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue @@ -43,6 +43,11 @@ +
+ + +
+
From 872090e02a5a701a573a1ad1bf43f61acb2fd934 Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Dec 2021 15:00:52 +0100 Subject: [PATCH 13/45] household: change translations + add address i18n in household component --- .../Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js index 527f3a7da..c5ca26046 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js @@ -1,5 +1,6 @@ import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n' +import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n' const appMessages = { fr: { @@ -34,7 +35,7 @@ const appMessages = { create_new_address: "Créer une nouvelle adresse", }, concerned: { - title: "Usagers déplacés", + title: "Usager(s) à (re)positionner dans un ménage", persons_will_be_moved: "Les usagers suivants vont être déplacés", add_at_least_onePerson: "Indiquez au moins un usager à déplacer", remove_concerned: "Ne plus transférer", @@ -84,7 +85,7 @@ const appMessages = { } }; -Object.assign(appMessages.fr, personMessages.fr); +Object.assign(appMessages.fr, personMessages.fr, addressMessages.fr); export { appMessages From af87b3f6da34f1a0955f473ecb59d1ad3825b5af Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Dec 2021 16:41:48 +0100 Subject: [PATCH 14/45] household: add onthefly translations --- .../Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js index c5ca26046..32c57945b 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js @@ -1,6 +1,7 @@ import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n' import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n' +import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n' const appMessages = { fr: { @@ -85,7 +86,7 @@ const appMessages = { } }; -Object.assign(appMessages.fr, personMessages.fr, addressMessages.fr); +Object.assign(appMessages.fr, personMessages.fr, addressMessages.fr, ontheflyMessages.fr); export { appMessages From da12aedb5308061ee1f0c4e4cc82307b7ab4870e Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 10 Dec 2021 17:40:40 +0100 Subject: [PATCH 15/45] household: redirect to the household page when a household is created from a person --- .../public/vuejs/HouseholdMembersEditor/store/index.js | 10 +++++++--- .../Resources/views/Person/household_history.html.twig | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js index e15d79349..7bcc8c845 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js @@ -533,10 +533,14 @@ const store = createStore({ // nothing to do anymore here, bye-bye ! let params = new URLSearchParams(window.location.search); - if (params.has('returnPath')) { - window.location.replace(params.get('returnPath')); - } else { + if (params.has('followAfter')) { window.location.replace(`/fr/person/household/${household_id}/summary`); + } else { + if (params.has('returnPath')) { + window.location.replace(params.get('returnPath')); + } else { + window.location.replace(`/fr/person/household/${household_id}/summary`); + } } } else { // we assume the answer was 422... diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig index 5dff4b074..7bc83e51e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/household_history.html.twig @@ -17,7 +17,7 @@
  • - + {{ 'household.Join'|trans }} From 13faf6fe5a3b5b292926f903a74c7e626cdff368 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 13 Dec 2021 12:19:23 +0100 Subject: [PATCH 16/45] household member editor: display when a concerned person already belongs to a household --- .../components/Concerned.vue | 22 +++++++++++++++++-- .../vuejs/HouseholdMembersEditor/js/i18n.js | 3 +++ .../HouseholdMembersEditor/store/index.js | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index b291bc06d..43ac3bf5e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -9,7 +9,7 @@

    {{ $t('household_members_editor.concerned.persons_will_be_moved') }} : - +

    +
    +

    {{ $t('household_members_editor.concerned.persons_with_household') }}

    +
      +
    • + {{ $t('household_members_editor.concerned.person') }} {{c.person.text}} {{$t('household_members_editor.concerned.already_belongs_to_household') }} + {{c.person.current_household_id}}. +
    • +
    +
    +
      @@ -59,7 +69,7 @@ export default { }, computed: { ...mapState([ - 'concerned' + 'concerned', 'household' ]), ...mapGetters([ 'persons', @@ -67,6 +77,11 @@ export default { noPerson () { return this.$store.getters.persons.length === 0; }, + concernedPersonsWithHouseholds () { + return this.$store.state.concerned.filter(c => + c.person.current_household_id !== null && c.person.current_household_id !== this.$store.state.household.id + ); + } }, data() { return { @@ -92,6 +107,9 @@ export default { console.log('remove person in concerned', person); this.$store.dispatch('removePerson', person); }, + makeHouseholdLink(id) { + return `/fr/person/household/${id}/summary` + } } } diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js index 32c57945b..c9cdd496d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js @@ -46,6 +46,9 @@ const appMessages = { move_to: "Déplacer vers", persons_leaving: "Usagers quittant leurs ménages", no_person_in_position: "Aucun usager ne sera ajouté à cette position", + persons_with_household: "Attention, usagers avec ménages", + person: "L'usager", + already_belongs_to_household: "appartient déjà au ménage" }, positioning: { persons_to_positionnate: 'Usagers à positionner', diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js index 7bcc8c845..678fb98a0 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js @@ -307,7 +307,7 @@ const store = createStore({ comment: "", }); } else { - console.err("person already included"); + console.error("person already included"); } }, markPosition(state, { person_id, position_id}) { From f2c724726a5f9f83dca2c72c410158a2f25dc6c9 Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 13 Dec 2021 14:16:01 +0100 Subject: [PATCH 17/45] household member editor: fix show other household warning + wording --- .../public/vuejs/HouseholdMembersEditor/api.js | 2 +- .../HouseholdMembersEditor/components/Concerned.vue | 13 +++++++++---- .../public/vuejs/HouseholdMembersEditor/js/i18n.js | 5 ++--- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js index 7a91ec912..b42e57fe6 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/api.js @@ -33,7 +33,7 @@ const fetchHouseholdSuggestionByAccompanyingPeriod = (personId) => { throw Error ({m: 'Error while fetching household suggestion', status: response.status}); }).then(data => Promise.resolve(data.results)) - .catch(e => console.err(e)); + .catch(e => console.error(e)); ; }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue index 43ac3bf5e..09359c6dd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/Concerned.vue @@ -23,7 +23,8 @@

      {{ $t('household_members_editor.concerned.persons_with_household') }}

      • - {{ $t('household_members_editor.concerned.person') }} {{c.person.text}} {{$t('household_members_editor.concerned.already_belongs_to_household') }} + {{ c.person.text }} + {{ $t('household_members_editor.concerned.already_belongs_to_household') }} {{c.person.current_household_id}}.
      @@ -78,9 +79,13 @@ export default { return this.$store.getters.persons.length === 0; }, concernedPersonsWithHouseholds () { - return this.$store.state.concerned.filter(c => - c.person.current_household_id !== null && c.person.current_household_id !== this.$store.state.household.id - ); + if (this.$store.state.household) { + return this.$store.state.concerned.filter(c => + c.person.current_household_id !== null && c.person.current_household_id !== this.$store.state.household.id + ) + } else { + return []; + } } }, data() { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js index c9cdd496d..139e6462f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/js/i18n.js @@ -46,9 +46,8 @@ const appMessages = { move_to: "Déplacer vers", persons_leaving: "Usagers quittant leurs ménages", no_person_in_position: "Aucun usager ne sera ajouté à cette position", - persons_with_household: "Attention, usagers avec ménages", - person: "L'usager", - already_belongs_to_household: "appartient déjà au ménage" + persons_with_household: "Les usagers suivants sont associés à ces ménages:", + already_belongs_to_household: "est associé au ménage" }, positioning: { persons_to_positionnate: 'Usagers à positionner', From 159dba0dc3f7ef1a9fd8a7d4c2d6b1d02f06320e Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 13 Dec 2021 14:36:08 +0100 Subject: [PATCH 18/45] household member editor: do not add in new members if the member is included in the members of household --- .../HouseholdMembersEditor/store/index.js | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js index 678fb98a0..cd43ee29c 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/store/index.js @@ -224,18 +224,21 @@ const store = createStore({ } state.concerned.forEach((c, index) => { - let m = { - id: index * -1, - person: c.person, - holder: c.holder, - position: c.position, - }; - if (c.position === null) { - m.position = { - ordering: 999999 + if (!(h.members.map((m) => m.person.id)).includes(c.person.id)) { + let m = { + id: index * -1, + person: c.person, + holder: c.holder, + position: c.position, + }; + if (c.position === null) { + m.position = { + ordering: 999999 + } } + h.new_members.push(m); } - h.new_members.push(m); + }) console.log('fake household', h); From bbebaa9fae98bafe08126335c528309f4b5f918e Mon Sep 17 00:00:00 2001 From: nobohan Date: Mon, 13 Dec 2021 14:58:01 +0100 Subject: [PATCH 19/45] household member editor: comment markNoAddress button --- .../HouseholdMembersEditor/components/HouseholdAddress.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue index 9b2fe94a0..22051f721 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/HouseholdMembersEditor/components/HouseholdAddress.vue @@ -2,11 +2,11 @@
        -
      • +
      • Date: Mon, 13 Dec 2021 15:06:35 +0100 Subject: [PATCH 20/45] upd CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209bf858e..98b543d25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,14 @@ and this project adheres to ## Unreleased +* [household] change translations (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109) +* [household] add address i18n in household component (champs-libres/departement-de-la-vendee/accent-suivi-developpement#158) +* [household] add on the fly i18n in household component +* [household] redirect to the household page when a household is created from a person (champs-libres/departement-de-la-vendee/accent-suivi-developpement#175) +* [household] household member editor: display alert if some members have already an household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#172) +* [household] household member editor: do not add in new members if the member is included in the members of household (champs-libres/departement-de-la-vendee/accent-suivi-developpement#123) +* [household] household member editor: remove markNoAddress button (champs-libres/departement-de-la-vendee/accent-suivi-developpement#109) + * [main] change address format in case the country is France, in Address render box and address normalizer * [person] add validator for accompanying period with a test on social issues (https://gitlab.com/champs-libres/departement-de-la-vendee/accent-suivi-developpement/-/issues/76) * [activity] fix visibility for location From 4dc490beb7e979d1627d2b06801f795e1e4695e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 13 Dec 2021 14:57:36 +0000 Subject: [PATCH 21/45] change public function to protected function --- src/Bundle/ChillPersonBundle/Controller/PersonApiController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php index b845de1fd..9bd54945e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonApiController.php @@ -120,7 +120,7 @@ class PersonApiController extends ApiController return $this->json($configAltNames, Response::HTTP_OK, [], ['groups' => ['read']]); } - public function getValidationGroups(string $action, Request $request, string $_format, $entity): ?array + protected function getValidationGroups(string $action, Request $request, string $_format, $entity): ?array { if ($action === '_entity'){ if ($request->getMethod() === Request::METHOD_POST){ From 5089bba4d7cb6c820f50a933b1776d1458889000 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 29 Dec 2021 12:11:20 +0100 Subject: [PATCH 22/45] improve masonry bloc style --- .../Resources/public/chill/chillperson.scss | 16 ++ .../views/AccompanyingCourse/index.html.twig | 167 ++++++++++-------- 2 files changed, 109 insertions(+), 74 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss index f39f64eb2..9680f116a 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/chill/chillperson.scss @@ -254,3 +254,19 @@ abbr.referrer { // still used ? border: 1px solid black; padding: 10px; } + +/// Masonry blocs on AccompanyingCourse resume page +div#dashboards { + div.mbloc { + & > div:not(.warnings) { + border: 1px solid $chill-light-gray; + padding: 1rem; + } + & > div.warnings .alert { + margin-bottom: 0; + } + blockquote.chill-user-quote { + margin: -1.2em; + } + } +} diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 39e924d18..cf05ccdf9 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -19,104 +19,123 @@ {% endblock %} {% block content %} -
        +
        -
        - {% if 'DRAFT' == accompanyingCourse.step %} -
        - {% include '@ChillPerson/AccompanyingCourse/_still_draft.html.twig' %} +
        + +
        +
        + {% include '@ChillPerson/AccompanyingCourse/_still_draft.html.twig' %} +
        + {% if 'DRAFT' == accompanyingCourse.step %} {% endif %} +
        +
        + {% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' %} +
        +
        {% if 'DRAFT' != accompanyingCourse.step %} {% if withoutHousehold|length > 0 %} -
        - {% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' %} -
        {% endif %} {% endif %} +
        +
        + {% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' %} +
        +
        {% if accompanyingCourse.locationStatus == 'address' or accompanyingCourse.locationStatus == 'none' %} -
        - {% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' %} -
        {% endif %} -
        - {% if accompanyingCourse.locationStatus == 'person' %} -

        {{ 'This course is located by'|trans }}

        -

        {{ accompanyingCourse.personLocation|chill_entity_render_string }}

        - {% elseif accompanyingCourse.locationStatus == 'address' %} -

        {{ 'This course has a temporarily location'|trans }}

        - {% endif %} +
        +
        + {% if accompanyingCourse.locationStatus == 'person' %} +

        {{ 'This course is located by'|trans }}

        +

        {{ accompanyingCourse.personLocation|chill_entity_render_string }}

        + {% elseif accompanyingCourse.locationStatus == 'address' %} +

        {{ 'This course has a temporarily location'|trans }}

        + {% endif %} - {% if accompanyingCourse.locationStatus != 'none' %} - {{ accompanyingCourse.location|chill_entity_render_box }} - {% endif %} + {% if accompanyingCourse.locationStatus != 'none' %} + {{ accompanyingCourse.location|chill_entity_render_box }} + {% endif %} +
        {% if accompanyingCourse.participations is not empty %} -
        -

        {{ 'Persons associated'|trans }}

        - {% for r in accompanyingCourse.participations %} - {{ _self.insert_onthefly('person', r.person) }} - {% endfor %} -
        - {% endif %} - - {% if accompanyingCourse.resources is not empty %} -
        -

        {{ 'Resources'|trans }}

        - {% for r in accompanyingCourse.resources %} - {% if r.person is not null %} +
        +
        +

        {{ 'Persons associated'|trans }}

        + {% for r in accompanyingCourse.participations %} {{ _self.insert_onthefly('person', r.person) }} - {% elseif r.thirdParty is not null %} - {{ _self.insert_onthefly('thirdparty', r.thirdParty) }} - {% endif %} - {% endfor %} -
        - {% endif %} - - {% if accompanyingCourse.pinnedComment is not empty %} -
        -

        {{ 'Pinned comment'|trans }}

        -
        - {{ accompanyingCourse.pinnedComment.content }} - -
        -
        - {% endif %} - - {% if accompanyingCourse.scopes is not empty %} -
        -

        {{ 'Scopes'|trans }}

        -
        - {% for s in accompanyingCourse.scopes %} - {{ s.name|localize_translatable_string|capitalize }}{% if not loop.last %}, {% endif %} {% endfor %}
        {% endif %} + {% if accompanyingCourse.resources is not empty %} +
        +
        +

        {{ 'Resources'|trans }}

        + {% for r in accompanyingCourse.resources %} + {% if r.person is not null %} + {{ _self.insert_onthefly('person', r.person) }} + {% elseif r.thirdParty is not null %} + {{ _self.insert_onthefly('thirdparty', r.thirdParty) }} + {% endif %} + {% endfor %} +
        +
        + {% endif %} + + {% if accompanyingCourse.pinnedComment is not empty %} +
        +
        +

        {{ 'Pinned comment'|trans }}

        +
        + {{ accompanyingCourse.pinnedComment.content|chill_markdown_to_html }} + +
        +
        +
        + {% endif %} + + {% if accompanyingCourse.scopes is not empty %} +
        +
        +

        {{ 'Scopes'|trans }}

        +
        + {% for s in accompanyingCourse.scopes %} + {{ s.name|localize_translatable_string|capitalize }}{% if not loop.last %}, {% endif %} + {% endfor %} +
        +
        +
        + {% endif %} + {% if accompanyingCourse.requestorPerson is not null or accompanyingCourse.requestorThirdParty is not null %} -
        - {% if accompanyingCourse.requestorPerson is not null %} -

        {{ 'Requestor'|trans }}

        - {{ _self.insert_onthefly('person', accompanyingCourse.requestorPerson) }} - {% elseif accompanyingCourse.requestorThirdParty is not null %} -

        {{ 'Requestor'|trans }}

        - {{ _self.insert_onthefly('thirdparty', accompanyingCourse.requestorThirdParty) }} - {% endif %} +
        +
        + {% if accompanyingCourse.requestorPerson is not null %} +

        {{ 'Requestor'|trans }}

        + {{ _self.insert_onthefly('person', accompanyingCourse.requestorPerson) }} + {% elseif accompanyingCourse.requestorThirdParty is not null %} +

        {{ 'Requestor'|trans }}

        + {{ _self.insert_onthefly('thirdparty', accompanyingCourse.requestorThirdParty) }} + {% endif %} +
        {% endif %}
        From 1055fd9398f6884547466f5c831a8e48d07a4809 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 29 Dec 2021 12:13:39 +0100 Subject: [PATCH 23/45] masonry: raise comment bloc width --- .../views/AccompanyingCourse/index.html.twig | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index cf05ccdf9..494212bcd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -65,6 +65,27 @@
        + {% if accompanyingCourse.pinnedComment is not empty %} +
        +
        +

        {{ 'Pinned comment'|trans }}

        +
        + {{ accompanyingCourse.pinnedComment.content|chill_markdown_to_html }} + +
        +
        +
        + {% endif %} + {% if accompanyingCourse.participations is not empty %}
        @@ -91,27 +112,6 @@
        {% endif %} - {% if accompanyingCourse.pinnedComment is not empty %} -
        -
        -

        {{ 'Pinned comment'|trans }}

        -
        - {{ accompanyingCourse.pinnedComment.content|chill_markdown_to_html }} - -
        -
        -
        - {% endif %} - {% if accompanyingCourse.scopes is not empty %}
        From 982dd788281f8a98722028adb7c0a5f4133984c1 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 29 Dec 2021 12:15:21 +0100 Subject: [PATCH 24/45] put back warnings inside condition --- .../Resources/views/AccompanyingCourse/index.html.twig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 494212bcd..77b075a82 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -23,31 +23,31 @@
        + {% if 'DRAFT' == accompanyingCourse.step %}
        {% include '@ChillPerson/AccompanyingCourse/_still_draft.html.twig' %}
        - {% if 'DRAFT' == accompanyingCourse.step %} {% endif %} + {% if 'DRAFT' != accompanyingCourse.step %} + {% if withoutHousehold|length > 0 %}
        {% include '@ChillPerson/AccompanyingCourse/_join_household.html.twig' %}
        - {% if 'DRAFT' != accompanyingCourse.step %} - {% if withoutHousehold|length > 0 %} {% endif %} {% endif %} + {% if accompanyingCourse.locationStatus == 'address' + or accompanyingCourse.locationStatus == 'none' %}
        {% include '@ChillPerson/AccompanyingCourse/_warning_address.html.twig' %}
        - {% if accompanyingCourse.locationStatus == 'address' - or accompanyingCourse.locationStatus == 'none' %} {% endif %}
        From 9e67d9586d6e285b569e61f968706a40b7409380 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Wed, 29 Dec 2021 12:32:19 +0100 Subject: [PATCH 25/45] masonry: add origin bloc --- .../views/AccompanyingCourse/index.html.twig | 11 +++++++++++ .../ChillPersonBundle/translations/messages.fr.yml | 1 + 2 files changed, 12 insertions(+) diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 77b075a82..e4b4c3503 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -70,6 +70,7 @@

        {{ 'Pinned comment'|trans }}

        + {{ accompanyingCourse.pinnedComment.content|chill_markdown_to_html }}
        {% endif %} + + {% if accompanyingCourse.origin is not empty %} +
        +
        +

        {{ 'Origin'|trans }}

        + {{ accompanyingCourse.origin.label|localize_translatable_string|capitalize }} +
        +
        + {% endif %} +