restore list with period

This commit is contained in:
Julien Fastré 2021-06-07 15:31:30 +02:00
parent eeffa3191e
commit 604e78f35e

View File

@ -0,0 +1,178 @@
<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="sc-button button-small">
<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') }}" class="sc-button bt-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="sc-button bt-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="sc-button">
{{ 'See all results'|trans }}
</a>
</li>
{% endif %}
</ul>
{% if persons|length > 0 %}
<div class="flex-table list-with-period">
{% for person in persons %}
<div class="item-bloc">
<div class="item-row person">
<div class="item-col box-person">
<div>{{ person|chill_entity_render_box({'addLink': true}) }}</div>
<div>{{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }}</div>
</div>
<div class="item-col box-where">
<ul class="list-content fa-ul">
<li><i class="fa fa-li fa-long-arrow-right"></i>
{{ person.center }}
</li>
<li>
{% if person.mobilenumber is not empty %}
<i class="fa fa-li fa-mobile"></i> <a href="{{ 'tel:' ~ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a>
{% else %}
<i class="fa fa-li fa-phone"></i>
{% if person.phonenumber is not empty %}
<a href="{{ 'tel:' ~ person.phonenumber }}">{{ person.phonenumber|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
{% endif %}
</li>
<li>
<i class="fa fa-li fa-map-marker"></i>
{% if person.getLastAddress is not null %}
{{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}
{% else %}
<span class="chill-no-data-statement">{{ 'No address'|trans }}</span>
{% endif %}
</li>
</ul>
<ul class="record_actions">
<li>
<a href="{{ path('chill_person_view', { 'person_id' : person.id }) }}" class="sc-button blue" />
<i class="fa fa-folder-open-o"></i> {{ 'Open person file'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id }) }}" class="sc-button green" title="{{ 'See accompanying periods'|trans }}"/>
<i class="fa fa-random"></i></a>
</li>
</ul>
</div>
</div>
{#- 'apps' is for AccompanyingPeriodParticipationS #}
{#- filter using acl -#}
{%- set apps = [] %}
{%- for app in person.openedParticipations %}
{%- if is_granted('CHILL_PERSON_ACCOMPANYING_PERIOD_SEE', app.accompanyingPeriod) %}
{%- set apps = apps|merge([app]) %}
{%- endif %}
{%- endfor %}
{% if apps|length > 0 %}
{% for app in apps %}
<div class="item-row periods">
<div class="header">
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': app.accompanyingPeriod.id }) }}"
class="sc-button green" title="{{ 'See accompanying period'|trans }}">
<i class="fa fa-fw fa-random"></i>
</a>
<span>{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}</span>
{% if app.accompanyingPeriod.user is not null %}
<span class="user">
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
{{ app.accompanyingPeriod.user|chill_entity_render_box }}
</span>
{% endif %}
</div>
<div class="list-content">
{% for issue in app.accompanyingPeriod.socialIssues|slice(0,2) %}
<span>{{ issue|chill_entity_render_box }}</span>
{% endfor %}
{% if app.accompanyingPeriod.socialIssues|length > 2 %}
<span class="more">{{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }}</span>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
{% endfor %}
</div>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<a href="{{ path('chill_person_new') }}" class="sc-button bt-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="sc-button bt-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="sc-button">
{{ 'See all results'|trans }}
</a>
</li>
{% endif %}
</ul>
{% else %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="sc-button bt-action">
<i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
</a>
</li>
</ul>
{% endif %}
{% if preview == false %}
{{ chill_pagination(paginator) }}
{% endif %}