Resolve "Afficher les noms des usagers et l'entité concerné par l'entité notifiée dans la liste des notifications"

This commit is contained in:
2025-01-23 11:34:16 +00:00
committed by Julien Fastré
parent 9e191f1b5b
commit 9a5fd67842
28 changed files with 267 additions and 33 deletions

View File

@@ -10,6 +10,19 @@ div.notification {
margin-right: 0.3em;
}
}
h4.notification-subtitle {
margin: 0.5rem 0;
}
ul.notification-related-entities {
margin: 0.5rem 0;
list-style: none;
padding: 0;
& > li {
display: inline-block;
}
}
div.read {
h2.notification-title,
h6.notification-title {
@@ -52,7 +65,7 @@ div.notification-show {
li {
span.item-key {
display: inline-block;
width: 3em;
padding: 0.1em 0.3rem;
}
}
}
@@ -97,4 +110,4 @@ span.counter {
padding: 0 0.4rem;
border-radius: 50%;
}
}
}

View File

@@ -11,21 +11,59 @@
</h2>
</div>
{% endmacro %}
{% macro insert_onthefly(type, entity, parent = null) %}
{% 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,
isDead: entity.deathdate is defined and entity.deathdate is not null,
parent: parent
} %}
{% endmacro %}
{% macro relatedEntity(c) %}
{% if c.data is defined %}
{% set notification = c.data.notification %}
{% set handler = c.data.handler %}
<div class="item-row">
<h4 class="notification-subtitle">
<span>{{ handler.getTitle(notification)|trans }}</span>
</h4>
</div>
{% set associateds = handler.getAssociatedPersons(notification) %}
{% if associateds|length > 0 %}
<div class="item-row">
<ul class="notification-related-entities">
{% for ap in associateds %}
<li>
{% if ap.person is defined %}
{{ _self.insert_onthefly('person', ap.person) }}
{% else %}
{{ _self.insert_onthefly('person', ap) }}
{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endif %}
{% endmacro %}
{% macro header(c) %}
<div class="item-row notification-header mt-2">
<div class="item-col">
<ul class="small_in_title">
{% if c.step is not defined or c.step == 'inbox' %}
<li class="notification-from">
<span class="item-key">
<abbr title="{{ 'notification.received_from' | trans }}">
{{ "notification.from" | trans }} :
</abbr>
</span>
<span class="item-key">
<abbr title="{{ 'notification.received_from' | trans }}">
{{ "notification.from" | trans }} :
</abbr>
</span>
{% if not c.notification.isSystem %}
<span class="badge-user">
{{ c.notification.sender | chill_entity_render_string({'at_date': c.notification.date}) }}
</span>
{{ c.notification.sender | chill_entity_render_string({'at_date': c.notification.date}) }}
</span>
{% else %}
<span class="badge-user system">{{ "notification.is_system" | trans }}</span>
{% endif %}
@@ -185,6 +223,7 @@
>
{{ _self.title(_context) }}
</button>
{{ _self.relatedEntity(_context) }}
{{ _self.header(_context) }}
</div>
<div
@@ -198,6 +237,7 @@
{{ _self.actions(_context) }}
{% else %}
{{ _self.title(_context) }}
{{ _self.relatedEntity(_context) }}
{{ _self.header(_context) }}
{{ _self.content(_context) }}
{{ _self.actions(_context) }}

View File

@@ -23,7 +23,9 @@
{% include '@ChillMain/Notification/_list_item.html.twig' with {
'data': {
'template': handler.getTemplate(notification),
'template_data': handler.getTemplateData(notification)
'template_data': handler.getTemplateData(notification),
'handler': handler,
'notification': notification
},
'action_button': false,
'full_content': true,

View File

@@ -11,5 +11,5 @@
}) %}
</div>
{% else %}
<h2>{{ 'workflow.deleted_title'|trans }}</h2>
<h2>{{ 'workflow.deleted'|trans }}</h2>
{% endif %}