Attempt to add on-the-fly for parent badge

Error: failed to resolve component on-the-fly
This commit is contained in:
Julie Lenaerts 2022-02-23 10:24:01 +01:00
parent cc4dfdb042
commit fffed6e3f6
2 changed files with 41 additions and 32 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<a v-if="isDisplayBadge" @click="openModal"> <a v-if="isDisplayBadge" @click="openModal">
<span class="chill-entity" :class="badgeType"> <span class="chill-entity" :class="badgeType"> hello
{{ buttonText }}<span v-if="isDead"> ()</span> {{ buttonText }}<span v-if="isDead"> ()</span>
</span> </span>
</a> </a>
@ -104,7 +104,6 @@ export default {
}, },
computed: { computed: {
hasResourceComment() { hasResourceComment() {
//console.log('hasResourceComment', this.parent);
return (typeof this.parent !== 'undefined' && this.parent !== null) return (typeof this.parent !== 'undefined' && this.parent !== null)
&& this.action === 'show' && this.action === 'show'
&& this.parent.type === 'accompanying_period_resource' && this.parent.type === 'accompanying_period_resource'

View File

@ -34,18 +34,27 @@
<slot name="record-actions"></slot> <slot name="record-actions"></slot>
</div> </div>
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<li v-if="hasParent">
<i class="fa fa-li fa-hand-o-right"></i>
<b class="me-2">{{ $t('child_of') }}</b>
<span class="chill-entity badge-thirdparty">{{ thirdparty.parent.text }}</span>
</li>
<!-- TODO hasChildren
NB: we cannot call on-the-fly from RenderBox. See error message in previous version of this file.
-->
<li v-if="getProfession.length > 0"> <li v-if="getProfession.length > 0">
<i class="fa fa-li fa-id-card"></i> <i class="fa fa-li fa-id-card"></i>
<p><span v-for="p in getProfession" :key="p" class="list-item">{{ p[0].toUpperCase() + p.slice(1).toLowerCase() }}</span></p> <p><span v-for="p in getProfession" :key="p" class="list-item">{{ p[0].toUpperCase() + p.slice(1).toLowerCase() }}</span></p>
</li> </li>
<li v-if="hasParent">
<i class="fa fa-li fa-hand-o-right"></i>
<b class="me-2">{{ $t('child_of') }}</b>
<!-- <on-the-fly
:type="thirdparty.parent.type"
:id="thirdparty.parent.id"
:buttonText="thirdparty.parent.text"
:displayBadge="'true' === 'true'"
action="show">
</on-the-fly> -->
<span class="chill-entity badge-thirdparty">
{{ thirdparty.parent.text}}
</span>
</li>
<!-- TODO hasChildren
NB: we cannot call on-the-fly from RenderBox. See error message in previous version of this file.
-->
</ul> </ul>
<div v-if="thirdparty.contactDataAnonymous"> <div v-if="thirdparty.contactDataAnonymous">
<confidential> <confidential>
@ -96,10 +105,12 @@
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue'; import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue'; import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue'; import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
// import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
export default { export default {
name: "ThirdPartyRenderBox", name: "ThirdPartyRenderBox",
components: { components: {
// OnTheFly,
AddressRenderBox, AddressRenderBox,
Confidential, Confidential,
BadgeEntity, BadgeEntity,
@ -124,17 +135,16 @@ export default {
return !(this.thirdparty.parent === null || this.thirdparty.parent === undefined); return !(this.thirdparty.parent === null || this.thirdparty.parent === undefined);
}, },
getProfession() { getProfession() {
if (this.hasParent) {
console.log('im here')
let profession = [] let profession = []
if (this.hasParent) {
profession.push(this.thirdparty.profession.name.fr) profession.push(this.thirdparty.profession.name.fr)
return profession; return profession;
} }
if (!this.hasParent && this.thirdparty.category) { if (!this.hasParent && this.thirdparty.category) {
return this.thirdparty.category.map((category) => category.text); profession = this.thirdparty.category.map((category) => category.text);
} }
return profession;
} }
/* TODO need backend normalizer to serve children without circular reference /* TODO need backend normalizer to serve children without circular reference
hasChildren() { hasChildren() {