mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
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:
parent
47615e2e5d
commit
a31b74e0e5
@ -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 });
|
||||
|
||||
|
@ -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", "read", "write", "docgen:read:3party:parent"})
|
||||
* @Groups({"docgen:read", "docgen:read:3party:parent"})
|
||||
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||
*/
|
||||
private ?Civility $civility = null;
|
||||
@ -166,7 +166,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
* @Groups({"read", "write", "docgen:read", "docgen:read:3party:parent"})
|
||||
* @Groups({"read", "docgen:read", "docgen:read:3party:parent"})
|
||||
*/
|
||||
private ?int $id = 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({"read", "write", "docgen:read"})
|
||||
* @Groups({"docgen:read"})
|
||||
* @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"})
|
||||
*/
|
||||
private ?ThirdParty $parent = null;
|
||||
|
@ -154,8 +154,7 @@ export default {
|
||||
return {
|
||||
//context: {}, <--
|
||||
thirdparty: {
|
||||
type: 'thirdparty',
|
||||
parent: this.parent.id
|
||||
type: 'thirdparty'
|
||||
},
|
||||
professions: [],
|
||||
civilities: [],
|
||||
@ -213,7 +212,7 @@ export default {
|
||||
getThirdparty(this.id).then(thirdparty => new Promise((resolve, reject) => {
|
||||
this.thirdparty = thirdparty;
|
||||
this.thirdparty.kind = thirdparty.kind;
|
||||
//console.log('get thirdparty', thirdparty);
|
||||
console.log('get thirdparty', thirdparty);
|
||||
if (this.action !== 'show') {
|
||||
if (thirdparty.address !== null) {
|
||||
// bof! we force getInitialAddress because addressId not available when mounted
|
||||
@ -262,6 +261,9 @@ export default {
|
||||
this.loadData();
|
||||
}
|
||||
if (this.action === 'addContact') {
|
||||
this.$data.thirdparty.kind = 'child'
|
||||
// this.$data.thirdparty.parent = this.parent.id
|
||||
this.$data.thirdparty.address = null
|
||||
this.loadProfessions();
|
||||
this.loadCivilities();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user