add accompanying period where the person is requestor + badge in results

This commit is contained in:
2021-10-01 09:50:13 +02:00
parent f1f13996f9
commit 0d5d4b3f05
6 changed files with 145 additions and 38 deletions

View File

@@ -59,47 +59,51 @@
'customButtons': { 'after': _self.button_person(person) }
}) }}
{#- 'apps' is for AccompanyingPeriodParticipationS #}
{%- set apps = [] %}
{%- for app in person.openedParticipations %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', app.accompanyingPeriod) %}
{%- set apps = apps|merge([app]) %}
{#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %}
{%- for acp in person.accompanyingPeriodInvolved %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
{%- set acps = acps|merge([acp]) %}
{%- endif %}
{%- endfor %}
{% if apps|length > 0 %}
{# add as requestor #}
{% if acps|length > 0 %}
<div class="item-row">
<div class="wrap-list periods-list">
{% for app in apps %}
{% for acp in acps %}
{% set app = person.findParticipationForPeriod(acp) %}
<div class="wl-row separator">
<div class="wl-col title">
<div class="date">
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
{% if acp.requestorPerson == person %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if app != null %}
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
{% endif %}
</div>
{% if app.accompanyingPeriod.user is not null %}
{% if acp.user is not null %}
<div class="user">
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
{{ app.accompanyingPeriod.user|chill_entity_render_box }}
{{ acp.user|chill_entity_render_box }}
</div>
{% endif %}
</div>
<div class="wl-col list">
{% for issue in app.accompanyingPeriod.socialIssues %}
{% for issue in acp.socialIssues %}
{{ issue|chill_entity_render_box }}
{% endfor %}
{# ^^ display all socialIssues, or slice vv
|slice(0,2)
{% if app.accompanyingPeriod.socialIssues|length > 2 %}
<span class="more">{{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }}</span>
{% endif %}
#}
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': app.accompanyingPeriod.id }) }}"
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>