button added to add contact to personne morale (styling not correct yet) + opening of onTheFly thirdparty, but conditions and parameters not yet correct

This commit is contained in:
Julie Lenaerts 2022-01-12 17:38:24 +01:00
parent f2221565c5
commit 89edf508f5
3 changed files with 118 additions and 86 deletions

View File

@ -51,6 +51,16 @@
</div>
</template>
<template v-slot:body v-else-if="action === 'addContact'">
<on-the-fly-thirdparty
:parent="parent"
type="thirdparty"
action="create"
kind="child"
ref="castThirdparty">
</on-the-fly-thirdparty>
</template>
<template v-slot:body v-else>
<on-the-fly-create
:action="action"
@ -117,6 +127,8 @@ export default {
return 'btn-update';
case 'create':
return 'btn-create';
case 'addContact':
return 'btn-create';
}
},
titleAction() {

View File

@ -6,8 +6,8 @@
</span>
<span class="location">
<template v-if="hasAddress">
{{ getAddress.text }} -
{{ getAddress.postcode.name }}
{{ getAddress.text }} -
{{ getAddress.postcode.name }}
</template>
</span>
</div>
@ -19,15 +19,20 @@
</div>
<div class="right_actions">
<badge-entity
:entity="item.result"
:options="{ displayLong: true }">
</badge-entity>
<on-the-fly
type="thirdparty"
v-bind:id="item.result.id"
action="show">
</on-the-fly>
<badge-entity
:entity="item.result"
:options="{ displayLong: true }">
</badge-entity>
<on-the-fly
type="thirdparty"
action="create"
:parent="item.result"
></on-the-fly>
<on-the-fly
type="thirdparty"
v-bind:id="item.result.id"
action="show">
</on-the-fly>
</div>
</template>
@ -48,36 +53,36 @@ const i18n = {
};
export default {
name: 'SuggestionThirdParty',
components: {
OnTheFly,
BadgeEntity
},
props: ['item'],
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;
}
name: 'SuggestionThirdParty',
components: {
OnTheFly,
BadgeEntity
},
props: ['item'],
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;
}
}
return null;
}
}
}
</script>

View File

@ -20,58 +20,73 @@
</div>
</div>
<div v-else-if="action === 'edit' || action === 'create'">
<div class="form-floating mb-3" v-if="thirdparty.kind !== 'child'">
<div class="form-check">
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
<label for="tpartyKindInstitution" class="required">
<badge-entity
:entity="{ type: 'thirdparty', kind: 'company' }"
:options="{ displayLong: true }">
</badge-entity>
</label>
</div>
<div class="form-check">
<input class="form-check-input mt-0" type="radio" v-model="kind" value="contact" id="tpartyKindContact">
<label for="tpartyKindContact" class="required">
<badge-entity
:entity="{ type: 'thirdparty', kind: 'contact' }"
:options="{ displayLong: true }">
</badge-entity>
</label>
</div>
</div>
<div v-else>
<p>Contact de&nbsp;:</p>
<third-party-render-box :thirdparty="thirdparty.parent"
:options="{
addInfo: true,
addEntity: false,
addAltNames: true,
addId: false,
addLink: false,
addAge: false,
hLevel: 4,
addCenter: false,
addNoData: true,
isMultiline: false
{{ action }}
<div class="form-floating mb-3" v-if="thirdparty.kind !== 'child'">
<div class="form-check">
<input class="form-check-input mt-0" type="radio" v-model="kind" value="company" id="tpartyKindInstitution">
<label for="tpartyKindInstitution" class="required">
<badge-entity
:entity="{ type: 'thirdparty', kind: 'company' }"
:options="{ displayLong: true }">
</badge-entity>
</label>
</div>
<div class="form-check">
<input class="form-check-input mt-0" type="radio" v-model="kind" value="contact" id="tpartyKindContact">
<label for="tpartyKindContact" class="required">
<badge-entity
:entity="{ type: 'thirdparty', kind: 'contact' }"
:options="{ displayLong: true }">
</badge-entity>
</label>
</div>
</div>
<div v-else>
<p>Contact de&nbsp;:</p>
<third-party-render-box v-if="thirdparty.parent"
:thirdparty="thirdparty.parent"
:options="{
addInfo: true,
addEntity: false,
addAltNames: true,
addId: false,
addLink: false,
addAge: false,
hLevel: 4,
addCenter: false,
addNoData: true,
isMultiline: false
}"></third-party-render-box>
<third-party-render-box v-else
:thirdparty="parent"
:options="{
addInfo: true,
addEntity: false,
addAltNames: true,
addId: false,
addLink: false,
addAge: false,
hLevel: 4,
addCenter: false,
addNoData: true,
isMultiline: false
}"></third-party-render-box>
</div>
</div>
<div class="form-floating mb-3">
<input class="form-control form-control-lg" id="name" v-model="thirdparty.text" v-bind:placeholder="$t('thirdparty.name')" />
<label for="name">{{ $t('thirdparty.name') }}</label>
</div>
<template
v-if="thirdparty.kind !== 'child'">
<add-address
key="thirdparty"
:context="context"
:options="addAddress.options"
:address-changed-callback="submitAddress"
ref="addAddress">
</add-address>
</template>
<template
v-if="thirdparty.kind !== 'child'">
<add-address
key="thirdparty"
:context="context"
:options="addAddress.options"
:address-changed-callback="submitAddress"
ref="addAddress">
</add-address>
</template>
<div class="input-group mb-3">
<span class="input-group-text" id="email"><i class="fa fa-fw fa-envelope"></i></span>