Feature: [accompanying-course-work] add new page to show an accompanying-course work

This commit is contained in:
2022-12-14 14:53:24 +01:00
parent 2a9ebe436e
commit f17c08f530
16 changed files with 309 additions and 98 deletions

View File

@@ -1,4 +1,10 @@
<div class="item-bloc{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
{#
# OPTIONS
# - itemBlocClass: [uniq|colored|extended]
# - displayContent: [short|long] default: short
# - displayAction: [true|false] default: false
#}
<div class="item-bloc{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
<div class="item-row">
<h2 class="badge-title">
@@ -15,6 +21,13 @@
<span class="item-key">{{ 'accompanying_course_work.end_date'|trans ~ ' : ' }}</span>
<b>{{ w.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 %}
</ul>
@@ -25,7 +38,7 @@
<div class="item-row separator">
<div class="wrap-list">
{%- if w.persons -%}
{%- if w.persons -%}{# Usagers du parcours #}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Persons in accompanying course'|trans }}</h3>
@@ -45,7 +58,7 @@
</div>
{% endif %}
{%- if w.handlingThierParty -%}
{%- if w.handlingThierParty -%}{# Tiers traitant #}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Thirdparty handling'|trans }}</h3>
@@ -62,23 +75,25 @@
</div>
{% endif %}
{%- if w.referrers -%}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Referrers'|trans }}</h3>
</div>
<div class="wl-col list">
<div class="wl-row">{# Agents traitants #}
<div class="wl-col title">
<h3>{%- if w.referrers|length > 1 -%}{{ 'Referrers'|trans }}{% else %}{{ 'Referrer2'|trans }}{% endif %}</h3>
</div>
<div class="wl-col list">
{%- if w.referrers|length > 0 -%}
{% for u in w.referrers %}
<span class="wl-item">
{{ u|chill_entity_render_box }}
{% if not loop.last %}, {% endif %}
</span>
{% endfor %}
</div>
{% else %}
<span class="chill-no-data-statement">{{ 'No referrer'|trans }}</span>
{% endif %}
</div>
{% endif %}
</div>
{%- if w.socialAction.issue -%}
{%- if w.socialAction.issue -%}{# Problématique sociale #}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Social issue'|trans }}</h3>
@@ -93,62 +108,96 @@
</div>
</div>
<div class="item-row column">
{% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' %}
</div>
<div class="item-row separator">
<div class="item-col item-meta">
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id) %}
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id) }}
{% endif %}
{% import '@ChillPerson/Macro/updatedBy.html.twig' as macro %}
{{ macro.updatedBy(w) }}
{% if displayContent is not defined or displayContent == 'short' %}
<div class="item-row column">
{% include 'ChillPersonBundle:AccompanyingCourseWork:_objectifs_results_evaluations.html.twig' with {
'displayContent': displayContent
} %}
</div>
{% if displayAction is defined and displayAction == true %}
<ul class="item-col record_actions">
{% set suppEvaluations = [] %}
{% for e in w.accompanyingPeriodWorkEvaluations %}
{% set suppEvaluations = suppEvaluations|merge([
{'relatedEntityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation', 'relatedEntityId': e.id }
]) %}
{% for d in e.documents %}
{% set suppEvaluations = suppEvaluations|merge([
{'relatedEntityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', 'relatedEntityId': d.id }
]) %}
{% endfor %}
{% endfor %}
<li>
{{ chill_entity_workflow_list(
'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork',
w.id, [], suppEvaluations) }}
</li>
<li>
<a class="btn btn-show" title="{{ 'Show'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_show', {'id': w.id }) }}"
></a>
</li>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w) %}
{% endif %}
{% if displayContent is not defined or displayContent == 'short' %}
<div class="item-row separator">
{% import '@ChillPerson/AccompanyingCourseWork/_macros.html.twig' as macro %}
<div class="item-col item-meta">
{{ macro.metadata(w) }}
</div>
{% if displayAction is defined and displayAction == true %}
<ul class="item-col record_actions">
<li>{{ macro.workflowButton(w) }}</li>
<li>
<a class="btn btn-edit" title="{{ 'Edit'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}"
<a class="btn btn-show" title="{{ 'Show'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_show', {'id': w.id }) }}"
></a>
</li>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', w) %}
<li>
<a class="btn btn-edit" title="{{ 'Edit'|trans }}"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': w.id }) }}"
></a>
</li>
{% endif %}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE', w) %}
<li>
<a class="btn btn-delete" title="{{ 'Delete'|trans }}"
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': w.id } ) }}"
></a>
</li>
{% endif %}
</ul>
{% endif %}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE', w) %}
<li>
<a class="btn btn-delete" title="{{ 'Delete'|trans }}"
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': w.id } ) }}"
></a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
{% endif %}
</div>
{#
# This is for 'long' version of content
# Note: this include is wrapped in a flex-table container.
# We start by closing the flex-table so we can add more.
# At the end we leave the last flex-table open, as it will be closed in the container.
#}
{% if displayContent is defined and displayContent == 'long' %}
</div>
{% if w.results|length > 0 or w.goals|length > 0 or w.accompanyingPeriodWorkEvaluations|length > 0 %}
<h2 class="chill-blue">{{ 'Dispositifs' }}</h2>
<div class="flex-table">{# new flex-table wrapper #}
<div 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 {
'displayContent': displayContent
} %}
</div>
</div>
{% endif %}
<h2 class="chill-blue">{{ 'Comments'|trans }}</h2>
<div class="flex-table">
<div class="item-bloc no-altern{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
<h3 class="chill-beige">Public</h3>
{% if w.note is not empty %}
<blockquote class="chill-user-quote">
{{ w.note|chill_entity_render_box({'metadata': true }) }}
</blockquote>
{% else %}
<span class="chill-no-data-statement">{{ 'No comment associated'|trans }}</span>
{% endif %}
</div>
{% set userId = app.user.id %}
{% if w.privateComment.comments|length > 0 and w.privateComment.comments[userId] %}
<div class="item-bloc no-altern{% if displayContent is defined %} {{ displayContent }}{% endif %}{% if itemBlocClass is defined %} {{ itemBlocClass }}{% endif %}">
<h3 class="chill-beige">Privé</h3>
<blockquote class="chill-user-quote private-quote">
{{ w.privateComment.comments[userId]|chill_markdown_to_html }}
</blockquote>
</div>
{% endif %}
{# Here flex-table stay open ! read above #}
{% endif %}

View File

@@ -0,0 +1,23 @@
{% macro metadata(w) %}
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id) %}
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id) }}
{% endif %}
{% import '@ChillPerson/Macro/updatedBy.html.twig' as macro %}
{{ macro.updatedBy(w) }}
{% endmacro %}
{% macro workflowButton(w) %}
{% set suppEvaluations = [] %}
{% for e in w.accompanyingPeriodWorkEvaluations %}
{% set suppEvaluations = suppEvaluations|merge([
{'relatedEntityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluation', 'relatedEntityId': e.id }
]) %}
{% for d in e.documents %}
{% set suppEvaluations = suppEvaluations|merge([
{'relatedEntityClass': 'Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWorkEvaluationDocument', 'relatedEntityId': d.id }
]) %}
{% endfor %}
{% endfor %}
{{ chill_entity_workflow_list('Chill\\PersonBundle\\Entity\\AccompanyingPeriod\\AccompanyingPeriodWork', w.id, [], suppEvaluations) }}
{% endmacro %}

