Merge branch 'issue574_accordeon_parcours' into 'master'

Accordeon for closed parcours in person search results

See merge request Chill-Projet/chill-bundles!413
This commit is contained in:
Julien Fastré 2022-04-25 19:34:49 +00:00
commit 217f95472b
10 changed files with 224 additions and 163 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to
<!-- write down unreleased development here -->
* [Datepickers] datepickers fixed when using keyboard to enter date (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/545)
* [social_action] Display 'agents traitants' in parcours resumé and social action list (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/568)
* [Person_search] Closed parcours shown within an accordeon that can be opened/closed (https://gitlab.com/champs-libres/departement-de-la-vendee/chill/-/issues/574)
## Test releases

View File

@ -16,6 +16,9 @@
// Chill forms
@import './scss/forms';
// Extend bootstrap accordion
@import './scss/accordion';
// Chill record_actions
@import './scss/record_actions';

View File

@ -0,0 +1,11 @@
.accordion {
// show a folded / label on accordion
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; }
.accordion-item {
margin-bottom: 1rem;
}
}

View File

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

View File

@ -20,7 +20,7 @@
{% elseif period.step == 'CONFIRMED' %}
<span class="badge bg-primary">{{- 'Confirmed'|trans|upper -}}</span>
{% else %}
<span class="badge bg-primary">{{- 'Closed'|trans|upper -}}</span>
<span class="badge bg-danger">{{- 'Closed'|trans|upper -}}</span>
{% endif %}
</div>
</div>

View File

@ -10,12 +10,6 @@
{% include 'ChillPersonBundle:AccompanyingPeriod:_list.html.twig' %}
{% if accompanying_periods_old|length > 0 %}
<style>
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; }
</style>
<div class="accordion" id="nonCurrent">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ household.id }}">

View File

@ -191,12 +191,6 @@
{% endif %}
{% if old_members|length > 0 %}
<style>
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; }
</style>
<div class="accordion" id="nonCurrent">
<div class="accordion-item">
<h2 class="accordion-header" id="heading_{{ p == '_none' ? '_none' : p.id }}">

View File

@ -10,71 +10,7 @@
</li>
{% endmacro %}
<div class="list-with-period">
<h2>{{ title|default('Person search results')|trans }}</h2>
<p>
{{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }}
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-sm">
<i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ pattern }}
</a>
</p>
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<a href="{{ path('chill_person_new', { "_fragment": pattern }) }}" class="btn btn-create">
{{ 'Add a person'|trans }}
</a>
</li>
{% endif %}
{% if search_name != "person_similarity" %}
<li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action">
<i class="fa fa-fw fa-search" aria-hidden="true"></i>
{{ 'Advanced search'|trans }}
</a>
</li>
{% endif %}
{% if preview == true and persons | length < total %}
<li>
<a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="btn btn-misc">
{{ 'See all results'|trans }}
</a>
</li>
{% endif %}
</ul>
{% if persons|length > 0 %}
<div class="flex-table">
{% for person in persons %}
<div class="item-bloc">
{{ person|chill_entity_render_box({
'render': 'bloc',
'addLink': true,
'addInfo': true,
'addAge': true,
'addAltNames': true,
'addCenter': true,
'address_multiline': false,
'customButtons': { 'after': _self.button_person_after(person) }
}) }}
{#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %}
{%- for acp in person.accompanyingPeriodInvolved %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
{%- set acps = acps|merge([acp]) %}
{%- endif %}
{%- endfor %}
{# add as requestor #}
{% if acps|length > 0 %}
{% for acp in acps %}
{% macro accompanying_period(acp, person) %}
{% set app = person.findParticipationForPeriod(acp) %}
<div class="item-row separator">
<div class="wrap-list periods-list">
@ -118,7 +54,7 @@
{% endif %}
{% if acp.step == 'CLOSED' %}
<span class="badge bg-secondary" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
<span class="badge bg-danger" style="font-size: 85%;" title="{{ 'course.closed'|trans }}">{{ 'course.closed'|trans }}</span>
{% endif %}
</div>
</div>
@ -221,12 +157,113 @@
</a>
</li>
</ul>
</div>
</div>
{% endmacro %}
</div>
</div>
<div class="list-with-period">
<h2>{{ title|default('Person search results')|trans }}</h2>
<p>
{{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }}
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-sm">
<i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ pattern }}
</a>
</p>
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<a href="{{ path('chill_person_new', { "_fragment": pattern }) }}" class="btn btn-create">
{{ 'Add a person'|trans }}
</a>
</li>
{% endif %}
{% if search_name != "person_similarity" %}
<li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action">
<i class="fa fa-fw fa-search" aria-hidden="true"></i>
{{ 'Advanced search'|trans }}
</a>
</li>
{% endif %}
{% if preview == true and persons | length < total %}
<li>
<a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="btn btn-misc">
{{ 'See all results'|trans }}
</a>
</li>
{% endif %}
</ul>
{% if persons|length > 0 %}
<div class="flex-table">
{% for person in persons %}
<div class="item-bloc">
{{ person|chill_entity_render_box({
'render': 'bloc',
'addLink': true,
'addInfo': true,
'addAge': true,
'addAltNames': true,
'addCenter': true,
'address_multiline': false,
'customButtons': { 'after': _self.button_person_after(person) }
}) }}
{#- 'acps' is for AcCompanyingPeriodS #}
{%- set acps = [] %}
{%- set acpsClosed = [] %}
{%- for acp in person.accompanyingPeriodInvolved %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', acp) %}
{% if acp.step == 'CLOSED' %}
{%- set acpsClosed = acpsClosed|merge([acp]) %}
{% else %}
{%- set acps = acps|merge([acp]) %}
{% endif %}
{%- endif %}
{%- endfor %}
{# add as requestor #}
{% if acps|length > 0 %}
{% for acp in acps %}
{{ _self.accompanying_period(acp, person) }}
{% endfor %}
{% 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">{{ 'periods.show closed periods'|trans({ 'nb_items': acpsClosed|length }) }}</span>
<span class="unfolded text-secondary">{{ 'periods.hide closed periods'|trans({ 'nb_items': acpsClosed|length }) }}</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>
{% endfor %}
</div>

View File

@ -114,3 +114,19 @@ household_composition:
few {# enfants dans le ménage}
other {# enfants dans le ménage}
}
periods:
show closed periods: >-
{nb_items, plural,
=0 {Aucun parcours clôturé}
one {Montrer un parcours clôturé}
many {Montrer # parcours clôturés}
other {Montrer # parcours clôturés}
}
hide closed periods: >-
{nb_items, plural,
=0 {Aucun parcours clôturé}
one {Masquer un parcours clôturé}
many {Masquer # parcours clôturés}
other {Masquer # parcours clôturés}
}

View File

@ -465,6 +465,9 @@ fix it: Compléter
accompanying_course:
administrative_location: Localisation administrative
comment is pinned: Le commentaire est épinglé
show: Montrer
hide: Masquer
closed periods: parcours clôturer
# Accompanying Course comments
Accompanying Course Comment: Commentaire