From 4e6454d7dea25002a153608c4ae8a52db4493659 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Jun 2021 12:26:06 +0200 Subject: [PATCH 1/6] translation Activity Envoyer/recevoir --- src/Bundle/ChillActivityBundle/translations/messages.fr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml index dc2894499..3f3f8ff45 100644 --- a/src/Bundle/ChillActivityBundle/translations/messages.fr.yml +++ b/src/Bundle/ChillActivityBundle/translations/messages.fr.yml @@ -38,7 +38,7 @@ Required: Obligatoire Persons: Personnes Users: Utilisateurs Emergency: Urgent -Sent received: Envoyer / Recevoir +Sent received: Entrant / Sortant Sent: Envoyer Received: Recevoir by: 'Par ' From ac47a75a759f9a692f36943558a379be62ad08b8 Mon Sep 17 00:00:00 2001 From: nobohan Date: Tue, 22 Jun 2021 12:26:56 +0200 Subject: [PATCH 2/6] fix bug issue 163 Address JSON string not valid --- .../Controller/PersonAddressController.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php index 5dc6fea46..4ec1b6218 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonAddressController.php @@ -297,18 +297,16 @@ class PersonAddressController extends AbstractController */ protected function findAddressById(Person $person, $address_id) { - // filtering address - $criteria = Criteria::create() - ->where(Criteria::expr()->eq('id', $address_id)) - ->setMaxResults(1); - $addresses = $person->getAddresses()->matching($criteria); + $address = $this->getDoctrine()->getManager() + ->getRepository(Address::class) + ->find($address_id) + ; - if (count($addresses) === 0) { - throw $this->createNotFoundException("Address with id $address_id " - . "matching person $person_id not found "); + if (!$person->getAddresses()->contains($address)) { + throw $this->createAccessDeniedException("Not allowed to see this address"); } - return $addresses->first(); + return $address; } /** From ab8deb036b0708ba65ae98c8589a9c465a493cf0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Wed, 23 Jun 2021 21:28:42 +0200 Subject: [PATCH 3/6] accompanyingCourse: add activities in the accompanying course summary --- .../AccompanyingCourseController.php | 10 +++++-- .../views/AccompanyingCourse/index.html.twig | 28 ++++++++++--------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index c33fc636e..d9bc07ffb 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -75,7 +75,7 @@ class AccompanyingCourseController extends Controller return $this->redirectToRoute('chill_person_accompanying_course_edit', [ 'accompanying_period_id' => $period->getId() ]); - + } /** @@ -96,9 +96,15 @@ class AccompanyingCourseController extends Controller } } + $activities = $this->getDoctrine()->getManager()->getRepository('ChillActivityBundle:Activity')->findBy( + ['accompanyingPeriod' => $accompanyingCourse], + ['date' => 'DESC'], + ); + return $this->render('@ChillPerson/AccompanyingCourse/index.html.twig', [ 'accompanyingCourse' => $accompanyingCourse, - 'withoutHousehold' => $withoutHousehold + 'withoutHousehold' => $withoutHousehold, + 'activities' => $activities ]); } diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig index 4c3ad8b56..364f8c7fd 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/index.html.twig @@ -67,9 +67,9 @@

{{ p.person.firstname ~ ' ' ~ p.person.lastname }}

{% set born = (p.person.gender == 'woman') ? 'née': 'né' %} - {% set gender = (p.person.gender == 'woman') ? 'fa-venus' : + {% set gender = (p.person.gender == 'woman') ? 'fa-venus' : (p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} - {% set genderTitle = (p.person.gender == 'woman') ? 'femme' : + {% set genderTitle = (p.person.gender == 'woman') ? 'femme' : (p.person.gender == 'man') ? 'homme' : 'neutre' %} {{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }}

@@ -103,9 +103,9 @@ {% if p.person.isSharingHousehold %}
  • - @@ -128,7 +128,7 @@ {% for r in accompanyingCourse.resources %}
    {% if r.person %} - +

    @@ -137,9 +137,9 @@

    {% set born = (r.person.gender == 'woman') ? 'née': 'né' %} - {% set gender = (r.person.gender == 'woman') ? 'fa-venus' : + {% set gender = (r.person.gender == 'woman') ? 'fa-venus' : (r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %} - {% set genderTitle = (r.person.gender == 'woman') ? 'femme' : + {% set genderTitle = (r.person.gender == 'woman') ? 'femme' : (r.person.gender == 'homme') ? 'fa-mars' : 'neutre' %} {{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }}

    @@ -174,10 +174,10 @@
    - + {% endif %} {% if r.thirdParty %} - +

    @@ -214,7 +214,7 @@

    - + {% endif %}
    {% endfor %} @@ -222,9 +222,11 @@

    {{ 'Social actions'|trans }}

    -

    {{ 'Last events on accompanying course'|trans }}

    - + {% set person = null %} + {% block contentActivity %} + {% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %} + {% endblock %} {# ==> insert accompanyingCourse vue component #} -
    +
    {% endblock %} From b7f2e189dc47073eef060beb810e229d180adcb4 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 24 Jun 2021 13:47:40 +0200 Subject: [PATCH 4/6] small fix: use class name instead of string --- .../Controller/AccompanyingCourseController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php index d9bc07ffb..82581641e 100644 --- a/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php +++ b/src/Bundle/ChillPersonBundle/Controller/AccompanyingCourseController.php @@ -2,6 +2,7 @@ namespace Chill\PersonBundle\Controller; +use Chill\ActivityBundle\Entity\Activity; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation; use Chill\PersonBundle\Privacy\AccompanyingPeriodPrivacyEvent; @@ -96,7 +97,7 @@ class AccompanyingCourseController extends Controller } } - $activities = $this->getDoctrine()->getManager()->getRepository('ChillActivityBundle:Activity')->findBy( + $activities = $this->getDoctrine()->getManager()->getRepository(Activity::class)->findBy( ['accompanyingPeriod' => $accompanyingCourse], ['date' => 'DESC'], ); From 91c5cd74f7df95e4e306a55c9e2369525de78a19 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 24 Jun 2021 14:00:59 +0200 Subject: [PATCH 5/6] household address: remove group write on member collection --- src/Bundle/ChillPersonBundle/Entity/Household/Household.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php index dc38f64b7..f59fc567e 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Household/Household.php +++ b/src/Bundle/ChillPersonBundle/Entity/Household/Household.php @@ -51,7 +51,7 @@ class Household * targetEntity=HouseholdMember::class, * mappedBy="household" * ) - * @Serializer\Groups({"write", "read"}) + * @Serializer\Groups({"read"}) */ private Collection $members; @@ -225,7 +225,7 @@ class Household public function getCurrentMembersOrdered(?\DateTimeImmutable $now = null): Collection { $members = $this->getCurrentMembers($now); - + $members->getIterator() ->uasort( function (HouseholdMember $a, HouseholdMember $b) { From 36eb247995527ad5e33b14f6c60404c2fd33a127 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 24 Jun 2021 16:02:57 +0200 Subject: [PATCH 6/6] address: add maxlength, upd default map center and add loader messages in addresses form --- .../Resources/public/vuejs/Address/App.vue | 12 ++++++++++ .../Resources/public/vuejs/Address/js/i18n.js | 4 +++- .../public/vuejs/Address/store/index.js | 22 ++++++++++++++++--- .../public/vuejs/_components/AddAddress.vue | 16 +++++++++++++- .../_components/AddAddress/AddressMap.vue | 2 +- .../_components/AddAddress/AddressMore.vue | 7 ++++++ .../public/vuejs/HouseholdAddress/App.vue | 12 ++++++++++ .../public/vuejs/HouseholdAddress/js/i18n.js | 4 +++- .../vuejs/HouseholdAddress/store/index.js | 22 ++++++++++++++++--- 9 files changed, 91 insertions(+), 10 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue index c0d3271ef..438e94892 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/App.vue @@ -26,6 +26,12 @@
    {{ errors }}
    +
    + {{ $t('loading') }} +
    +
    + {{ $t('person_address_creation_success') }} +
    @@ -68,6 +74,12 @@ export default { }, errors() { return this.$store.state.errorMsg; + }, + loading() { + return this.$store.state.loading; + }, + success() { + return this.$store.state.success; } }, methods: { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/js/i18n.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/js/i18n.js index b6f483894..d0e43266a 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/js/i18n.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/js/i18n.js @@ -26,7 +26,9 @@ const addressMessages = { date: 'Date de la nouvelle adresse', add_an_address_to_person: 'Ajouter l\'adresse à la personne', validFrom: 'Date de la nouvelle adresse', - back_to_the_list: 'Retour à la liste' + back_to_the_list: 'Retour à la liste', + person_address_creation_success: 'La nouvelle adresse de la personne est enregistrée', + loading: 'chargement en cours...' } }; diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js index acbf4dcbb..9db2a7298 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/Address/store/index.js @@ -11,7 +11,9 @@ const store = createStore({ address: {}, editAddress: {}, //TODO or should be address? person: {}, - errorMsg: [] + errorMsg: [], + loading: false, + success: false }, getters: { }, @@ -39,11 +41,17 @@ const store = createStore({ console.log('@M getEditAddress address', address); state.editAddress = address; }, + setLoading(state, b) { + state.loading = b; + }, + setSuccess(state, b) { + state.success = b; + } }, actions: { addAddress({ commit }, payload) { console.log('@A addAddress payload', payload); - + commit('setLoading', true); if('newPostalCode' in payload){ let postalCodeBody = payload.newPostalCode; postalCodeBody = Object.assign(postalCodeBody, {'origin': 3}); @@ -55,9 +63,11 @@ const store = createStore({ .then(address => new Promise((resolve, reject) => { commit('addAddress', address); resolve(); + commit('setLoading', false); })) .catch((error) => { commit('catchError', error); + commit('setLoading', false); }); }) @@ -66,15 +76,17 @@ const store = createStore({ .then(address => new Promise((resolve, reject) => { commit('addAddress', address); resolve(); + commit('setLoading', false); })) .catch((error) => { commit('catchError', error); + commit('setLoading', false); }); } }, addDateToAddressAndAddressToPerson({ commit }, payload) { console.log('@A addDateToAddressAndAddressToPerson payload', payload); - + commit('setLoading', true); patchAddress(payload.addressId, payload.body) .then(address => new Promise((resolve, reject) => { commit('addDateToAddress', address.validFrom); @@ -84,13 +96,17 @@ const store = createStore({ .then(person => new Promise((resolve, reject) => { commit('addAddressToPerson', person); resolve(); + commit('setLoading', false); + commit('setSuccess', true); })) .catch((error) => { commit('catchError', error); + commit('setLoading', false); }) )) .catch((error) => { commit('catchError', error); + commit('setLoading', false); }); }, updateAddress({ commit }, payload) { diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue index 3417a2d0d..e8bb3700b 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/_components/AddAddress.vue @@ -19,6 +19,10 @@