Search list with periods, html/scss refactoring

This commit is contained in:
Mathieu Jaumotte 2021-05-26 00:09:25 +02:00
parent 6264171c0c
commit 37996651c4
4 changed files with 208 additions and 245 deletions

View File

@ -1,68 +1,67 @@
.person-list--with-period {
.person-list--with-period__item {
margin-bottom: 0;
padding: 1em 1em 2em 1em;
&:nth-last-of-type {
padding-bottom: 1em;
}
.chill-entity__person {
.chill-entity__person__first-name,
.chill-entity__person__last-name {
font-size: 1.3em;
font-weight: 700;
/// complete and overwrite flex-table in chillmain.scss
div.list-with-period { // .flex-table
div.item-bloc {
margin-bottom: 0;
&:nth-last-of-type {
padding-bottom: 1em;
}
}
& > div {
display: flex;
}
@media screen and (min-width: 720px) {
flex-direction: column; // !!
& > div {
flex-direction: row;
.person-list--with-period__item__box-where {
align-self: flex-end;
margin-left: auto;
width: 33%;
text-align: right;
}
display: flex;
flex-direction: row;
&.person {
div.box-person {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 33%;
}
div.box-where {
flex-grow: 1;
flex-shrink: 0;
flex-basis: 40%;
}
ul.record_actions {
flex-grow: 0;
flex-shrink: 0;
flex-basis: 25%;
li {
margin-right: 0;
}
}
@media only screen and (max-width: 768px) {
flex-direction: column;
}
}
&.periods {
list-style-type: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
div.header {
abbr.referrer {
font-size: 70%;
}
span.user {}
}
span.more {
font-style: italic;
}
}
}
}
@media screen and (max-width: 720px) {
& > div {
flex-direction: column;
}
}
@media screen and (max-width: 460px) {
.person-list--with-period__item__box-where__center {
display: none;
}
.chill_address {
.street {
display: none;
}
.country {
display: none;
}
}
}
ul.person-list--with-period__item__periods {
list-style-type: none;
padding: 0;
margin: 0;
li {
}
}
}
.person-list--with-period__item:hover {
background-color: var(--chill-llight-gray);
}
}
}
.chill-entity__person {
.chill-entity__person__first-name,
.chill-entity__person__last-name {
font-size: 1.3em;
font-weight: 700;
}
}

View File

@ -11,7 +11,7 @@
<div class="grid-8 centered error flash_message">
<span>
{{ 'This accompanying course is still a draft'|trans }}
<a href="{{ path('chill_person_accompanying_course_show', { 'accompanying_period_id': accompanyingCourse.id } ) }}">
<a href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id } ) }}">
{{ 'Edit & activate accompanying course'|trans }}
</a>
</span>
@ -51,7 +51,7 @@
{%- if p.person.lastAddress is not empty -%}
{{ address._render(p.person.lastAddress, {'has_no_address': true, 'with_valid_from': false, 'with_icon': true}) }}
{%- else -%}
<dt class="fa fa-fw fa-map-marker"></dt>
<i class="fa fa-fw fa-map-marker"></i>
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</dd>

View File

