diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig index 413080a78..307c462e2 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingPeriod/_list.html.twig @@ -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 ... #}
  • {# {{ 'See this period'|trans }} #}
  • - {% if period.step == 'DRAFT' %} + {% if period.step == 'DRAFT' and contextEntity.type == 'person' %} + {% set person = contextEntity.entity %}
  • {# {{ 'Delete this period'|trans }} #}
  • {% endif %} + {# DISABLED if new accompanying course, this is not necessary {% if person is defined %}
  • @@ -45,7 +52,7 @@ {% for period in accompanying_periods %} {% include 'ChillPersonBundle:AccompanyingPeriod:_list_item.html.twig' with { - 'recordAction': _self.recordAction(period, person) + 'recordAction': _self.recordAction(period, contextEntity) } %} {% endfor %}