concernedGroups display badges as clickable onthefly modal

This commit is contained in:
Mathieu Jaumotte 2021-12-10 12:06:23 +01:00
parent 97165c8389
commit 95caa998e3
2 changed files with 32 additions and 38 deletions

View File

@ -3,6 +3,14 @@
{{ path(pathname, parms) }}
{% endmacro %}
{% macro insert_onthefly(type, entity) %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
action: 'show', displayBadge: true,
targetEntity: { name: type, id: entity.id },
buttonText: entity|chill_entity_render_string
} %}
{% endmacro %}
{% macro computeWidth(nbBlocks) %}
{{ 'flex-basis: ' ~ (100 / nbBlocks)|round(1) ~ '%;' }}
{% endmacro %}
@ -13,6 +21,7 @@
{% set blocks = blocks|merge([{
'title': 'Others persons'|trans,
'items': entity.persons,
'type': 'person',
'path' : 'chill_person_view',
'key' : 'person_id'
}]) %}
@ -20,11 +29,13 @@
{% set blocks = blocks|merge([{
'title': 'Persons in accompanying course'|trans,
'items': entity.personsAssociated,
'type': 'person',
'path' : 'chill_person_view',
'key' : 'person_id'
},{
'title': 'Third persons'|trans,
'items': entity.personsNotAssociated,
'type': 'person',
'path' : 'chill_person_view',
'key' : 'person_id',
}]) %}
@ -34,6 +45,7 @@
{% set blocks = blocks|merge([{
'title': 'Third parties'|trans,
'items': entity.thirdParties,
'type': 'thirdparty',
'path' : 'chill_crud_3party_3party_view',
'key' : 'id',
}]) %}
@ -42,6 +54,7 @@
{% set blocks = blocks|merge([{
'title': 'Users concerned'|trans,
'items': entity.users,
'type': 'user',
'key' : 'id',
}]) %}
{% endif %}
@ -59,22 +72,12 @@
<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
}) }}
{% if bloc.type == 'user' %}
<span class="badge-user">
{{ 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>
{{ _self.insert_onthefly(bloc.type, item) }}
{% endif %}
</li>
{% endfor %}
@ -96,20 +99,12 @@
<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
}) }}
{% if bloc.type == 'user' %}
<span class="badge-user">
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
</span>
</a>
{% else %}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
{{ _self.insert_onthefly(bloc.type, item) }}
{% endif %}
</li>
{% endfor %}
@ -131,19 +126,13 @@
<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>
<span class="wl-item">
{% if bloc.type == 'user' %}
<span class="badge-user">
{{ item|chill_entity_render_box({'render': 'raw', 'addAltNames': false }) }}
</span>
{% else %}
{{ item|chill_entity_render_box({
'render': 'raw',
'addAltNames': false
}) }}
{{ _self.insert_onthefly(bloc.type, item) }}
{% endif %}
</span>

View File

@ -2,6 +2,7 @@
* BADGES PERSON AND THIRDPARTY
*/
span.badge-user,
span.badge-person,
span.badge-thirdparty {
display: inline-block;
@ -16,6 +17,10 @@ span.badge-thirdparty {
text-decoration: none;
}
}
span.badge-user {
border-bottom-width: 1px;
}
span.badge-person {
border-bottom-color: $chill-green;
}