@ -3,206 +3,168 @@
<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-search" aria-hidden="true"></i> {{ pattern }}
<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-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>
<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="person-list--with-period">
{% for person in persons %}
<div class="person-list--with-period__item">
<div>
<div class="person-list--with-period__item__box-person">
<div>
<span>{{ person|chill_entity_render_box({'addLink': true}) }}</span>
<span>{{ 'Born the %date%'|transchoice(person.genderNumeric, { '%date%': person.birthdate|format_date("medium") }) }}</span>
</div>
<div>
<ul class="record_actions record_actions--left">
<li>
<a href="{{ path('chill_person_view', { 'person_id' : person.id }) }}" class="sc-button bt-view" />
{{ 'Open person file'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_person_accompanying_period_list', { 'person_id' : person.id }) }}" class="sc-button" /><i class="fa fa-random"></i></a>
</li>
</ul>
</div>
</div>
<div class="person-list--with-period__item__box-where">
<span class="person-list--with-period__item__box-where__center">{{ person.center }}</span>
{% if person.getLastAddress is not null %}
<span>{{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}</span>
{% else %}
<span>{{ 'No address'|trans }}</span>
{% endif %}
{% if person.mobilenumber is not empty %}
<span><i class="fa fa-mobile"></i> <a href="tel:{{ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a></span>
{% endif %}
{% if person.phonenumber is not empty %}
<span><i class="fa fa-phone"></i> <a href="tel:{{ person.phonenumber }}">{{ person.phonenumber|chill_format_phonenumber }}</a></span>
{% endif %}
<span>
</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 %}
<ul class="person-list--with-period__item__periods">
{% for app in apps %}
<li>
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': app.accompanyingPeriod.id }) }}">
<i class="fa fa-random"></i>
<span>{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}</span>
{% if app.accompanyingPeriod.user is not null %}
<span>
{{ app.accompanyingPeriod.user|chill_entity_render_box }}
</span>
</a>
{% endif %}
{% for issue in app.accompanyingPeriod.socialIssues|slice(0,2) %}
<span>{{ issue|chill_entity_render_box }}</span>
{% endfor %}
{% if app.accompanyingPeriod.socialIssues|length > 2 %}
<span>{{ 'and %number% other'|transchoice(app.accompanyingPeriod.socialIssues|length-2) }}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endfor %}
</div>
{#
<table>
<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>
<td>
{% 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|chill_entity_render_box }}
{% 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 %}
<div class="list-with-period flex-table">
{% for person in persons %}
<div class="item-bloc">
<div class="person">
<div class="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="box-where">
<dl>
<dd class="center">{{ person.center }}</dd>
<dd>
{% if person.mobilenumber is not empty %}
<i class="fa fa-fw fa-mobile"></i> <a href="tel:{{ person.mobilenumber }}">{{ person.mobilenumber|chill_format_phonenumber }}</a>
{% else %}
<i class="fa fa-fw 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 %}
{% endapply %}
</a>
</td>
<td>
{% if person.birthdate is not null %}
{{ person.birthdate|format_date('long') }}
{% else %}{{ 'Unknown date of birth'|trans }}{% endif %}
</td>
<td>
{% if person.nationality is not null %}
{{person.nationality.name | localize_translatable_string }}
{% else %}
{{ 'Without nationality'|trans }}
{% endif %}
</td>
<td>
<ul class="record_actions">
<li><a class="sc-button bt-show" href="{{ path('chill_person_view', { person_id : person.getId }) }}"></a></li>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<li><a class="sc-button bt-update" href="{{ path('chill_person_general_edit', { person_id : person.getId }) }}"></a></li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</dd>
<dd>
<dt class="fa fa-fw fa-map-marker"></dt>
{% if person.getLastAddress is not null %}
{{ person.getLastAddress|chill_entity_render_box({'with_valid_from': false}) }}
{% else %}
<i>{{ 'No address'|trans }}</i>
{% endif %}
</dd>
</dl>
</div>
<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>
#}
{#- '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="periods">
{% for app in apps %}
<div>
<div class="header">
<a href="{{ path('chill_person_accompanying_course_index', { 'accompanying_period_id': app.accompanyingPeriod.id }) }}">
<span>{{ 'Since %date%'|trans({'%date%': app.startDate|format_date('medium') }) }}</span>
<i class="fa fa-fw fa-random"></i>
{% if app.accompanyingPeriod.user is not null %}
<abbr class="referrer" title="{{ 'Referrer'|trans }}">ref:</abbr>
<span class="user">{{ app.accompanyingPeriod.user|chill_entity_render_box }}</span>
{% endif %}
</a>
</div>
{% 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 %}
<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 %}
</div>
{% 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-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>
{% 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-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
<i class="fa fa-fw fa-search" aria-hidden="true"></i> {{ 'Advanced search'|trans }}
</a>
</li>
</ul>
{% endif %}
{% if preview == false %}
{{ chill_pagination(paginator) }}
{{ chill_pagination(paginator) }}
{% endif %}

View File

@ -125,7 +125,7 @@ Reset: 'Remise à zéro'
'Person search results': 'Recherche de personnes'
Person search results by phonenumber: Recherche de personnes par numéro de téléphone
'Search within persons': 'Recherche parmi les personnes'
Open person file: Ouvrir le dossier
Open person file: Ouvrir
and %number% other: '{0} et aucun autre| {1} et une autre |]1, Inf] et %number% autres'
'%total% persons matching the search pattern:': '{0} Aucune personne ne correspond aux termes de recherche : | {1} Une personne a été trouvée par la recherche : | ]1,Inf] %total% personnes correspondent aux termes de recherche :'
'Last opening since %last_opening%': 'Dernière ouverture le %last_opening%.'
@ -172,6 +172,8 @@ Resources: Interlocuteurs privilégiés
Social actions: Actions d'accompagnement
Last events on accompanying course: Dernières actions de suivi
Edit & activate accompanying course: Modifier et valider
See accompanying periods: Voir les périodes d'accompagnement
Referrer: Référent
# pickAPersonType
Pick a person: Choisir une personne