requestor adapted to use PersonRenderBox or ThirdPartyRenderBox

This commit is contained in:
Julie Lenaerts 2021-08-19 14:47:41 +02:00
parent de7322464b
commit 6ca35d5a18
4 changed files with 51 additions and 27 deletions

View File

@ -10,8 +10,28 @@
{{ $t('requestor.is_anonymous') }}
</label>
<div class="item-bloc">
<h4>
<!-- <div class="flex-bloc row row-cols-1 g-0"> -->
<third-party-renderbox v-if="accompanyingCourse.requestor.type == 'thirdparty'"
:thirdparty="accompanyingCourse.requestor"
:options="{
addLink: false,
addId: false,
addEntity: true,
addInfo: true
}"
></third-party-renderbox>
<person-render-box v-else-if="accompanyingCourse.requestor.type == 'person'"
:person="accompanyingCourse.requestor"
:options="{
addLink: false,
addId: false,
addAltNames: false,
addEntity: true,
addInfo: true
}"
></person-render-box>
<!-- </div> -->
<!-- <h4>
<span class="badge rounded-pill bg-secondary">{{ accompanyingCourse.requestor.type }}</span>
{{ accompanyingCourse.requestor.text }}
</h4>
@ -54,8 +74,8 @@
action="edit">
</on-the-fly>
</li>
</ul>
</div>
</ul> -->
<ul class="record_actions">
<li>
<button class="btn btn-remove"
@ -87,12 +107,16 @@
<script>
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons.vue';
import OnTheFly from 'ChillMainAssets/vuejs/_components/OnTheFly.vue';
import PersonRenderBox from '../../_components/Entity/PersonRenderBox.vue';
import ThirdPartyRenderbox from '../../../../../../ChillThirdPartyBundle/Resources/public/vuejs/_components/ThirdPartyRenderbox.vue';
export default {
name: 'Requestor',
components: {
AddPersons,
OnTheFly
OnTheFly,
PersonRenderBox,
ThirdPartyRenderbox,
},
data() {
return {

View File

@ -26,7 +26,7 @@
addEntity: true,
addInfo: true
}"
:thirdparty="resource"
:thirdparty="resource.resource"
>
<template v-slot:record-actions>
<ul class="record_actions">

View File

@ -1,5 +1,4 @@
<template>
<div class="item-bloc">
<section class="chill-entity entity-person">
<!-- ENTIRE RENDER_BOX -->
@ -70,11 +69,11 @@
</li>
<!-- PHONENUMBER -->
<!-- todo: change href for phonenumbers and format phone number? -->
<li v-if="this.person.mobilenumber">
<li v-if="person.mobilenumber">
<i class="fa fa-li fa-mobile"></i>
<a :href="'tel: ' + person.mobilenumber">{{ person.mobilenumber }}</a>
</li>
<li v-else-if="this.person.phonenumber">
<li v-else-if="person.phonenumber">
<i class="fa fa-li fa-phone"></i>
<a :href="'tel: ' + person.phonenumber">{{ person.phonenumber }}</a>
</li>

View File

@ -1,6 +1,7 @@
<template>
<div class="item-bloc">
<section class="chill-entity entity-person">
<div class="item-bloc col">
<section class="chill-entity entity-thirdparty">
<!-- ENTIRE RENDER_BOX -->
<div class="item-row entity-bloc">
@ -12,15 +13,15 @@
<!-- todo: make h class dynamic -->
<div class="denomination h3">
<span v-if="options.addEntity == true && thirdparty.resource.type == 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
<span v-if="options.addEntity == true && thirdparty.resource.type == 'person'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.person') }}</span>
<span v-if="options.addEntity == true && thirdparty.type == 'thirdparty'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.thirdparty') }}</span>
<span v-if="options.addEntity == true && thirdparty.type == 'person'" class="badge rounded-pill bg-secondary">{{ $t('renderbox.type.person') }}</span>
<!-- NAME IF ADD LINK AND PERMISSION GRANTED -->
<!-- todo: change href -->
<a v-if="this.options.addLink == true" href="#">
<span class="name">{{ thirdparty.resource.text }}</span>
<span class="name">{{ thirdparty.text }}</span>
</a>
<!-- WITHOUT LINK JUST NAME -->
<span class="name">{{ thirdparty.resource.text }}</span>
<span class="name">{{ thirdparty.text }}</span>
<!-- IF ADD ENTITY OPTION -->
@ -32,11 +33,11 @@
<!-- EXTRA INFO -->
<p v-if="this.options.addInfo == true" class="moreinfo">
<!-- todo: change icon if person is deceased? -->
<i :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
<time v-if="thirdparty.resource.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
<i v-if="thirdparty.birthdate" :class="'fa fa-fw ' + getGenderIcon" title="{{ getGender }}"></i>
<time v-if="thirdparty.birthdate" datetime="{{ thirdparty.birthdate.datetime }}" title="{{ birthdate }}">
{{ $t(getGender) + ' ' + $d(birthdate, 'short') }}
</time>
<time v-else-if="thirdparty.resource.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}">
<time v-else-if="thirdparty.deathdate" datetime="{{ thirdparty.deathdate.datetime }}" title="{{ thirdparty.deathdate }}">
{{ birthdate }} - {{ deathdate }}
</time>
<span class="age">{{ thirdparty.age }}</span>
@ -49,20 +50,20 @@
<div class="item-col">
<ul class="list-content fa-ul">
<!-- ADDRESS -->
<li v-if="thirdparty.resource.address" class="chill-entity entity-address">
<li v-if="thirdparty.address" class="chill-entity entity-address">
<i class="fa fa-li fa-map-marker"></i>
<show-address :address="thirdparty.resource.address" :multiline="false"></show-address>
<show-address :address="thirdparty.address" :multiline="false"></show-address>
</li>
<!-- PHONENUMBER -->
<!-- todo: change href for phonenumbers -->
<li>
<i class="fa fa-li fa-mobile"></i>
<a v-if="thirdparty.resource.telephone" :href="'tel: ' + thirdparty.resource.telephone">{{ thirdparty.resource.telephone }}</a>
<a v-if="thirdparty.telephone" :href="'tel: ' + thirdparty.telephone">{{ thirdparty.telephone }}</a>
<span v-else class="chill-no-data-statement">{{ $t('renderbox.no_information') }}</span>
</li>
<li v-if="thirdparty.resource.type == 'thirdparty'">
<li v-if="thirdparty.type == 'thirdparty'">
<i class="fa fa-li fa-envelope-o"></i>
<a v-if="thirdparty.resource.email" :href="'mailto: ' + thirdparty.resource.email">{{ thirdparty.resource.email }}</a>
<a v-if="thirdparty.email" :href="'mailto: ' + thirdparty.email">{{ thirdparty.email }}</a>
<span v-else class="chill-no-data-statement">{{ $t('renderbox.no_information') }}</span>
</li>
@ -92,17 +93,17 @@ export default {
props: ['thirdparty', 'options'],
computed: {
getGender: function() {
return this.thirdparty.resource.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
return this.thirdparty.gender == 'woman' ? 'renderbox.birthday.woman' : 'renderbox.birthday.man';
},
getGenderIcon: function() {
return this.thirdparty.resource.gender == 'woman' ? 'fa-venus' : this.thirdparty.resource.gender == 'man' ? 'fa-mars' : 'fa-neuter';
return this.thirdparty.gender == 'woman' ? 'fa-venus' : this.thirdparty.gender == 'man' ? 'fa-mars' : 'fa-neuter';
},
birthdate: function(){
var date = new Date(this.thirdparty.resource.birthdate.datetime);
var date = new Date(this.thirdparty.birthdate.datetime);
return dateToISO(date);
},
deathdate: function(){
var date = new Date(this.thirdparty.resource.deathdate.datetime);
var date = new Date(this.thirdparty.deathdate.datetime);
return dateToISO(date);
},
}