mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
157 lines
5.8 KiB
Twig
157 lines
5.8 KiB
Twig
{% macro href(pathname, key, value) %}
|
|
{% set parms = { (key): value } %}
|
|
{{ path(pathname, parms) }}
|
|
{% endmacro %}
|
|
|
|
{% macro computeWidth(nbBlocks) %}
|
|
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
|
|
{% endmacro %}
|
|
|
|
{% set blocks = [] %}
|
|
{% if entity.activityType.personsVisible %}
|
|
{% if context == 'person' %}
|
|
{% set blocks = blocks|merge([{
|
|
'title': 'Others persons'|trans,
|
|
'items': entity.persons,
|
|
'path' : 'chill_person_view',
|
|
'key' : 'person_id'
|
|
}]) %}
|
|
{% else %}
|
|
{% set blocks = blocks|merge([{
|
|
'title': 'Persons in accompanying course'|trans,
|
|
'items': entity.personsAssociated,
|
|
'path' : 'chill_person_view',
|
|
'key' : 'person_id'
|
|
},{
|
|
'title': 'Third persons'|trans,
|
|
'items': entity.personsNotAssociated,
|
|
'path' : 'chill_person_view',
|
|
'key' : 'person_id',
|
|
}]) %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if entity.activityType.thirdPartiesVisible %}
|
|
{% set blocks = blocks|merge([{
|
|
'title': 'Third parties'|trans,
|
|
'items': entity.thirdParties,
|
|
'path' : 'chill_crud_3party_3party_view',
|
|
'key' : 'id',
|
|
}]) %}
|
|
{% endif %}
|
|
{% if entity.activityType.usersVisible %}
|
|
{% set blocks = blocks|merge([{
|
|
'title': 'Users concerned'|trans,
|
|
'items': entity.users,
|
|
'key' : 'id',
|
|
}]) %}
|
|
{% endif %}
|
|
|
|
{% if (with_display == 'bloc') %}
|
|
<div class="{{ context }} flex-bloc concerned-groups">
|
|
{% for bloc in blocks %}
|
|
|
|
<div class="item-bloc" style="{{ _self.computeWidth(loop.length) }}">
|
|
<div class="item-row">
|
|
<div class="item-col">
|
|
<h4>{{ bloc.title }}</h4>
|
|
</div>
|
|
<div class="item-col">
|
|
<ul class="list-content">
|
|
{% for item in bloc.items %}
|
|
<li>
|
|
{% if bloc.path is defined %}
|
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
</span>
|
|
</a>
|
|
{% else %}
|
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
</span>
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if (with_display == 'row') %}
|
|
<div class="concerned-groups">
|
|
{% for bloc in blocks %}
|
|
<div class="group">
|
|
{% if bloc.items|length > 0 %}
|
|
<h4>{{ bloc.title }}</h4>
|
|
<ul class="list-content">
|
|
{% for item in bloc.items %}
|
|
<li>
|
|
{% if bloc.path is defined %}
|
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
|
<span class="{% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
</span>
|
|
</a>
|
|
{% else %}
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
{% endif %}
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if (with_display == 'wrap-list') %}
|
|
<div class="concerned-groups wrap-list">
|
|
{% for bloc in blocks %}
|
|
<div class="wl-row">
|
|
{% if bloc.items|length > 0 %}
|
|
<div class="wl-col title">
|
|
<h3>{{ bloc.title }}</h3>
|
|
</div>
|
|
<div class="wl-col list">
|
|
{% for item in bloc.items %}
|
|
|
|
<span class="wl-item {% if (badge_person is defined and badge_person == true) %}badge-person{% else %}badge bg-primary{% endif %}">
|
|
{% if bloc.path is defined %}
|
|
<a href="{{ _self.href(bloc.path, bloc.key, item.id) }}">
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
</a>
|
|
{% else %}
|
|
{{ item|chill_entity_render_box({
|
|
'render': 'raw',
|
|
'addAltNames': false
|
|
}) }}
|
|
{% endif %}
|
|
</span>
|
|
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|