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 7c41e8c66..7f8521083 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue +++ b/src/Bundle/ChillMainBundle/Resources/public/vuejs/OnTheFly/components/OnTheFly.vue @@ -212,10 +212,22 @@ export default { type = 'thirdparty' data = this.$refs.castThirdparty.$data.thirdparty; // create the new contact here, bypassing saveFormOnTheFly() -> not working here? - console.log('addContact data', data) - postThirdparty(data) + const body = { + "type": "thirdparty", + "kind": "child", + "name": data.text, + "isChild": true, + "parent": {"type": "thirdparty", "id": this.parent.id}, + "civility": {"id": data.civility}, + "profession": {"id": data.profession}, + "comment": data.comment, + "phonenumber": data.phonenumber, + } + // console.log('body', body) + postThirdparty(body) .then(thirdparty => new Promise((resolve, reject) => { - this.newPriorSuggestion(thirdparty); + // this.newPriorSuggestion(thirdparty); + console.log('thirdparty created', thirdparty) resolve(); })); } else { @@ -229,7 +241,9 @@ export default { } // console.log('type', type, 'data', data) // pass datas to parent - this.$emit('saveFormOnTheFly', { type: type, data: data }); + if (this.action != 'addContact') { + this.$emit('saveFormOnTheFly', { type: type, data: data }); + } this.modal.showModal = false; }, diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php index 7404846e4..5679ea1f2 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdParty.php @@ -126,7 +126,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var Civility * @ORM\ManyToOne(targetEntity=Civility::class) * ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true) - * @Groups({"docgen:read", "docgen:read:3party:parent"}) + * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ private ?Civility $civility = null; @@ -199,7 +199,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id") - * @Groups({"docgen:read"}) + * @Groups({"read", "write", "docgen:read"}) * @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"}) */ private ?ThirdParty $parent = null; @@ -210,7 +210,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface * @var ThirdPartyProfession * @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession") * ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true) - * @Groups({"docgen:read", "docgen:read:3party:parent"}) + * @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"}) * @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"}) */ private ?ThirdPartyProfession $profession = null; diff --git a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php index bf10c7cf1..12b0818b5 100644 --- a/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php +++ b/src/Bundle/ChillThirdPartyBundle/Entity/ThirdPartyProfession.php @@ -31,7 +31,7 @@ class ThirdPartyProfession * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") - * @Serializer\Groups({"docgen:read", "read"}) + * @Serializer\Groups({"docgen:read", "read", "write"}) */ private ?int $id = null; 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 5299319fa..4b7bade24 100644 --- a/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue +++ b/src/Bundle/ChillThirdPartyBundle/Resources/public/vuejs/_components/OnTheFly/ThirdParty.vue @@ -48,7 +48,6 @@