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

@@ -22,6 +22,7 @@
</li>
<li>
<on-the-fly
:parent="parent"
:type="resource.resource.type"
:id="resource.resource.id"
action="show">
@@ -29,6 +30,7 @@
</li>
<li>
<on-the-fly
:parent="parent"
:type="resource.resource.type"
:id="resource.resource.id"
action="edit"
@@ -66,6 +68,7 @@
</li>
<li>
<on-the-fly
:parent="parent"
:type="resource.resource.type"
:id="resource.resource.id"
action="show">
@@ -73,6 +76,7 @@
</li>
<li>
<on-the-fly
:parent="parent"
:type="resource.resource.type"
:id="resource.resource.id"
action="edit"
@@ -110,6 +114,17 @@ export default {
props: ['resource'],
emits: ['remove'],
computed: {
parent() {
return {
'type': this.resource.type,
'id': this.resource.id,
'comment': this.resource.comment,
'parent': {
'type': this.$store.state.accompanyingCourse.type,
'id': this.$store.state.accompanyingCourse.id
}
}
},
hasCurrentHouseholdAddress() {
if ( this.resource.resource.current_household_address !== null ) {
return true;

View File

@@ -4,11 +4,12 @@
{{ 'Resume Accompanying Course'|trans }}
{% endblock %}
{% macro insert_onthefly(type, entity) %}
{% macro insert_onthefly(type, entity, parent = null) %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: type, id: entity.id },
buttonText: entity|chill_entity_render_string
buttonText: entity|chill_entity_render_string,
parent: parent
} %}
{% endmacro %}
@@ -106,11 +107,21 @@
<div class="mbloc col col-sm-6 col-lg-4">
<div class="resources">
<h4 class="item-key">{{ 'Resources'|trans }}</h4>
{% for r in accompanyingCourse.resources %}
{% set parent = {
'type': 'accompanying_period_resource',
'id': r.id,
'comment': r.comment,
'parent': {
'type': 'accompanying_period',
'id': accompanyingCourse.id
}
} %}
{% if r.person is not null %}
{{ _self.insert_onthefly('person', r.person) }}
{{ _self.insert_onthefly('person', r.person, parent) }}
{% elseif r.thirdParty is not null %}
{{ _self.insert_onthefly('thirdparty', r.thirdParty) }}
{{ _self.insert_onthefly('thirdparty', r.thirdParty, parent) }}
{% endif %}
{% endfor %}
</div>