[Fix] Case where two evaluation showed in the same time in notification

This commit is contained in:
Lucas Silva 2023-04-27 15:00:26 +02:00
parent 0a2f41c8a0
commit 71e8e2baee
3 changed files with 150 additions and 47 deletions

View File

@ -115,7 +115,8 @@
<div <div
class="item-row column{% if displayFontSmall is defined and displayFontSmall == true %} smallfont{% endif %}"> class="item-row column{% if displayFontSmall is defined and displayFontSmall == true %} smallfont{% endif %}">
{% include '@ChillPerson/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig' with { {% include '@ChillPerson/AccompanyingCourseWork/_objectifs_results_evaluations.html.twig' with {
'displayContent': displayContent 'displayContent': displayContent,
'onlyone': false
} %} } %}
</div> </div>
{% endif %} {% endif %}
@ -195,7 +196,8 @@
<div <div
class="item-bloc colored{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}"> class="item-bloc colored{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
{% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with { {% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with {
'displayContent': displayContent 'displayContent': displayContent,
'onlyone' : false
} %} } %}
</div> </div>
</div> </div>

View File

@ -3,6 +3,7 @@
# - displayContent: [short|long] default: short # - displayContent: [short|long] default: short
#} #}
{% if w.results|length > 0 %} {% if w.results|length > 0 %}
<table class="obj-res-eval"> <table class="obj-res-eval">
<thead> <thead>
<th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th> <th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th>
@ -64,9 +65,11 @@
</th> </th>
</thead> </thead>
<tbody> <tbody>
{% for e in w.accompanyingPeriodWorkEvaluations %} {% if onlyone %}
<tr> {% for e in w.accompanyingPeriodWorkEvaluations %}
<td class="eval"> {% if evalId is defined and evalId == e.id %}
<tr>
<td class="eval">
<ul class="eval_title"> <ul class="eval_title">
<li> <li>
{{ e.evaluation.title|localize_translatable_string }} {{ e.evaluation.title|localize_translatable_string }}
@ -78,13 +81,15 @@
{% if e.endDate %} {% if e.endDate %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<b>{{ e.endDate|format_date('short') }}</b> <b>{{ e.endDate|format_date('short') }}</b>
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -92,13 +97,15 @@
{% if e.maxDate %} {% if e.maxDate %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<b>{{ e.maxDate|format_date('short') }}</b> <b>{{ e.maxDate|format_date('short') }}</b>
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -107,13 +114,15 @@
{% if e.warningInterval and e.warningInterval.d > 0 %} {% if e.warningInterval and e.warningInterval.d > 0 %}
<li> <li>
{% set days = (e.warningInterval.d + e.warningInterval.m * 30) %} {% set days = (e.warningInterval.d + e.warningInterval.m * 30) %}
<span class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
{{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }} {{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }}
</li> </li>
{% else %} {% else %}
{% if displayContent is defined and displayContent == 'long' %} {% if displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
@ -122,55 +131,145 @@
{% if e.timeSpent is not null and e.timeSpent > 0 %} {% if e.timeSpent is not null and e.timeSpent > 0 %}
<li> <li>
{% set minutes = (e.timeSpent / 60) %} {% set minutes = (e.timeSpent / 60) %}
<span class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }} <span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }}
</li> </li>
{% elseif displayContent is defined and displayContent == 'long' %} {% elseif displayContent is defined and displayContent == 'long' %}
<li> <li>
<span class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> <span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span> <span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</li> </li>
</ul> </ul>
{% if recordAction is defined %} {% endif %}
{{ recordAction }}
{% endif %}
{% if displayContent is defined and displayContent == 'long' %}
{% if e.comment is not empty %} {% endfor %}
<blockquote class="chill-user-quote">{{ e.comment|chill_entity_render_box }}</blockquote> {% if recordAction is defined %}
{{ recordAction }}
{% endif %}
{% else %}
{% for e in w.accompanyingPeriodWorkEvaluations %}
<tr>
<td class="eval">
<ul class="eval_title">
<li>
{{ e.evaluation.title|localize_translatable_string }}
<ul class="columns">
<li>
<span
class="item-key">{{ 'accompanying_course_work.start_date'|trans ~ ' : ' }}</span>
<b>{{ e.startDate|format_date('short') }}</b>
</li>
{% if e.endDate %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<b>{{ e.endDate|format_date('short') }}</b>
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% if e.maxDate %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<b>{{ e.maxDate|format_date('short') }}</b>
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.max_date'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% if e.warningInterval and e.warningInterval.d > 0 %}
<li>
{% set days = (e.warningInterval.d + e.warningInterval.m * 30) %}
<span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
{{ 'accompanying_course_work.%days% days before max_date'|trans({'%days%': days }) }}
</li>
{% else %}
{% if displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.warning_interval'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
{% endif %}
{% if e.timeSpent is not null and e.timeSpent > 0 %}
<li>
{% set minutes = (e.timeSpent / 60) %}
<span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span> {{ 'duration.minute'|trans({ '{m}' : minutes }) }}
</li>
{% elseif displayContent is defined and displayContent == 'long' %}
<li>
<span
class="item-key">{{ 'accompanying_course_work.timeSpent'|trans ~ ' : ' }}</span>
<span class="chill-no-data-statement">{{ 'Not given'|trans }}</span>
</li>
{% endif %}
</ul>
</li>
</ul>
{% if recordAction is defined %}
{{ recordAction }}
{% endif %} {% endif %}
{% import "@ChillDocStore/Macro/macro.html.twig" as m %} {% if displayContent is defined and displayContent == 'long' %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
{% if e.documents|length > 0 %} {% if e.comment is not empty %}
<table class="table table-hover align-middle mt-4 mx-auto"> <blockquote
{% for d in e.documents %} class="chill-user-quote">{{ e.comment|chill_entity_render_box }}</blockquote>
<tr> {% endif %}
<td class="border-0">{{ d.title }}</td>
<td class="border-0">{{ mm.mimeIcon(d.storedObject.type) }}</td> {% import "@ChillDocStore/Macro/macro.html.twig" as m %}
<td class="border-0 text-end"> {% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
<a class="btn btn-notify btn-sm" {% if e.documents|length > 0 %}
title="{{ 'notification.Notify'|trans }}" <table class="table table-hover align-middle mt-4 mx-auto">
href="{{ chill_path_add_return_path('chill_main_notification_create', { {% for d in e.documents %}
'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', 'entityId': d.id <tr>
}) }}"></a> <td class="border-0">{{ d.title }}</td>
{{ d.storedObject|chill_document_button_group(d.title, is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w), {'small': true}) }} <td class="border-0">{{ mm.mimeIcon(d.storedObject.type) }}</td>
</td> <td class="border-0 text-end">
</tr> <a class="btn btn-notify btn-sm"
{% endfor %} title="{{ 'notification.Notify'|trans }}"
</table> href="{{ chill_path_add_return_path('chill_main_notification_create', {
{% else %} 'entityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', 'entityId': d.id
<span class="chill-no-data-statement">{{ 'No document found'|trans }}</span> }) }}"></a>
{{ d.storedObject|chill_document_button_group(d.title, is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w), {'small': true}) }}
</td>
</tr>
{% endfor %}
</table>
{% else %}
<span class="chill-no-data-statement">{{ 'No document found'|trans }}</span>
{% endif %}
{% endif %} {% endif %}
</td>
</tr>
{% endif %} {% endfor %}
</td> {% endif %}
</tr>
{% endfor %}
</tbody> </tbody>
</table> </table>
{% endif %} {% endif %}

View File

@ -23,7 +23,9 @@
'w': document.accompanyingPeriodWorkEvaluation.accompanyingPeriodWork, 'w': document.accompanyingPeriodWorkEvaluation.accompanyingPeriodWork,
'd': document.storedObject, 'd': document.storedObject,
'displayContent': 'short', 'displayContent': 'short',
'recordAction': _self.recordAction(document) 'recordAction': _self.recordAction(document),
'onlyone' : true,
'evalId': document.accompanyingPeriodWorkEvaluation.id
} %} } %}
</div> </div>