on-the-fly: add a 'parent' option to pass parent context. So we could now display resource.comment below the renderbox.

This commit is contained in:
2022-01-12 20:26:54 +01:00
parent c9e3960238
commit ecda740d81
7 changed files with 63 additions and 8 deletions

View File

@@ -28,6 +28,12 @@
v-bind:action="action"
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>
</div>
</template>
<template v-slot:body v-else-if="type === 'thirdparty'">
@@ -37,6 +43,12 @@
v-bind:action="action"
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>
</div>
</template>
<template v-slot:body v-else>
@@ -78,18 +90,27 @@ export default {
OnTheFlyThirdparty,
OnTheFlyCreate
},
props: ['type', 'id', 'action', 'buttonText', 'displayBadge'],
props: ['type', 'id', 'action', 'buttonText', 'displayBadge', 'parent'],
emits: ['saveFormOnTheFly'],
data() {
return {
modal: {
showModal: false,
modalDialogClass: "modal-dialog-scrollable modal-xl"
},
//action: this.action
}
}
},
computed: {
hasResourceComment() {
//console.log('hasResourceComment', this.parent);
if (typeof this.parent === 'undefined' || this.parent === null) {
return false;
}
return this.action === 'show'
&& this.parent.type === 'accompanying_period_resource'
&& (this.parent.comment !== null || this.parent.comment !== '')
;
},
classAction() {
switch (this.action) {
case 'show':