Create 3rd party contact: fix adding civility and profession to payload

This commit is contained in:
nobohan 2022-02-18 14:17:39 +01:00
parent 8c7da5f80c
commit ca6bfea51f
2 changed files with 7 additions and 114 deletions

View File

@ -232,13 +232,18 @@ export default {
"name": data.text,
"isChild": true,
"parent": {"type": "thirdparty", "id": this.parent.id},
"civility": {"id": data.civility},
"profession": {"id": data.profession},
"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}} )
}
} else {
type = this.$refs.castNew.radioType;
data = this.$refs.castNew.castDataByType();

View File

@ -1,112 +0,0 @@
<template>
<div class="container tpartycontainer">
<div class="tparty-identification">
<span class="name">
{{ item.result.text }}&nbsp;
</span>
<span class="location">
<template v-if="hasAddress">
{{ getAddress.text }} -
{{ getAddress.postcode.name }}
</template>
</span>
</div>
<div class="tpartyparent" v-if="hasParent">
<span class="name">
> {{ item.result.parent.text }}
</span>
</div>
</div>
<div class="right_actions">
<badge-entity
:entity="item.result"
:options="{ displayLong: true }">
</badge-entity>
<on-the-fly v-if="item.result.kind === 'company'"
v-bind:parent="item.result"
@saveFormOnTheFly="emitEvent"
action="addContact"
></on-the-fly>
<on-the-fly
type="thirdparty"
v-bind:id="item.result.id"
action="show">
</on-the-fly>
</div>
</template>
<script>
import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
const i18n = {
messages: {
fr: {
thirdparty: {
contact: "Personne physique",
company: "Personne morale",
child: "Personne de contact"
}
}
}
};
export default {
name: 'SuggestionThirdParty',
components: {
OnTheFly,
BadgeEntity
},
props: ['item'],
emits: ['saveFormOnTheFly'],
i18n,
computed: {
hasAddress() {
if (this.$props.item.result.address !== null) {
return true;
}
if (this.$props.item.result.parent !== null) {
this.$props.item.result.parent.address !== null;
}
},
hasParent() {
return this.$props.item.result.parent !== null;
},
getAddress() {
if (this.$props.item.result.address !== null) {
return this.$props.item.result.address;
}
if (this.$props.item.result.parent.address !== null) {
return this.$props.item.result.parent.address;
}
return null;
}
},
methods: {
emitEvent({data, type}) {
this.$emit('saveFormOnTheFly', {type: type, data: data})
}
}
}
</script>
<style lang="scss" scoped>
.tpartycontainer {
.tpartyparent {
.name {
font-weight: bold;
font-variant: all-small-caps;
}
}
.tparty-identification {
span:not(.name) {
margin-left: 0.5em;
opacity: 0.5;
font-size: 90%;
font-style: italic;
}
}
}
</style>