ajust list_with_period search with person render_box (and add new options to it)

This commit is contained in:
Mathieu Jaumotte 2021-08-01 15:21:03 +02:00
parent 4be4cd7279
commit 48873d15c9
11 changed files with 378 additions and 388 deletions

View File

@ -87,6 +87,7 @@ div.flex-table {
div.item-row { div.item-row {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
&:not(:first-child) { &:not(:first-child) {
margin-top: 0.5em; margin-top: 0.5em;
border-top: 1px dotted $gray-900; border-top: 1px dotted $gray-900;
@ -100,13 +101,13 @@ div.flex-table {
} }
&:last-child { &:last-child {
flex-grow: 1; flex-shrink: 1; flex-basis: auto; flex-grow: 1; flex-shrink: 1; flex-basis: auto;
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;
ul.record_actions { ul.record_actions {
margin: 0;
align-self: flex-start;
flex-grow: 1; flex-shrink: 0; flex-basis: auto; flex-grow: 1; flex-shrink: 0; flex-basis: auto;
align-self: flex-start;
margin: 0;
li { li {
margin-right: 5px; margin-right: 5px;
} }

View File

@ -1,10 +1,12 @@
/// complete and overwrite flex-table in chillmain.scss /// overwrite flex-table
div.list-with-period {
div.flex-table div.item-row div.item-col:first-child { flex-basis: 33%; }
}
///
div.list-with-period, div.list-with-period,
div.list-household-members { div.list-household-members {
div.comment {
// for the comment for household-members
}
div.periods { div.periods {
div.header, div.header,
div.list-content { div.list-content {
@ -13,7 +15,7 @@ div.list-household-members {
} }
div.header { div.header {
position: relative; position: relative;
a.sc-button { a.btn {
position: absolute; position: absolute;
width: 30px; width: 30px;
height: 30px; height: 30px;

View File

@ -22,8 +22,8 @@
class="item-bloc" class="item-bloc"
v-bind:key="conc.person.id" v-bind:key="conc.person.id"
> >
<div class="item-row person"> <div class="item-row">
<div class="item-col box-person"> <div class="item-col">
<div> <div>
<person :person="conc.person"></person> <person :person="conc.person"></person>
</div> </div>
@ -33,7 +33,7 @@
</div> </div>
</div> </div>
<div class="item-col box-where"> <div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<li> <li>
<i class="fa fa-li fa-map-marker"></i> <i class="fa fa-li fa-map-marker"></i>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row person"> <div class="item-row">
<div class="item-col box-person"> <div class="item-col">
<div> <div>
<person :person="conc.person"></person> <person :person="conc.person"></person>
<span v-if="isHolder" class="badge bg-primary holder"> <span v-if="isHolder" class="badge bg-primary holder">
@ -10,7 +10,7 @@
</div> </div>
<div v-if="conc.person.birthdate !== null">{{ $t('person.born', {'gender': conc.person.gender} ) }}</div> <div v-if="conc.person.birthdate !== null">{{ $t('person.born', {'gender': conc.person.gender} ) }}</div>
</div> </div>
<div class="item-col box-where"> <div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<li> <li>
<i class="fa fa-li fa-map-marker"></i> <i class="fa fa-li fa-map-marker"></i>

View File

@ -50,33 +50,41 @@
</div> </div>
<div class="item-row"> <div class="item-row">
<h3>{{ 'Participants'|trans }}</h3> <div class="item-col"><h3>{{ 'Participants'|trans }}</h3></div>
{% if accompanying_period.participations.count > 0 %} <div class="item-col">
{% for p in accompanying_period.participations %} {% if accompanying_period.participations.count > 0 %}
<p> {% for p in accompanying_period.participations %}
<a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}"> <p>
{{ p.person.firstname ~ ' ' ~ p.person.lastname }} <a href="{{ path('chill_person_accompanying_period_list', { person_id: p.person.id }) }}">
</a> {{ p.person.firstname ~ ' ' ~ p.person.lastname }}
</p> </a>
{% endfor %} </p>
{% else %} {% endfor %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> {% else %}
{% endif %} <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div>
</div> </div>
<div class="item-row"> <div class="item-row">
<h3>{{ 'Requestor'|trans }}</h3> <div class="item-col"><h3>{{ 'Requestor'|trans }}</h3></div>
{% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %} <div class="item-col">
{% if accompanying_period.requestorPerson is not null %} {% if accompanying_period.requestorPerson is not null or accompanying_period.requestorThirdParty is not null %}
<p>{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}</p> {% if accompanying_period.requestorPerson is not null %}
<p>
{{ accompanying_period.requestorPerson.firstname ~ ' ' ~ accompanying_period.requestorPerson.lastname }}
</p>
{% endif %}
{% if accompanying_period.requestorThirdParty is not null %}
<p>
{{ accompanying_period.requestorThirdParty.name }}
</p>
{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %} {% endif %}
{% if accompanying_period.requestorThirdParty is not null %} </div>
<p>{{ accompanying_period.requestorThirdParty.name }}</p>
{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</div> </div>
<div class="item-row"> <div class="item-row">

View File

@ -8,7 +8,9 @@
* addId bool * addId bool
* addInfo bool * addInfo bool
* addAge bool * addAge bool
* addCenter bool
* hLevel integer * hLevel integer
* address_multiline bool
* customButtons [ * customButtons [
'before' Twig\Markup, (injected with macro) 'before' Twig\Markup, (injected with macro)
'replace' Twig\Markup, 'replace' Twig\Markup,
@ -89,10 +91,11 @@
</div> </div>
<div class="item-col"> <div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
{% set multiline = (options['address_multiline']) ? true : false %}
{{ person.getLastAddress|chill_entity_render_box({ {{ person.getLastAddress|chill_entity_render_box({
'render': 'list', 'render': 'list',
'with_picto': true, 'with_picto': true,
'multiline': false, 'multiline': multiline,
'with_valid_from': false 'with_valid_from': false
}) }} }) }}
<li> <li>
@ -111,6 +114,12 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
</li> </li>
{% if options['addCenter'] %}
<li>
<i class="fa fa-li fa-long-arrow-right"></i>
{{ person.center }}
</li>
{% endif %}
</ul> </ul>
<ul class="record_actions"> <ul class="record_actions">
{% if options['customButtons']['before'] is defined %} {% if options['customButtons']['before'] is defined %}

View File

@ -85,8 +85,8 @@
<div class="flex-table list-household-members"> <div class="flex-table list-household-members">
{% for m in members %} {% for m in members %}
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row person"> <div class="item-row">
<div class="item-col box-person"> <div class="item-col">
<div> <div>
{{ m.person|chill_entity_render_box({'addLink': true}) }} {{ m.person|chill_entity_render_box({'addLink': true}) }}
{% if m.holder %} {% if m.holder %}
@ -97,7 +97,7 @@
{{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }} {{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }}
</div> </div>
</div> </div>
<div class="item-col box-where"> <div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
{% if m.startDate is not empty %} {% if m.startDate is not empty %}
<li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li> <li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li>
@ -155,8 +155,8 @@
<div class="flex-table list-household-members"> <div class="flex-table list-household-members">
{% for m in members %} {% for m in members %}
<div class="item-bloc"> <div class="item-bloc">
<div class="item-row person"> <div class="item-row">
<div class="item-col box-person"> <div class="item-col">
<div> <div>
{{ m.person|chill_entity_render_box({'addLink': true}) }} {{ m.person|chill_entity_render_box({'addLink': true}) }}
{% if m.holder %} {% if m.holder %}
@ -167,7 +167,7 @@
{{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }} {{ 'Born the date'|trans({ 'gender': m.person.gender, 'birthdate': m.person.birthdate|format_date('long') }) }}
</div> </div>
</div> </div>
<div class="item-col box-where"> <div class="item-col">
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
{% if m.startDate is not empty %} {% if m.startDate is not empty %}
<li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li> <li>{{ 'Since %date%'|trans({'%date%': m.startDate|format_date('long') }) }}</li>

View File

@ -14,105 +14,107 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
<h2>{{ title|default('Person search results')|trans }}</h2> <div class="list-person">
<h2>{{ title|default('Person search results')|trans }}</h2>
<p> <p>
{{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }} {{ '%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"> <a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-sm">
<i class="fa fa-search" aria-hidden="true"></i> {{ pattern }} <i class="fa fa-search" aria-hidden="true"></i> {{ pattern }}
</a> </a>
</p> </p>
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p> <p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p>
{% if persons|length > 0 %} {% if persons|length > 0 %}
<table> <table class="table table-bordered border-dark align-middle">
<thead> <thead>
<tr>
<th class="chill-red">{% trans %}Name{% endtrans %}</th>
<th class="chill-green">{% trans %}Date of birth{% endtrans %}</th>
<th class="chill-orange">{% trans %}Nationality{% endtrans %}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for person in persons %}
<tr> <tr>
<td> <th class="chill-orange">{% trans %}Name{% endtrans %}</th>
{% set is_open = person.isOpen() %} <th class="chill-orange">{% trans %}Date of birth{% endtrans %}</th>
<a href="{{ path('chill_person_view', { person_id : person.getId }) }}" {% if chill_person.fields.accompanying_period == 'visible' %}{% if is_open %} alt="{{ 'An accompanying period is open'|trans|e('html_attr') }}"{% else %} alt="{{ 'Any accompanying periods are open'|trans|e('html_attr') }}" {% endif %}{% endif %}> <th class="chill-orange">{% trans %}Nationality{% endtrans %}</th>
{{ person|chill_entity_render_box }} <th>&nbsp;</th>
{% apply spaceless %} </tr>
{% if chill_person.fields.accompanying_period == 'visible' %} </thead>
{% if is_open == false %} <tbody>
<i class="fa fa-lock" ></i> {% for person in persons %}
{% else %} <tr>
<i class="fa fa-unlock" ></i> <td>
{% endif %} {% set is_open = person.isOpen() %}
{% endif %} <a href="{{ path('chill_person_view', { person_id : person.getId }) }}" {% if chill_person.fields.accompanying_period == 'visible' %}{% if is_open %} alt="{{ 'An accompanying period is open'|trans|e('html_attr') }}"{% else %} alt="{{ 'Any accompanying periods are open'|trans|e('html_attr') }}" {% endif %}{% endif %}>
{% endapply %} {{ person|chill_entity_render_box }}
</a> {% apply spaceless %}
</td> {% if chill_person.fields.accompanying_period == 'visible' %}
<td> {% if is_open == false %}
{% if person.birthdate is not null %} <i class="fa fa-lock" ></i>
{{ person.birthdate|format_date('long') }} {% else %}
{% else %}{{ 'Unknown date of birth'|trans }}{% endif %} <i class="fa fa-unlock" ></i>
</td> {% endif %}
<td> {% endif %}
{% if person.nationality is not null %} {% endapply %}
{{person.nationality.name | localize_translatable_string }} </a>
{% else %} </td>
{{ 'Without nationality'|trans }} <td>
{% endif %} {% if person.birthdate is not null %}
</td> {{ person.birthdate|format_date('long') }}
<td> {% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
<ul class="record_actions"> </td>
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li> <td>
{% if is_granted('CHILL_PERSON_UPDATE', person) %} {% if person.nationality is not null %}
<li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li> {{person.nationality.name | localize_translatable_string }}
{% else %}
{{ 'Without nationality'|trans }}
{% endif %} {% endif %}
</ul> </td>
</td> <td>
</tr> <ul class="record_actions">
{% endfor %} <li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
</tbody> {% if is_granted('CHILL_PERSON_UPDATE', person) %}
</table> <li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %}
<ul class="record_actions"> </ul>
{% if is_granted('CHILL_PERSON_CREATE') %} </td>
<li> </tr>
<a href="{{ path('chill_person_new') }}" class="btn btn-create"> {% endfor %}
{{ 'Add a person'|trans }} </tbody>
</a> </table>
</li>
{% endif %}
{% if search_name != "person_similarity" %} <ul class="record_actions">
<li> {% if is_granted('CHILL_PERSON_CREATE') %}
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action"> <li>
<i class="fa fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }} <a href="{{ path('chill_person_new') }}" class="btn btn-create">
</a> {{ 'Add a person'|trans }}
</li> </a>
{% endif %} </li>
{% if preview == true and persons|length < total %} {% endif %}
<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>
{% else %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action">
<i class="fa fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
</a>
</li>
</ul>
{% endif %}
{% if preview == false %} {% if search_name != "person_similarity" %}
{{ chill_pagination(paginator) }} <li>
{% endif %} <a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action">
<i class="fa 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>
{% else %}
<ul class="record_actions">
<li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action">
<i class="fa fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
</a>
</li>
</ul>
{% endif %}
{% if preview == false %}
{{ chill_pagination(paginator) }}
{% endif %}
</div>

View File

@ -14,94 +14,96 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
<h2>{{ title|default('Person search results by phonenumber')|trans }}</h2> <div class="list-by-phonenumber">
<h2>{{ title|default('Person search results by phonenumber')|trans }}</h2>
<p> <p>
{{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }} {{ '%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"> <a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-sm">
<i class="fa fa-search" aria-hidden="true"></i> {{ pattern }} <i class="fa fa-search" aria-hidden="true"></i> {{ pattern }}
</a> </a>
</p> </p>
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p> <p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p>
{% if persons|length > 0 %} {% if persons|length > 0 %}
<table class="person-list__--by-phonenumber"> <table class="table table-bordered border-dark align-middle">
<thead> <thead>
<tr>
<th class="chill-red">{% trans %}Name{% endtrans %}</th>
<th class="chill-green">{% trans %}Date of birth{% endtrans %}</th>
<th class="chill-orange">{% trans %}Phonenumber{% endtrans %}</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{% for person in persons %}
<tr> <tr>
<td> <th class="chill-orange">{% trans %}Name{% endtrans %}</th>
{% set is_open = person.isOpen() %} <th class="chill-orange">{% trans %}Date of birth{% endtrans %}</th>
<a href="{{ path('chill_person_view', { person_id : person.getId }) }}" {% if chill_person.fields.accompanying_period == 'visible' %}{% if is_open %} alt="{{ 'An accompanying period is open'|trans|e('html_attr') }}"{% else %} alt="{{ 'Any accompanying periods are open'|trans|e('html_attr') }}" {% endif %}{% endif %}> <th class="chill-orange">{% trans %}Phonenumber{% endtrans %}</th>
{{person.firstName}} {{person.lastName}} <th>&nbsp;</th>
{% apply spaceless %} </tr>
{% if chill_person.fields.accompanying_period == 'visible' %} </thead>
{% if is_open == false %} <tbody>
<i class="fa fa-lock" ></i> {% for person in persons %}
{% else %} <tr>
<i class="fa fa-unlock" ></i> <td>
{% endif %} {% set is_open = person.isOpen() %}
<a href="{{ path('chill_person_view', { person_id : person.getId }) }}" {% if chill_person.fields.accompanying_period == 'visible' %}{% if is_open %} alt="{{ 'An accompanying period is open'|trans|e('html_attr') }}"{% else %} alt="{{ 'Any accompanying periods are open'|trans|e('html_attr') }}" {% endif %}{% endif %}>
{{person.firstName}} {{person.lastName}}
{% apply spaceless %}
{% if chill_person.fields.accompanying_period == 'visible' %}
{% if is_open == false %}
<i class="fa fa-lock" ></i>
{% else %}
<i class="fa fa-unlock" ></i>
{% endif %}
{% endif %}
{% endapply %}
</a>
</td>
<td>
{% if person.birthdate is not null %}{{person.birthdate|format_date('long') }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
</td>
<td class="person-list__--by-phonenumber__phones">
<ul>
{% if person.phonenumber is not empty %}
<li>
<a href="tel:{{ person.phonenumber }}"><img src="{{ asset('build/images/mobile-alt-solid.svg') }}">&nbsp;<pre>{{ person.phonenumber|chill_format_phonenumber }}</pre></a>
</li>
{% endif %} {% endif %}
{% endapply %} {% if person.mobilenumber is not empty%}
</a> <li>
</td> <a href="tel:{{ person.mobilenumber }}"><img src="{{ asset('build/images/phone-alt-solid.svg') }}">&nbsp;<pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a>
<td> </li>
{% if person.birthdate is not null %}{{person.birthdate|format_date('long') }}{% else %}{{ 'Unknown date of birth'|trans }}{% endif %} {% endif %}
</td> </ul>
<td class="person-list__--by-phonenumber__phones"> </td>
<ul> <td>
{% if person.phonenumber is not empty %} <ul class="record_actions">
<li> <li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
<a href="tel:{{ person.phonenumber }}"><img src="{{ asset('build/images/mobile-alt-solid.svg') }}">&nbsp;<pre>{{ person.phonenumber|chill_format_phonenumber }}</pre></a> {% if is_granted('CHILL_PERSON_UPDATE', person) %}
</li> <li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %} {% endif %}
{% if person.mobilenumber is not empty%} </ul>
<li> </td>
<a href="tel:{{ person.mobilenumber }}"><img src="{{ asset('build/images/phone-alt-solid.svg') }}">&nbsp;<pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a> </tr>
</li> {% endfor %}
{% endif %} </tbody>
</ul> </table>
</td>
<td>
<ul class="record_actions">
<li><a class="btn btn-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li><a class="btn btn-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<a href="{{ path('chill_person_new') }}" class="btn btn-create">
{{ 'Add a person'|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>
{% endif %}
{% if preview == false %} <ul class="record_actions">
{{ chill_pagination(paginator) }} {% if is_granted('CHILL_PERSON_CREATE') %}
{% endif %} <li>
<a href="{{ path('chill_person_new') }}" class="btn btn-create">
{{ 'Add a person'|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>
{% endif %}
{% if preview == false %}
{{ chill_pagination(paginator) }}
{% endif %}
</div>

View File

@ -1,181 +1,145 @@
<h2>{{ title|default('Person search results')|trans }}</h2> {% macro button_person(person) %}
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id }) }}"
class="btn btn-primary" title="{{ 'See accompanying periods'|trans }}"><i class="fa fa-random"></i></a>
</li>
{% endmacro %}
<p> <div class="list-with-period">
{{ '%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> <h2>{{ title|default('Person search results')|trans }}</h2>
<ul class="record_actions"> <p>
{% if is_granted('CHILL_PERSON_CREATE') %} {{ '%total% persons matching the search pattern:'|transchoice( total, { '%total%' : total}) }}
<li> <a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-sm">
<a href="{{ path('chill_person_new') }}" class="btn btn-create"> <i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ pattern }}
{{ 'Add a person'|trans }} </a>
</a> </p>
</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>
<p>{{ 'Results %start%-%end% of %total%'|trans({ '%start%' : start, '%end%': start + persons|length, '%total%' : total } ) }}</p>
{% 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({
'render': 'label', 'addLink': true, 'addInfo': true
}) }}
</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="btn btn-show"
title="{{ 'Open person file'|trans }}"></a>
</li>
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id }) }}"
class="btn btn-primary" 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="btn btn-chill-green" title="{{ 'See accompanying period'|trans }}">
<i class="fa 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"> <ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %} {% if is_granted('CHILL_PERSON_CREATE') %}
<li> <li>
<a href="{{ path('chill_person_new') }}" class="btn btn-create"> <a href="{{ path('chill_person_new') }}" class="btn btn-create">
{{ 'Add a person'|trans }} {{ 'Add a person'|trans }}
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if search_name != "person_similarity" %} {% if search_name != "person_similarity" %}
<li> <li>
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action"> <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 }} <i class="fa fa-fw fa-search" aria-hidden="true"></i>
</a> {{ 'Advanced search'|trans }}
</li> </a>
</li>
{% endif %} {% endif %}
{% if preview == true and persons|length < total %} {% if preview == true and persons | length < total %}
<li> <li>
<a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="btn btn-misc"> <a href="{{ path('chill_main_search', { "name": search_name|default('abcd'), "q" : pattern }) }}" class="btn btn-misc">
{{ 'See all results'|trans }} {{ 'See all results'|trans }}
</a> </a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
{% else %} {% if persons|length > 0 %}
<ul class="record_actions"> <div class="flex-table">
<li> {% for person in persons %}
<a href="{{ path('chill_main_advanced_search', { "name": search_name, "q": pattern } ) }}" class="btn btn-action"> <div class="item-bloc">
<i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
</a>
</li>
</ul>
{% endif %}
{% if preview == false %} {{ person|chill_entity_render_box({
{{ chill_pagination(paginator) }} 'render': 'bloc',
{% endif %} 'addLink': true,
'addInfo': true,
'addAltNames': false,
'addCenter': true,
'address_multiline': true,
'customButtons': { 'after': _self.button_person(person) }
}) }}
{#- '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 %}
<div class="item-row periods">
{% for app in apps %}
<div class="header">
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': app.accompanyingPeriod.id }) }}"
class="btn btn-chill-green" title="{{ 'See accompanying period'|trans }}">
<i class="fa 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>
{% endfor %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
<ul class="record_actions">
{% if is_granted('CHILL_PERSON_CREATE') %}
<li>
<a href="{{ path('chill_person_new') }}" 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>
{% else %}
<ul class="record_actions">
<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>
</ul>
{% endif %}
{% if preview == false %}
{{ chill_pagination(paginator) }}
{% endif %}
</div>

View File

@ -58,6 +58,8 @@ class PersonRender extends AbstractChillEntityRender
'addId' => $options['addId'] ?? false, 'addId' => $options['addId'] ?? false,
'addInfo' => $options['addInfo'] ?? false, 'addInfo' => $options['addInfo'] ?? false,
'addAge' => $options['addAge'] ?? false, 'addAge' => $options['addAge'] ?? false,
'addCenter' => $options['addCenter'] ?? false,
'address_multiline' => $options['address_multiline'] ?? false,
'hLevel' => $options['hLevel'] ?? 3, 'hLevel' => $options['hLevel'] ?? 3,
'customButtons' => $options['customButtons'] ?? [], 'customButtons' => $options['customButtons'] ?? [],
]; ];