mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
AccompanyingPeriod list: manage context entity variable in record_actions buttons (TO BE CHECKED)
Need to pass context entity in record_actions buttons to use variables like 'person' !
This commit is contained in:
parent
46ca74fc70
commit
42a14fbd6b
@ -1,15 +1,22 @@
|
|||||||
{% macro recordAction(period, person = null) %}
|
{% if person is defined %}
|
||||||
|
{% set contextEntity = { 'type': 'person', 'entity': person } %}{% endif %}
|
||||||
|
{% if household is defined %}
|
||||||
|
{% set contextEntity = { 'type': 'household', 'entity': household } %}{% endif %}
|
||||||
|
|
||||||
|
{% macro recordAction(period, contextEntity) %}
|
||||||
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
|
{# TODO if enable_accompanying_course_with_multiple_persons is true ... #}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
|
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': period.id }) }}"
|
||||||
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
|
class="btn btn-show" title="{{ 'See accompanying period'|trans }}">{# {{ 'See this period'|trans }} #}</a>
|
||||||
</li>
|
</li>
|
||||||
{% if period.step == 'DRAFT' %}
|
{% if period.step == 'DRAFT' and contextEntity.type == 'person' %}
|
||||||
|
{% set person = contextEntity.entity %}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': period.id, 'person_id' : person.id }) }}"
|
<a href="{{ path('chill_person_accompanying_course_delete', { 'accompanying_period_id': period.id, 'person_id' : person.id }) }}"
|
||||||
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
|
class="btn btn-delete" title="{{ 'Delete accompanying period'|trans }}">{# {{ 'Delete this period'|trans }} #}</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# DISABLED if new accompanying course, this is not necessary
|
{# DISABLED if new accompanying course, this is not necessary
|
||||||
{% if person is defined %}
|
{% if person is defined %}
|
||||||
<li>
|
<li>
|
||||||
@ -45,7 +52,7 @@
|
|||||||
{% for period in accompanying_periods %}
|
{% for period in accompanying_periods %}
|
||||||
|
|
||||||
{% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with {
|
{% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with {
|
||||||
'recordAction': _self.recordAction(period, person)
|
'recordAction': _self.recordAction(period, contextEntity)
|
||||||
} %}
|
} %}
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user