From ff4b90835e67ef9f9cdd71f2247a9d474e68d9b3 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 9 Mar 2022 20:29:38 +0100 Subject: [PATCH] show current civility and profession in edit form + fix saving of edited information --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 2 ++ .../components/Resources/ResourceItem.vue | 9 +++++---- .../public/vuejs/_components/OnTheFly/ThirdParty.vue | 10 ++++------ 3 files changed, 11 insertions(+), 10 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 4ef6192f1..a04c68eaf 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -228,6 +228,8 @@ export default { type = 'thirdparty' data = this.$refs.castThirdparty.$data.thirdparty; console.log('data original', data); + data.civility = data.civility ? {type: 'chill_main_civility', id: data.civility.id} : null; + data.profession = data.profession ? {type: 'third_party_profession', id: data.profession.id} : null; data.parent = {type: "thirdparty", id: this.parent.id}; } else { type = this.$refs.castNew.radioType; 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 37321e0bb..597be1ce1 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 @@ -137,7 +137,7 @@ export default { }, methods: { saveFormOnTheFly(payload) { - console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data); + // console.log('saveFormOnTheFly: type', payload.type, ', data', payload.data); payload.target = 'resource'; let body = { type: payload.type }; @@ -167,14 +167,15 @@ export default { }) } else if (payload.type === 'thirdparty') { - console.log('data', payload.data) body.name = payload.data.name; body.email = payload.data.email; body.telephone = payload.data.telephone; - body.civility = payload.data.civility; - body.profession = payload.data.profession; + 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); + makeFetch('PATCH', `/api/1.0/thirdparty/thirdparty/${payload.data.id}.json`, body) .then(response => { this.$store.dispatch('addThirdparty', { target: payload.target, body: 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 8de41b989..6086d75c3 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -67,17 +67,17 @@
-
-
@@ -209,7 +209,6 @@ export default { context.addressId = this.thirdparty.address.address_id; context.edit = true; } - console.log('context', context); //this.context = context; <-- return context; }, @@ -219,7 +218,6 @@ export default { return getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => { this.thirdparty = thirdparty; this.thirdparty.kind = thirdparty.kind; - console.log('get thirdparty', thirdparty); if (this.action !== 'show') { if (thirdparty.address !== null) { // bof! we force getInitialAddress because addressId not available when mounted