residential address: show residential address or info in PersonRenderBox + add ThirdPartyText

This commit is contained in:
nobohan 2022-02-17 18:05:34 +01:00
parent baf9b6e1ae
commit 6e1b95aa60
5 changed files with 84 additions and 14 deletions

View File

@ -69,7 +69,8 @@ const messages = {
},
holder: "Titulaire",
years_old: "an | {n} an | {n} ans",
residential_address: "Adresse de résidence",
located_at: "réside chez"
}
}
};

View File

@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\PersonBundle\Repository\ResidentialAddressRepository;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Component\Serializer\Annotation\Groups;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
@ -28,6 +29,7 @@ class ResidentialAddress
/**
* @ORM\ManyToOne(targetEntity=Address::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
*/
private ?Address $address = null;
@ -38,18 +40,21 @@ class ResidentialAddress
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
* @Groups({"read"})
*/
private ?DateTimeImmutable $endDate = null;
/**
* @ORM\ManyToOne(targetEntity=Person::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
*/
private ?Person $hostPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
*/
private ?ThirdParty $hostThirdParty = null;
@ -68,6 +73,7 @@ class ResidentialAddress
/**
* @ORM\Column(type="datetime_immutable")
* @Groups({"read"})
*/
private ?DateTimeImmutable $startDate = null;

View File

@ -117,18 +117,50 @@
</div>
</div>
<div class="item-col">
<div class="item-col mx-3">
<div class="float-button bottom">
<div class="box">
<ul class="list-content fa-ul">
<li v-if="person.current_residential_address">
<i class="fa fa-li fa-map-marker"></i>
<div v-if="person.current_residential_address.address">
<address-render-box
:address="person.current_residential_address.address"
:isMultiline="isMultiline">
</address-render-box>
<p>({{ $t('renderbox.residential_address') }})</p>
</div>
<div v-else-if="person.current_residential_address.hostPerson" class="mt-3">
<p>{{ $t('renderbox.located_at') }}:</p>
<span class="chill-entity entity-person badge-person">
<person-text
v-if="person.current_residential_address.hostPerson"
:person="person.current_residential_address.hostPerson"
></person-text>
</span>
<address-render-box v-if="person.current_residential_address.hostPerson.address"
:address="person.current_residential_address.hostPerson.address"
:isMultiline="isMultiline">
</address-render-box>
</div>
<div v-else-if="person.current_residential_address.hostThirdParty" class="mt-3">
<p>{{ $t('renderbox.located_at') }}:</p>
<span class="chill-entity entity-person badge-thirdparty">
<third-party-text
v-if="person.current_residential_address.hostThirdParty"
:thirdparty="person.current_residential_address.hostThirdParty"
></third-party-text>
</span>
<address-render-box v-if="person.current_residential_address.hostThirdParty.address"
:address="person.current_residential_address.hostThirdParty.address"
:isMultiline="isMultiline">
</address-render-box>
</div>
<ul class="list-content fa-ul">
<li v-if="person.current_residential_address">
ICI l'adresse de résidence, if any
<i class="fa fa-li fa-map-marker"></i>
<address-render-box v-if="person.current_residential_address"
:address="person.current_residential_address"
:isMultiline="isMultiline">
</address-render-box>
</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
@ -162,6 +194,7 @@ import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRe
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
import PersonText from 'ChillPersonAssets/vuejs/_components/Entity/PersonText.vue';
import ThirdPartyText from 'ChillThirdPartyAssets/vuejs/_components/Entity/ThirdPartyText.vue';
export default {
name: "PersonRenderBox",
@ -169,7 +202,8 @@ export default {
AddressRenderBox,
Confidential,
BadgeEntity,
PersonText
PersonText,
ThirdPartyText
},
props: ['person', 'options', 'render', 'returnPath'],
computed: {

View File

@ -62,7 +62,7 @@
<li>
<i class="fa fa-li fa-home"></i>
<span class="item-key">{{ "Address of"|trans}}</span>
<span class="chill-entity entity-person badge-person">{{ a.hostThirdParty|chill_entity_render_box }}</span>
<span class="chill-entity entity-person badge-thirdparty">{{ a.hostThirdParty|chill_entity_render_box }}</span>
</li>
<li>
{% if a.hostThirdParty.address is not null %}

View File

@ -0,0 +1,29 @@
<template>
<span v-if="isCut">{{ cutText }}</span>
<span v-else class="thirdparty-text">
<span class="firstname">{{ thirdparty.text }}</span>
</span>
</template>
<script>
export default {
name: "ThirdPartyText",
props: {
thirdparty: {
required: true,
},
isCut: {
type: Boolean,
required: false,
default: false
},
},
computed: {
cutText: function() {
let more = (this.thirdparty.text.length > 15) ?'…' : '';
return this.thirdparty.text.slice(0,15) + more;
}
}
}
</script>