View File

@@ -1,6 +1,9 @@
{#
# OPTIONS
# - displayContent: [short|long] default: short
#}
{% if w.results|length > 0 %}
<table class="obj-res-eval my-3">
<table class="obj-res-eval">
<thead>
<th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th>
<th class="res"><h4 class="title_label">{{ 'accompanying_course_work.results'|trans }}</h4></th>
@@ -23,7 +26,7 @@
{% endif %}
{% if w.goals|length > 0 %}
<table class="obj-res-eval my-3">
<table class="obj-res-eval">
<thead>
<th class="obj"><h4 class="title_label">{{ 'accompanying_course_work.goal'|trans }}</h4></th>
<th class="res"><h4 class="title_label">{{ 'accompanying_course_work.results'|trans }}</h4></th>
@@ -54,7 +57,7 @@
{% endif %}
{% if w.accompanyingPeriodWorkEvaluations|length > 0 %}
<table class="obj-res-eval my-3">
<table class="obj-res-eval">
<thead>
<th class="eval">
<h4 class="title_label">{{ 'accompanying_course_work.evaluations'|trans }}</h4>
@@ -72,28 +75,82 @@
<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 %}
</ul>
</li>
</ul>
{% if displayContent is defined and displayContent == 'long' %}
<blockquote class="chill-user-quote">{{ e.comment|chill_entity_render_box }}</blockquote>
{% import "@ChillDocStore/Macro/macro.html.twig" as m %}
{% import "@ChillDocStore/Macro/macro_mimeicon.html.twig" as mm %}
<div class="download mb-4 container">
{% if e.documents|length > 0 %}
{% for d in e.documents %}
<div class="row">
<div class="col text-start">
{{ d.title }}
</div>
<div class="col-md-auto text-center">
{{ mm.mimeIcon(d.storedObject.type) }}
</div>
<div class="col col-lg-4 text-end">
{{ m.download_button_small(d.storedObject, d.title) }}
</div>
</div>
{% endfor %}
{% else %}
<span class="chill-no-data-statement">{{ 'No document found'|trans }}</span>
{% endif %}
</div>
{% endif %}
</td>
</tr>
{% endfor %}

