macro added + closed parcours displayed in accordeon

This commit is contained in:
Julie Lenaerts 2022-04-21 22:06:22 +02:00
parent 83dd8f810c
commit d757e07dfc
2 changed files with 187 additions and 144 deletions

View File

@ -288,3 +288,15 @@ div#dashboards {
}
}
}
// accordeon person search result - closed parcours
.accordion-item {
margin-bottom: 1rem;
}
button[aria-expanded="true"] > span.folded,
button[aria-expanded="false"] > span.unfolded { display: none; }
button[aria-expanded="false"] > span.folded,
button[aria-expanded="true"] > span.unfolded { display: inline; }

View File

@ -10,6 +10,158 @@
</li>
{% endmacro %}
{% macro accompanying_period(acp, person) %}
{% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator">
<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-col title">
<h3 class="referrer">{{ 'Referrer'|trans }}</h3>
</div>
<div class="wl-col list">
<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>
</div>
<div class="wl-col list">
{% set participating = false %}
{% for part in acp.currentParticipations %}
{% if part.person.id != person.id %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: part.person.id },
action: 'show',
displayBadge: true,
buttonText: part.person|chill_entity_render_string,
isDead: part.person.deathdate is not null
} %}
{% else %}
{% set participating = true %}
{% endif %}
{% endfor %}
{% if participating %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }}
{% endif %}
</div>
</div>
{% endif %}
{% if acp.requestoranonymous == false %}
{% 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-col title">
<h3>
{% if acp.requestorPerson is not null %}
{{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }}
{% 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>
{% endmacro %}
<div class="list-with-period">
<h2>{{ title|default('Person search results')|trans }}</h2>
@ -75,155 +227,34 @@
{% if acps|length > 0 %}
{% for acp in acps %}
{% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator">
<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 %}
{% if acp.step == 'CLOSED' %}
<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>
{% 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 %}
<div id="collapse_{{ acp.id }}"
class="accordion-collapse collapse"
aria-labelledby="heading_{{ acp.id }}"
data-bs-parent="#nonCurrent">
{% 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>
{{ _self.accompanying_period(acp, person) }}
</div>
</div>
{% if acp.user is not null %}
<div class="wl-row">
<div class="wl-col title">
<h3 class="referrer">{{ 'Referrer'|trans }}</h3>
</div>
<div class="wl-col list">
<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>
</div>
<div class="wl-col list">
{% set participating = false %}
{% for part in acp.currentParticipations %}
{% if part.person.id != person.id %}
{% include '@ChillMain/OnTheFly/_insert_vue_onthefly.html.twig' with {
targetEntity: { name: 'person', id: part.person.id },
action: 'show',
displayBadge: true,
buttonText: part.person|chill_entity_render_string,
isDead: part.person.deathdate is not null
} %}
{% else %}
{% set participating = true %}
{% endif %}
{% endfor %}
{% if participating %}
{{ 'person.and_himself'|trans({'gender': person.gender}) }}
{% endif %}
</div>
</div>
{% endif %}
{% if acp.requestoranonymous == false %}
{% 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-col title">
<h3>
{% if acp.requestorPerson is not null %}
{{ 'Requestor'|trans({'gender': acp.requestorPerson.gender}) }}
{% 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>
{% else %}
{{ _self.accompanying_period(acp, person) }}
{% endif %}
{% endfor %}
{% endif %}