mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
possible to add a contact to a thirdparty
This commit is contained in:
parent
724ce8c9af
commit
4431428c26
@ -212,10 +212,22 @@ export default {
|
|||||||
type = 'thirdparty'
|
type = 'thirdparty'
|
||||||
data = this.$refs.castThirdparty.$data.thirdparty;
|
data = this.$refs.castThirdparty.$data.thirdparty;
|
||||||
// create the new contact here, bypassing saveFormOnTheFly() -> not working here?
|
// create the new contact here, bypassing saveFormOnTheFly() -> not working here?
|
||||||
console.log('addContact data', data)
|
const body = {
|
||||||
postThirdparty(data)
|
"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) => {
|
.then(thirdparty => new Promise((resolve, reject) => {
|
||||||
this.newPriorSuggestion(thirdparty);
|
// this.newPriorSuggestion(thirdparty);
|
||||||
|
console.log('thirdparty created', thirdparty)
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
} else {
|
} else {
|
||||||
@ -229,7 +241,9 @@ export default {
|
|||||||
}
|
}
|
||||||
// console.log('type', type, 'data', data)
|
// console.log('type', type, 'data', data)
|
||||||
// pass datas to parent
|
// pass datas to parent
|
||||||
|
if (this.action != 'addContact') {
|
||||||
this.$emit('saveFormOnTheFly', { type: type, data: data });
|
this.$emit('saveFormOnTheFly', { type: type, data: data });
|
||||||
|
}
|
||||||
|
|
||||||
this.modal.showModal = false;
|
this.modal.showModal = false;
|
||||||
},
|
},
|
||||||
|
@ -126,7 +126,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @var Civility
|
* @var Civility
|
||||||
* @ORM\ManyToOne(targetEntity=Civility::class)
|
* @ORM\ManyToOne(targetEntity=Civility::class)
|
||||||
* ORM\JoinColumn(name="civility", referencedColumnName="id", nullable=true)
|
* 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"})
|
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?Civility $civility = null;
|
private ?Civility $civility = null;
|
||||||
@ -199,7 +199,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
*
|
*
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty", inversedBy="children")
|
||||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
|
* @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"})
|
* @Context(normalizationContext={"groups": "docgen:read:3party:parent"}, groups={"docgen:read"})
|
||||||
*/
|
*/
|
||||||
private ?ThirdParty $parent = null;
|
private ?ThirdParty $parent = null;
|
||||||
@ -210,7 +210,7 @@ class ThirdParty implements TrackCreationInterface, TrackUpdateInterface
|
|||||||
* @var ThirdPartyProfession
|
* @var ThirdPartyProfession
|
||||||
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
* @ORM\ManyToOne(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdPartyProfession")
|
||||||
* ORM\JoinColumn(name="profession", referencedColumnName="id", nullable=true)
|
* 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"})
|
* @Context(normalizationContext={"groups": "docgen:read"}, groups={"docgen:read:3party:parent"})
|
||||||
*/
|
*/
|
||||||
private ?ThirdPartyProfession $profession = null;
|
private ?ThirdPartyProfession $profession = null;
|
||||||
|
@ -31,7 +31,7 @@ class ThirdPartyProfession
|
|||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue
|
* @ORM\GeneratedValue
|
||||||
* @ORM\Column(type="integer")
|
* @ORM\Column(type="integer")
|
||||||
* @Serializer\Groups({"docgen:read", "read"})
|
* @Serializer\Groups({"docgen:read", "read", "write"})
|
||||||
*/
|
*/
|
||||||
private ?int $id = null;
|
private ?int $id = null;
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<!-- <p>Contact de :</p> -->
|
|
||||||
<third-party-render-box
|
<third-party-render-box
|
||||||
:thirdparty="thirdparty"
|
:thirdparty="thirdparty"
|
||||||
:options="{
|
:options="{
|
||||||
@ -66,12 +65,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="parent">
|
<div v-if="parent">
|
||||||
<!-- <div class="input-group mb-3">
|
|
||||||
<input type="hidden" name="parent_id" v-model="thirdparty.parent" :value="parent.id" />
|
|
||||||
</div> -->
|
|
||||||
<div id="child-info">
|
<div id="child-info">
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<!-- <span class="input-group-text" id="comment"><i class="fa fa-fw fa-briefcase"></i></span> -->
|
|
||||||
<select class="form-select form-select-lg" id="profession"
|
<select class="form-select form-select-lg" id="profession"
|
||||||
v-model="thirdparty.civility">
|
v-model="thirdparty.civility">
|
||||||
<option selected disabled >{{ $t('thirdparty.civility') }}</option>
|
<option selected disabled >{{ $t('thirdparty.civility') }}</option>
|
||||||
@ -79,7 +74,6 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group mb-3">
|
<div class="input-group mb-3">
|
||||||
<!-- <span class="input-group-text" id="comment"><i class="fa fa-fw fa-user-circle-o"></i></span> -->
|
|
||||||
<select class="form-select form-select-lg" id="civility"
|
<select class="form-select form-select-lg" id="civility"
|
||||||
v-model="thirdparty.profession">
|
v-model="thirdparty.profession">
|
||||||
<option selected disabled >{{ $t('thirdparty.profession') }}</option>
|
<option selected disabled >{{ $t('thirdparty.profession') }}</option>
|
||||||
@ -230,7 +224,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
// this.$toast.open({message: error.body})
|
this.$toast.open({message: error.body})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
loadProfessions() {
|
loadProfessions() {
|
||||||
@ -241,7 +235,7 @@ export default {
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
// this.$toast.open({message: error.body})
|
this.$toast.open({message: error.body})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
submitAddress(payload) {
|
submitAddress(payload) {
|
||||||
|
@ -45,6 +45,7 @@ class ThirdPartyNormalizer implements NormalizerAwareInterface, NormalizerInterf
|
|||||||
'isChild' => $thirdParty->isChild(),
|
'isChild' => $thirdParty->isChild(),
|
||||||
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
'parent' => $this->normalizer->normalize($thirdParty->getParent(), $format, $context),
|
||||||
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
'civility' => $this->normalizer->normalize($thirdParty->getCivility(), $format, $context),
|
||||||
|
'profession' => $this->normalizer->normalize($thirdParty->getProfession(), $format, $context),
|
||||||
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
'contactDataAnonymous' => $thirdParty->isContactDataAnonymous(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user