From 06cc84a21faf4e57c8a6e2c2dc97957f5f14d74f Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 24 Mar 2022 11:40:06 +0100 Subject: [PATCH] conditional statements to allow for personne moral creation and edit --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 11 +++++++++-- .../components/Resources/ResourceItem.vue | 11 +++++++---- .../public/vuejs/_components/OnTheFly/ThirdParty.vue | 3 ++- 3 files changed, 18 insertions(+), 7 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 e053c8ae8..66a30c296 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -229,11 +229,18 @@ export default { data = this.$refs.castThirdparty.$data.thirdparty; // console.log('data original', data); data.parent = {type: "thirdparty", id: this.parent.id}; + data.civility = {type: 'chill_main_civility', id: data.civility.id}; + data.profession = {type: 'third_party_profession', id: data.profession.id}; } else { type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); - data.civility = {type: 'chill_main_civility', id: data.civility.id}; - data.profession = {type: 'third_party_profession', id: data.profession.id}; + // console.log('type', type); + if (null !== data.civility) { + data.civility = {type: 'chill_main_civility', id: data.civility.id}; + } + if (null !== data.profession) { + data.profession = {type: 'third_party_profession', id: data.profession.id}; + } // console.log('onthefly data', data); } } else { 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 dca57f113..df2bd0c35 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 @@ -172,11 +172,14 @@ export default { body.name = payload.data.name; body.email = payload.data.email; body.telephone = payload.data.telephone; - body.civility = {type: 'chill_main_civility', id: payload.data.civility.id}; - body.profession = {type: 'third_party_profession', id: payload.data.profession.id}; body.address = payload.data.address ? { id: payload.data.address.address_id } : null; - - console.log('body', body); + if (null !== payload.data.civility) { + body.civility = {type: 'chill_main_civility', id: payload.data.civility.id}; + } + if (null !== payload.data.profession) { + body.profession = {type: 'third_party_profession', id: payload.data.profession.id}; + } + // console.log('body', body); makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { diff --git a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue index 86e569731..85f09a9ed 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -65,7 +65,7 @@
-
+