mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
concernedGroups.html.twig check if block isVisible, count block and adjust width
This commit is contained in:
parent
ccff346dbb
commit
be71decee5
@ -3,51 +3,54 @@
|
|||||||
{{ path(pathname, parms) }}
|
{{ path(pathname, parms) }}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
{% if context == 'person' %}
|
{% macro computeWidth(nbBlocks) %}
|
||||||
{% set blocs = [
|
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
|
||||||
{ 'title': 'Others persons'|trans,
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% set blocks = [] %}
|
||||||
|
{% if entity.activityType.personsVisible %}
|
||||||
|
{% if context == 'person' %}
|
||||||
|
{% set blocks = blocks|merge([{
|
||||||
|
'title': 'Others persons'|trans,
|
||||||
'items': entity.persons,
|
'items': entity.persons,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id'
|
||||||
},
|
}]) %}
|
||||||
{ 'title': 'Third parties'|trans,
|
{% else %}
|
||||||
'items': entity.thirdParties,
|
{% set blocks = blocks|merge([{
|
||||||
'path' : 'chill_crud_3party_3party_view',
|
'title': 'Persons in accompanying course'|trans,
|
||||||
'key' : 'id'
|
|
||||||
},
|
|
||||||
{ 'title': 'Users concerned'|trans,
|
|
||||||
'items': entity.users,
|
|
||||||
'key' : 'id'
|
|
||||||
},
|
|
||||||
] %}
|
|
||||||
{% else %}
|
|
||||||
{% set blocs = [
|
|
||||||
{ 'title': 'Persons in accompanying course'|trans,
|
|
||||||
'items': entity.personsAssociated,
|
'items': entity.personsAssociated,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id'
|
||||||
},
|
},{
|
||||||
{ 'title': 'Third persons'|trans,
|
'title': 'Third persons'|trans,
|
||||||
'items': entity.personsNotAssociated,
|
'items': entity.personsNotAssociated,
|
||||||
'path' : 'chill_person_view',
|
'path' : 'chill_person_view',
|
||||||
'key' : 'person_id'
|
'key' : 'person_id',
|
||||||
},
|
}]) %}
|
||||||
{ 'title': 'Third parties'|trans,
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% if entity.activityType.thirdPartiesVisible %}
|
||||||
|
{% set blocks = blocks|merge([{
|
||||||
|
'title': 'Third parties'|trans,
|
||||||
'items': entity.thirdParties,
|
'items': entity.thirdParties,
|
||||||
'path' : 'chill_crud_3party_3party_view',
|
'path' : 'chill_crud_3party_3party_view',
|
||||||
'key' : 'id'
|
'key' : 'id',
|
||||||
},
|
}]) %}
|
||||||
{ 'title': 'Users concerned'|trans,
|
{% endif %}
|
||||||
|
{% if entity.activityType.usersVisible %}
|
||||||
|
{% set blocks = blocks|merge([{
|
||||||
|
'title': 'Users concerned'|trans,
|
||||||
'items': entity.users,
|
'items': entity.users,
|
||||||
'key' : 'id'
|
'key' : 'id',
|
||||||
},
|
}]) %}
|
||||||
] %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (with_display == 'bloc') %}
|
{% if (with_display == 'bloc') %}
|
||||||
<div class="{{ context }} flex-bloc concerned-groups">
|
<div class="{{ context }} flex-bloc concerned-groups">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="item-bloc">
|
|
||||||
|
<div class="item-bloc" style="{{ _self.computeWidth(loop.length) }}">
|
||||||
<div class="item-row">
|
<div class="item-row">
|
||||||
<div class="item-col">
|
<div class="item-col">
|
||||||
<h4>{{ bloc.title }}</h4>
|
<h4>{{ bloc.title }}</h4>
|
||||||
@ -79,13 +82,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (with_display == 'row') %}
|
{% if (with_display == 'row') %}
|
||||||
<div class="concerned-groups">
|
<div class="concerned-groups">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="group">
|
<div class="group">
|
||||||
{% if bloc.items|length > 0 %}
|
{% if bloc.items|length > 0 %}
|
||||||
<h4>{{ bloc.title }}</h4>
|
<h4>{{ bloc.title }}</h4>
|
||||||
@ -118,7 +122,7 @@
|
|||||||
|
|
||||||
{% if (with_display == 'wrap-list') %}
|
{% if (with_display == 'wrap-list') %}
|
||||||
<div class="concerned-groups wrap-list">
|
<div class="concerned-groups wrap-list">
|
||||||
{% for bloc in blocs %}
|
{% for bloc in blocks %}
|
||||||
<div class="wl-row">
|
<div class="wl-row">
|
||||||
{% if bloc.items|length > 0 %}
|
{% if bloc.items|length > 0 %}
|
||||||
<div class="wl-col title">
|
<div class="wl-col title">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user