This commit is contained in:
2022-02-28 13:52:41 +01:00
parent fe89704672
commit c12f633829
7 changed files with 35 additions and 42 deletions

View File

@@ -77,14 +77,11 @@ export default {
return this.$refs.castPerson.$data.person;
case 'thirdparty':
let data = this.$refs.castThirdparty.$data.thirdparty;
data.name = data.text;
/*
if (data.address !== undefined && data.address !== null) {
data.address = { id: data.address.address_id }
} else {
data.address = null;
}
*/
return data;
default:

View File

@@ -219,31 +219,17 @@ export default {
case 'thirdparty':
data = this.$refs.castThirdparty.$data.thirdparty;
/* never executed ? */
break;
default:
if (typeof this.type === 'undefined') { // action=create or addContact
console.log('will rewrite data');
if (this.action === 'addContact') {
type = 'thirdparty'
data = this.$refs.castThirdparty.$data.thirdparty;
data = {
"type": "thirdparty",
"kind": "child",
"name": data.text,
"isChild": true,
"parent": {"type": "thirdparty", "id": this.parent.id},
"comment": data.comment,
"telephone": data.phonenumber,
"email": data.email,
"address": this.parent.address
}
if ("civility" in data) {
Object.assign(data, {"civility": {"id": data.civility}} )
}
if ("profession" in data) {
Object.assign(data, {"profession": {"id": data.profession}} )
}
console.log('data original', data);
data.parent = {type: "thirdparty", id: this.parent.id};
} else {
type = this.$refs.castNew.radioType;
data = this.$refs.castNew.castDataByType();
@@ -253,7 +239,8 @@ export default {
throw 'error with object type';
}
}
console.log('type', type, 'data', data)
console.log('type', type);
console.log('data', data);
// pass datas to parent
this.$emit('saveFormOnTheFly', { type: type, data: data });
},