possible to add a contact to a thirdparty

This commit is contained in:
2022-01-19 10:57:31 +01:00
parent 724ce8c9af
commit 4431428c26
5 changed files with 25 additions and 16 deletions

View File

@@ -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;
},