closed periods in accordeon + styling

This commit is contained in:
Julie Lenaerts 2022-04-22 17:49:57 +02:00
parent d757e07dfc
commit 0cbcd91c3f
2 changed files with 165 additions and 156 deletions

View File

@ -30,6 +30,7 @@ div.list-with-period {
// override wrap-list // override wrap-list
div.wrap-list.periods-list { div.wrap-list.periods-list {
padding-right: 1rem;
div.wl-row { div.wl-row {
flex-wrap: nowrap; flex-wrap: nowrap;
div.wl-col { div.wl-col {
@ -63,6 +64,7 @@ div.list-with-period {
} }
div.periods-list { div.periods-list {
padding-right: 1rem;
div.title { div.title {
text-align: right; text-align: right;
div.date {} div.date {}

View File

@ -12,154 +12,153 @@
{% macro accompanying_period(acp, person) %} {% macro accompanying_period(acp, person) %}
{% set app = person.findParticipationForPeriod(acp) %} {% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator"> <div class="item-row separator">
<div class="wrap-list periods-list"> <div class="wrap-list periods-list">
<div class="wl-row">
<div class="wl-col title">
<h3 class="courseid mb-2">
<i class="fa fa-random fa-fw"></i>
{{ 'Course number'|trans }} {{ acp.id }}
</h3>
</div>
<div class="wl-col list">
<div class="d-flex flex-column justify-content-center">
{% if app != null %}
<div class="date">
{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
</div>
{% endif %}
{% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %}
{% if notif_counter.total > 0 %}
{{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }}
{% endif %}
</div>
<div class="ms-auto">
{% if acp.requestoranonymous == false and acp.requestorPerson is same as(person) %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if acp.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if acp.confidential %}
<span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
{% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div>
</div>
</div>
{% if acp.user is not null %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
<h3 class="referrer">{{ 'Referrer'|trans }}</h3> <h3 class="courseid mb-2">
</div> <i class="fa fa-random fa-fw"></i>
<div class="wl-col list"> {{ 'Course number'|trans }} {{ acp.id }}
<div class="user">
{{ acp.user|chill_entity_render_box }}
</div>
</div>
</div>
{% endif %}
{% if acp.socialIssues|length > 0 %}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Social issues'|trans }}</h3>
</div>
<div class="wl-col list">
{% for issue in acp.socialIssues %}
{{ issue|chill_entity_render_box }}
{% endfor %}
</div>
</div>
{% endif %}
{% if acp.currentParticipations|length > 1 %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="participants">
{{ 'Participants'|trans }}
</h3> </h3>
</div> </div>
<div class="wl-col list"> <div class="wl-col list">
{% set participating = false %} <div class="d-flex flex-column justify-content-center">
{% for part in acp.currentParticipations %} {% if app != null %}
{% if part.person.id != person.id %} <div class="date">
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { {{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}
targetEntity: { name: 'person', id: part.person.id }, </div>
action: 'show',
displayBadge: true,
buttonText: part.person|chill_entity_render_string,
isDead: part.person.deathdate is not null
} %}
{% else %}
{% set participating = true %}
{% endif %} {% endif %}
{% endfor %}
{% if participating %} {% set notif_counter = chill_count_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }} {% if notif_counter.total > 0 %}
{% endif %} {{ chill_counter_notifications('Chill\\PersonBundle\\Entity\\AccompanyingPeriod', acp.id) }}
{% endif %}
</div>
<div class="ms-auto">
{% if acp.requestoranonymous == false and acp.requestorPerson is same as(person) %}
<span class="as-requestor badge bg-info" title="{{ 'Requestor'|trans|e('html_attr') }}">
{{ 'Requestor'|trans({'gender': person.gender}) }}
</span>
{% endif %}
{% if acp.emergency %}
<span class="badge rounded-pill bg-danger">{{- 'Emergency'|trans|upper -}}</span>
{% endif %}
{% if acp.confidential %}
<span class="badge rounded-pill bg-confidential">{{- 'Confidential'|trans|upper -}}</span>
{% endif %}
{% if acp.step == 'DRAFT' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.draft'|trans }}">{{ 'course.draft'|trans }}</span>
{% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div>
</div> </div>
</div> </div>
{% endif %}
{% if acp.requestoranonymous == false %} {% if acp.user is not null %}
{% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
<div class="wl-row"> <div class="wl-row">
<div class="wl-col title"> <div class="wl-col title">
<h3> <h3 class="referrer">{{ 'Referrer'|trans }}</h3>
{% if acp.requestorPerson is not null %} </div>
{{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }} <div class="wl-col list">
{% else %} <div class="user">
{{ 'Requestor'|trans({'gender': 'other'})}} {{ acp.user|chill_entity_render_box }}
{% endif %} </div>
</div>
</div>
{% endif %}
{% if acp.socialIssues|length > 0 %}
<div class="wl-row">
<div class="wl-col title">
<h3>{{ 'Social issues'|trans }}</h3>
</div>
<div class="wl-col list">
{% for issue in acp.socialIssues %}
{{ issue|chill_entity_render_box }}
{% endfor %}
</div>
</div>
{% endif %}
{% if acp.currentParticipations|length > 1 %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="participants">
{{ 'Participants'|trans }}
</h3> </h3>
</div> </div>
<div class="wl-col list"> <div class="wl-col list">
{% if acp.requestorThirdParty is not null %} {% set participating = false %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { {% for part in acp.currentParticipations %}
targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id }, {% if part.person.id != person.id %}
action: 'show', {% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
displayBadge: true, targetEntity: { name: 'person', id: part.person.id },
buttonText: acp.requestorThirdParty|chill_entity_render_string action: 'show',
} %} displayBadge: true,
{% else %} buttonText: part.person|chill_entity_render_string,
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with { isDead: part.person.deathdate is not null
targetEntity: { name: 'person', id: acp.requestorPerson.id }, } %}
action: 'show', {% else %}
displayBadge: true, {% set participating = true %}
buttonText: acp.requestorPerson|chill_entity_render_string, {% endif %}
isDead: acp.requestorPerson.deathdate is not null {% endfor %}
} %} {% if participating %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }}
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endif %}
<ul class="record_actions record_actions_column"> {% if acp.requestoranonymous == false %}
<li> {% if (acp.requestorPerson is not null and acp.requestorPerson.id != person.id) or acp.requestorThirdParty is not null %}
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}" <div class="wl-row">
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}"> <div class="wl-col title">
<i class="fa fa-random fa-fw"></i> <h3>
</a> {% if acp.requestorPerson is not null %}
</li> {{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }}
</ul> {% else %}
{{ 'Requestor'|trans({'gender': 'other'})}}
{% endif %}
</h3>
</div>
<div class="wl-col list">
{% if acp.requestorThirdParty is not null %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'thirdparty', id: acp.requestorThirdParty.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorThirdParty|chill_entity_render_string
} %}
{% else %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: acp.requestorPerson.id },
action: 'show',
displayBadge: true,
buttonText: acp.requestorPerson|chill_entity_render_string,
isDead: acp.requestorPerson.deathdate is not null
} %}
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
<ul class="record_actions record_actions_column">
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': acp.id }) }}"
class="btn btn-sm btn-outline-primary" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-random fa-fw"></i>
</a>
</li>
</ul>
</div>
</div> </div>
</div>
{% endmacro %} {% endmacro %}
<div class="list-with-period"> <div class="list-with-period">
@ -218,46 +217,54 @@
{#- 'acps' is for AcCompanyingPeriodS #} {#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %} {%- set acps = [] %}
{%- set acpsClosed = [] %}
{%- for acp in person.accompanyingPeriodInvolved %} {%- for acp in person.accompanyingPeriodInvolved %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %} {%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
{%- set acps = acps|merge([acp]) %} {% if acp.step == 'CLOSED' %}
{%- set acpsClosed = acpsClosed|merge([acp]) %}
{% else %}
{%- set acps = acps|merge([acp]) %}
{% endif %}
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{# add as requestor #} {# add as requestor #}
{% if acps|length > 0 %} {% if acps|length > 0 %}
{% for acp in acps %} {% for acp in acps %}
{% if acp.step == 'CLOSED' %} {{ _self.accompanying_period(acp, person) }}
<div class="accordion" id="member_{{ acp.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ acp.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_{{ acp.id }}"
aria-expanded="false"
aria-controls="collapse_{{ acp.id }}">
<span class="folded">{{ 'Show closed parcours of %name%'|trans({'%name%': person.firstName ~ " " ~ person.lastName }) }} ({{ 'budget.number of elements'|trans({ 'nb_items': 1 }) }})</span>
<span class="unfolded text-secondary">{{ 'Hide closed parcours of %name%'|trans({'%name%': person.firstName ~ " " ~ person.lastName }) }}</span>
</button>
</h2>
<div id="collapse_{{ acp.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_{{ acp.id }}"
data-bs-parent="#nonCurrent">
{{ _self.accompanying_period(acp, person) }}
</div>
</div>
</div>
{% else %}
{{ _self.accompanying_period(acp, person) }}
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if acpsClosed|length > 0 %}
<div class="accordion" id="member_{{ person.id }}">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ person.id }}">
<button
class="accordion-button collapsed"
type="button"
data-bs-toggle="collapse"
data-bs-target="#collapse_{{ person.id }}"
aria-expanded="false"
aria-controls="collapse_{{ person.id }}">
<span class="folded">{{ 'Show closed parcours of %name%'|trans({'%name%': person.firstName ~ " " ~ person.lastName }) }} ({{ 'budget.number of elements'|trans({ 'nb_items': 1 }) }})</span>
<span class="unfolded text-secondary">{{ 'Hide closed parcours of %name%'|trans({'%name%': person.firstName ~ " " ~ person.lastName }) }}</span>
</button>
</h2>
<div id="collapse_{{ person.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_{{ person.id }}"
data-bs-parent="#nonCurrent">
{% for acp in acpsClosed %}
{{ _self.accompanying_period(acp, person) }}
{% endfor %}
</div>
</div>
</div>
{% endif %}
</div> </div>
{% endfor %} {% endfor %}
</div> </div>