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,11 +1,11 @@
<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>
<a v-else class="btn btn-sm" target="_blank" <a v-else class="btn btn-sm" target="_blank"
:class="classAction" :class="classAction"
:title="$t(titleAction)" :title="$t(titleAction)"
@click="openModal"> @click="openModal">
@ -29,10 +29,10 @@
ref="castPerson"> ref="castPerson">
</on-the-fly-person> </on-the-fly-person>
<div v-if="hasResourceComment"> <div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3> <h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote"> <blockquote class="chill-user-quote">
{{ parent.comment }} {{ parent.comment }}
</blockquote> </blockquote>
</div> </div>
</template> </template>
@ -44,10 +44,10 @@
ref="castThirdparty"> ref="castThirdparty">
</on-the-fly-thirdparty> </on-the-fly-thirdparty>
<div v-if="hasResourceComment"> <div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3> <h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote"> <blockquote class="chill-user-quote">
{{ parent.comment }} {{ parent.comment }}
</blockquote> </blockquote>
</div> </div>
</template> </template>
@ -104,12 +104,11 @@ 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' && (this.parent.comment !== null && this.parent.comment !== '')
&& (this.parent.comment !== null && this.parent.comment !== '') ;
;
}, },
classAction() { classAction() {
switch (this.action) { switch (this.action) {

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() {
let profession = []
if (this.hasParent) { if (this.hasParent) {
console.log('im here')
let profession = []
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() {