From 3d5723facbe07f15a8ff8e2fe75e4a2bd53406d3 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 08:59:56 +0100 Subject: [PATCH 1/7] AddPerson: correct thirdparty PATCH url + add email and altnames in AddPerson and serializer --- .../components/PersonsAssociated/ParticipationItem.vue | 4 +++- .../vuejs/AccompanyingCourse/components/Requestor.vue | 4 +++- .../components/Resources/ResourceItem.vue | 4 +++- .../Serializer/Normalizer/PersonJsonNormalizer.php | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index 2ed08ffc0..dbc7b47ac 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -120,6 +120,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -143,7 +145,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; 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 8f29f4771..809348d20 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Requestor.vue @@ -261,6 +261,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -284,7 +286,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue index 102dcf741..c9b66a8e5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/Resources/ResourceItem.vue @@ -152,6 +152,8 @@ export default { if (payload.data.birthdate !== null) { body.birthdate = payload.data.birthdate; } body.phonenumber = payload.data.phonenumber; body.mobilenumber = payload.data.mobilenumber; + body.email = payload.data.email; + body.altNames = payload.data.altNames; body.gender = payload.data.gender; makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) @@ -175,7 +177,7 @@ export default { body.telephone = payload.data.phonenumber; body.address = { id: payload.data.address.address_id }; - makeFetch('PATCH', `/api/1.0/third-party/third-party/${payload.data.id}.json`, body) + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) this.canCloseOnTheFlyModal = true; diff --git a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php index 6288663e2..bfac5f936 100644 --- a/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php +++ b/src/Bundle/ChillPersonBundle/Serializer/Normalizer/PersonJsonNormalizer.php @@ -91,6 +91,7 @@ class PersonJsonNormalizer implements 'deathdate', 'center', 'altNames', + 'email' ]; $fields = array_filter( @@ -161,6 +162,11 @@ class PersonJsonNormalizer implements } } + break; + + case 'email': + $person->setEmail($data[$item]); + break; } } @@ -189,6 +195,7 @@ class PersonJsonNormalizer implements 'centers' => $this->normalizer->normalize($this->centerResolverManager->resolveCenters($person), $format, $context), 'phonenumber' => $person->getPhonenumber(), 'mobilenumber' => $person->getMobilenumber(), + 'email' => $person->getEmail(), 'altNames' => $this->normalizeAltNames($person->getAltNames()), 'gender' => $person->getGender(), 'current_household_address' => $this->normalizer->normalize($person->getCurrentHouseholdAddress(), $format, $context), From 4afea55465b46d3f04ba8b8d7d2a2dc865445937 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 09:17:45 +0100 Subject: [PATCH 2/7] addperson: repair altname: add altname if known --- .../Resources/public/vuejs/_components/OnTheFly/Person.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 9543da3bb..0e511ce5e 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/OnTheFly/Person.vue @@ -43,10 +43,11 @@ -
+
@@ -199,6 +200,9 @@ export default { }, feminized() { return (this.person.gender === 'woman')? 'e' : ''; + }, + personAltNamesLabels() { + return this.person.altNames.map(a => a ? a.label : ''); } }, mounted() { From 1f0ef6e1872b28f49266688d8f2cce21600e67e0 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 11:07:32 +0100 Subject: [PATCH 3/7] on-the-fly: close modal only after validation --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 12 +----------- .../PersonsAssociated/ParticipationItem.vue | 9 ++++----- .../AccompanyingCourse/components/Requestor.vue | 13 ++++++------- .../components/Resources/ResourceItem.vue | 13 ++++--------- .../public/vuejs/_components/AddPersons.vue | 8 +++----- 5 files changed, 18 insertions(+), 37 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue index 116ed86c1..21f7a9c55 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -90,7 +90,7 @@ export default { OnTheFlyThirdparty, OnTheFlyCreate }, - props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent', 'canCloseModal'], + props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'isDead', 'parent'], emits: ['saveFormOnTheFly'], data() { return { @@ -162,16 +162,6 @@ export default { return 'entity-' + this.type + ' badge-' + this.type; } }, - watch: { - canCloseModal: { - handler: function(val, oldVal) { - if (val) { - this.closeModal(); - } - }, - deep: true - } - }, methods: { closeModal() { this.modal.showModal = false; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue index dbc7b47ac..c9c7136c5 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourse/components/PersonsAssociated/ParticipationItem.vue @@ -28,7 +28,7 @@
  • -
  • +
  • @@ -82,7 +82,7 @@ :id="resource.resource.id" action="edit" @saveFormOnTheFly="saveFormOnTheFly" - :canCloseModal="canCloseOnTheFlyModal"> + ref="onTheFly">
  • @@ -116,11 +116,6 @@ export default { }, props: ['resource'], emits: ['remove'], - data() { - return { - canCloseOnTheFlyModal: false - } - }, computed: { parent() { return { @@ -159,7 +154,7 @@ export default { makeFetch('PATCH', `/api/1.0/person/person/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addPerson', { target: payload.target, body: response }) - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -180,7 +175,7 @@ export default { makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: response }) - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 9e318ff96..1f017d28d 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -69,7 +69,7 @@ :buttonText="$t('onthefly.create.button', {q: query})" action="create" @saveFormOnTheFly="saveFormOnTheFly" - :canCloseModal="canCloseOnTheFlyModal"> + ref="onTheFly">
  • @@ -121,7 +121,6 @@ export default { selected: [], priorSuggestion: {} }, - canCloseOnTheFlyModal: false } }, computed: { @@ -271,7 +270,7 @@ export default { makeFetch('POST', '/api/1.0/person/person.json', data) .then(response => { this.newPriorSuggestion(response); - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -287,7 +286,7 @@ export default { makeFetch('POST', '/api/1.0/thirdparty/thirdparty.json', data) .then(response => { this.newPriorSuggestion(response); - this.canCloseOnTheFlyModal = true; + this.$refs.onTheFly.closeModal(); }) .catch((error) => { if (error.name === 'ValidationException') { @@ -299,7 +298,6 @@ export default { } }) } - this.canCloseOnTheFlyModal = false; } }, } From f139af8b6f33c823a550dd0a588ad1dd1d8de442 Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 3 Feb 2022 11:26:31 +0100 Subject: [PATCH 4/7] accompanying course work: fix on-the-fly update of thirdParty --- .../vuejs/AccompanyingCourseWorkEdit/App.vue | 30 ++++++++++++++----- .../vuejs/AccompanyingCourseWorkEdit/index.js | 10 ++++++- .../vuejs/AccompanyingCourseWorkEdit/store.js | 12 ++++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue index f9d1a747c..34c0794fb 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/AccompanyingCourseWorkEdit/App.vue @@ -211,7 +211,7 @@