From 145c1d59e9501c89aeb3f276c2403bd3f9123c45 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Mon, 24 Jan 2022 14:24:56 +0100 Subject: [PATCH] bugfix emit saveFormOnTheFly and add newly created contact to suggestion list immediately --- .../public/vuejs/OnTheFly/components/OnTheFly.vue | 8 +------- .../Resources/public/vuejs/_components/AddPersons.vue | 1 + .../vuejs/_components/AddPersons/PersonSuggestion.vue | 6 +++++- .../vuejs/_components/AddPersons/TypeThirdParty.vue | 7 +++++++ 4 files changed, 14 insertions(+), 8 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 7a7c822bb..e873cea80 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -218,7 +218,7 @@ export default { type = 'thirdparty' data = this.$refs.castThirdparty.$data.thirdparty; // create the new contact here, bypassing saveFormOnTheFly() -> not working here? - const body = { + data = { "type": "thirdparty", "kind": "child", "name": data.text, @@ -231,12 +231,6 @@ export default { "email": data.email, "address": null } - postThirdparty(body) - .then(thirdparty => new Promise((resolve, reject) => { - // this.$parent.newPriorSuggestion(thirdparty); - console.log('thirdparty created', thirdparty) - resolve(); - })); } else { type = this.$refs.castNew.radioType; data = this.$refs.castNew.castDataByType(); diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue index 4cc0b7b74..072c6aa0f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons.vue @@ -57,6 +57,7 @@ v-bind:item="item" v-bind:search="search" v-bind:type="checkUniq" + @saveFormOnTheFly="saveFormOnTheFly" @updateSelected="updateSelected"> diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue index c6bd0b262..be97f93f4 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/PersonSuggestion.vue @@ -18,6 +18,7 @@ @@ -54,7 +55,7 @@ export default { 'search', 'type' ], - emits: ['updateSelected'], + emits: ['updateSelected', 'saveFormOnTheFly'], computed: { selected: { set(value) { @@ -72,6 +73,9 @@ export default { methods: { setValueByType(value, type) { return (type === 'radio')? [value] : value; + }, + emitEvent({data, type}) { + this.$emit('saveFormOnTheFly', {type: type, data: data}) } } }; diff --git a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue index 74c103c4b..e79b43073 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue +++ b/src/Bundle/ChillPersonBundle/Resources/public/vuejs/_components/AddPersons/TypeThirdParty.vue @@ -25,6 +25,7 @@