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>
<a v-if="isDisplayBadge" @click="openModal">
<span class="chill-entity" :class="badgeType">
{{ buttonText }}<span v-if="isDead"> ()</span>
</span>
</a>
<a v-else class="btn btn-sm" target="_blank"
<a v-if="isDisplayBadge" @click="openModal">
<span class="chill-entity" :class="badgeType"> hello
{{ buttonText }}<span v-if="isDead"> ()</span>
</span>
</a>
<a v-else class="btn btn-sm" target="_blank"
:class="classAction"
:title="$t(titleAction)"
@click="openModal">
@ -29,10 +29,10 @@
ref="castPerson">
</on-the-fly-person>
<div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
</div>
</template>
@ -44,10 +44,10 @@
ref="castThirdparty">
</on-the-fly-thirdparty>
<div v-if="hasResourceComment">
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
<h3>{{ $t('onthefly.resource_comment_title') }}</h3>
<blockquote class="chill-user-quote">
{{ parent.comment }}
</blockquote>
</div>
</template>
@ -104,12 +104,11 @@ export default {
},
computed: {
hasResourceComment() {
//console.log('hasResourceComment', this.parent);
return (typeof this.parent !== 'undefined' && this.parent !== null)
&& this.action === 'show'
&& this.parent.type === 'accompanying_period_resource'
&& (this.parent.comment !== null && this.parent.comment !== '')
;
return (typeof this.parent !== 'undefined' && this.parent !== null)
&& this.action === 'show'
&& this.parent.type === 'accompanying_period_resource'
&& (this.parent.comment !== null && this.parent.comment !== '')
;
},
classAction() {
switch (this.action) {

View File

@ -34,18 +34,27 @@
<slot name="record-actions"></slot>
</div>
<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">
<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>
</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>
<div v-if="thirdparty.contactDataAnonymous">
<confidential>
@ -96,10 +105,12 @@
import AddressRenderBox from 'ChillMainAssets/vuejs/_components/Entity/AddressRenderBox.vue';
import Confidential from 'ChillMainAssets/vuejs/_components/Confidential.vue';
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
// import OnTheFly from 'ChillMainAssets/vuejs/OnTheFly/components/OnTheFly.vue';
export default {
name: "ThirdPartyRenderBox",
components: {
// OnTheFly,
AddressRenderBox,
Confidential,
BadgeEntity,
@ -124,17 +135,16 @@ export default {
return !(this.thirdparty.parent === null || this.thirdparty.parent === undefined);
},
getProfession() {
let profession = []
if (this.hasParent) {
console.log('im here')
let profession = []
profession.push(this.thirdparty.profession.name.fr)
return profession;
}
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
hasChildren() {