further attempts to do POST of thirdparty contact, passing parent id causes problems + civility and profession fk's are not saved on POST

This commit is contained in:
2022-01-17 12:00:22 +01:00
parent 47615e2e5d
commit a31b74e0e5
3 changed files with 18 additions and 8 deletions

View File

@@ -100,6 +100,7 @@ import Modal from 'ChillMainAssets/vuejs/_components/Modal.vue';
import OnTheFlyCreate from './Create.vue';
import OnTheFlyPerson from 'ChillPersonAssets/vuejs/_components/OnTheFly/Person.vue';
import OnTheFlyThirdparty from 'ChillThirdPartyAssets/vuejs/_components/OnTheFly/ThirdParty.vue';
import { postThirdparty } from "ChillThirdPartyAssets/vuejs/_api/OnTheFly";
export default {
name: 'OnTheFly',
@@ -219,16 +220,23 @@ export default {
if (this.action === 'addContact') {
type = 'thirdparty'
data = this.$refs.castThirdparty.$data.thirdparty;
// console.log(data)
// create the new contact here, bypassing saveFormOnTheFly() -> not working here?
console.log('addContact data', data)
postThirdparty(data)
.then(thirdparty => new Promise((resolve, reject) => {
this.newPriorSuggestion(thirdparty);
resolve();
}));
} else {
type = this.$refs.castNew.radioType;
data = this.$refs.castNew.castDataByType();
console.log(data)
}
} else {
throw 'error with object type';
}
}
console.log('type', type, 'data', data)
// console.log('type', type, 'data', data)
// pass datas to parent
this.$emit('saveFormOnTheFly', { type: type, data: data });