View File

@@ -22,7 +22,11 @@
{% else %}
<div class="flex-table">
{% for w in works %}
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with { 'displayAction': true } %}
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
'displayAction': true,
'displayContent': 'short',
'itemBlocClass': ''
} %}
{% endfor %}
</div>
{% endif %}

View File

@@ -1,15 +1,56 @@
{% extends '@ChillPerson/AccompanyingCourse/layout.html.twig' %}
{% import '@ChillPerson/AccompanyingCourseWork/_macros.html.twig' as macro %}
{% block title 'accompanying_course_work.Show accompanying course work'|trans %}
{% block css %}
{{ parent() }}
{{ encore_entry_link_tags('mod_async_upload') }}
{{ encore_entry_link_tags('mod_entity_workflow_pick') }}
{% endblock %}
{% block js %}
{{ parent() }}
{{ encore_entry_script_tags('mod_async_upload') }}
{{ encore_entry_script_tags('mod_entity_workflow_pick') }}
{% endblock %}
{% block content %}
<div class="accompanying-course-work">
<h1>{{ block('title') }}</h1>
{{ dump() }}
<div class="flex-table mt-4">
{% include '@ChillPerson/AccompanyingCourseWork/_item.html.twig' with {
'w': work,
'displayAction': false,
'displayContent': 'long',
'itemBlocClass': 'uniq extended',
} %}
<div class="p-3 mt-3">{{ macro.metadata(work) }}</div>
</div>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_accompanying_period_work_list', { 'id': accompanyingCourse.id }) }}"
class="btn btn-cancel">{{ 'Back to the list'|trans }}</a>
</li>
<li>{{ macro.workflowButton(work) }}</li>
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_UPDATE', work) %}
<li>
<a class="btn btn-edit"
href="{{ chill_path_add_return_path('chill_person_accompanying_period_work_edit', { 'id': work.id }) }}"
>{{ 'Edit'|trans }}</a>
</li>
{% endif %}
{% if is_granted('CHILL_MAIN_ACCOMPANYING_PERIOD_WORK_DELETE', work) %}
<li>
<a class="btn btn-delete"
href="{{ path('chill_person_accompanying_period_work_delete', { 'id': work.id } ) }}"
>{{ 'Delete'|trans }}</a>
</li>
{% endif %}
</ul>
</div>
{% endblock %}
@@ -17,7 +58,3 @@
{% block block_post_menu %}
<div class="post-menu pt-4"></div>
{% endblock %}
{% block js %}
{{ parent() }}
{% endblock %}