improve banners render : context person, with common improvements on accompanyingcourse and household context

This commit is contained in:
Mathieu Jaumotte 2021-07-01 16:13:07 +02:00
parent a78de0f96c
commit fc63955205
7 changed files with 144 additions and 70 deletions

View File

@ -45,6 +45,28 @@ table {
} }
} }
// styles communs pour tous les bandeaux
div.banner {
.id-number {
font-weight: lighter;
font-size: 50%;
&:before { content: '(n°'; }
&:after { content: ')'; }
}
a.phone,
a.email {
color: white;
}
ul.list-content {
margin: 0 auto;
}
span.age {
margin-left: 0.5em;
&:before { content: '('; }
&:after { content: ')'; }
}
}
/* /*
* FLEX RESPONSIVE TABLE/BLOCK PRESENTATION * FLEX RESPONSIVE TABLE/BLOCK PRESENTATION
*/ */

View File

@ -102,7 +102,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
* *
* @ORM\Column(type="date", nullable=true) * @ORM\Column(type="date", nullable=true)
*/ */
private $birthdate; //to change in birthdate private $birthdate;
/** /**
* The person's deathdate * The person's deathdate
@ -733,6 +733,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
{ {
return $this->birthdate; return $this->birthdate;
} }
public function getAge(): int
{
return date_diff($this->birthdate, date_create('now'))->format("%y");
}
/** /**
* Set placeOfBirth * Set placeOfBirth

View File

@ -1,17 +1,19 @@
<div class="subheader"> <div class="subheader banner banner-accompanying-course">
<div class="grid-12 parent" id="header-accompanying_course-name" > <div class="grid-12 parent" id="header-accompanying_course-name" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-6">{% set title = title %} <div class="grid-6">
<h1> <h1>
<i class="fa fa-random fa-fw"></i> <i class="fa fa-random fa-fw"></i>
{{ 'Accompanying Course'|trans }} {{ 'Accompanying Course'|trans }}
<span style="font-weight: lighter; font-size: 50%;">(n°{{ accompanyingCourse.id }})</span> <span class="id-number">{{ accompanyingCourse.id }}</span>
</h1> </h1>
</div> </div>
{# vue teleport fragment here #}
<div class="grid-3" id="banner-flags"></div> <div class="grid-3" id="banner-flags"></div>
{# vue teleport fragment here #}
<div class="grid-3" id="banner-status"></div> <div class="grid-3" id="banner-status"></div>
</div> </div>
@ -19,6 +21,7 @@
<div class="grid-12 parent" id="header-accompanying_course-details" > <div class="grid-12 parent" id="header-accompanying_course-details" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
{# vue teleport fragment here #}
<div id="banner-social-issues"></div> <div id="banner-social-issues"></div>
</div> </div>

View File

@ -81,11 +81,12 @@
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<li> <li>
{% if p.person.mobilenumber %} {% if p.person.mobilenumber %}
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ p.person.mobilenumber }}">{{ p.person.mobilenumber }}</a> <i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ p.person.mobilenumber }}">
{{ p.person.mobilenumber|chill_format_phonenumber }}</a>
{% else %} {% else %}
<i class="fa fa-li fa-phone"></i> <i class="fa fa-li fa-phone"></i>
{% if p.person.phonenumber %} {% if p.person.phonenumber %}
<a href="{{ 'tel:' ~ p.person.phonenumber }}">{{ p.person.phonenumber }}</a> <a href="{{ 'tel:' ~ p.person.phonenumber }}">{{ p.person.phonenumber|chill_format_phonenumber }}</a>
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %} {% endif %}
@ -150,11 +151,12 @@
<ul class="list-content fa-ul"> <ul class="list-content fa-ul">
<li> <li>
{% if r.mobilenumber %} {% if r.mobilenumber %}
<i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ r.mobilenumber }}">{{ r.mobilenumber }}</a> <i class="fa fa-li fa-mobile"></i><a href="{{ 'tel:' ~ r.mobilenumber }}">
{{ r.mobilenumber|chill_format_phonenumber }}</a>
{% else %} {% else %}
<i class="fa fa-li fa-phone"></i> <i class="fa fa-li fa-phone"></i>
{% if r.phonenumber %} {% if r.phonenumber %}
<a href="{{ 'tel:' ~ r.phonenumber }}">{{ r.phonenumber }}</a> <a href="{{ 'tel:' ~ r.phonenumber }}">{{ r.phonenumber|chill_format_phonenumber }}</a>
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span> <span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %} {% endif %}
@ -195,7 +197,7 @@
</li> </li>
<li><i class="fa fa-li fa-phone"></i> <li><i class="fa fa-li fa-phone"></i>
{% if r.telephone %} {% if r.telephone %}
<a href="{{ 'tel:' ~ r.telephone }}">{{ r.telephone }}</a> <a href="{{ 'tel:' ~ r.telephone }}">{{ r.telephone|chill_format_phonenumber }}</a>
{% else %} {% else %}
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span> <span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
{% endif %} {% endif %}

View File

@ -1,50 +1,58 @@
<div class="subheader banner-household"> <div class="subheader banner banner-household">
<div class="grid-12 parent" id="header-household-name" > <div class="grid-12 parent" id="header-household-name" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-6">{% set title = title %} <div class="grid-7">
<h1> <h1>
<i class="fa fa-home"></i> <i class="fa fa-home"></i>
{{ 'household.Household'|trans }} {{ 'household.Household'|trans }}
<span style="font-weight: lighter; font-size: 50%;">(n°{{ household.id }})</span> <span class="id-number">{{ household.id }}</span>
</h1> </h1>
</div> </div>
<div class="grid-3" id="banner-flags"></div> <div class="grid-5">
<ul class="list-content fa-ul">
<div class="grid-3" id="banner-status"> <li>
{% set address = household.currentAddress %} {% set address = household.currentAddress %}
{% if address is empty %} <i class="fa fa-li fa-map-marker"></i>
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p> {% if address is empty %}
{% else %} <p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
<div> {% else %}
{{ address|chill_entity_render_box({'multiline': true, 'with_valid_from': false}) }} {{ address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
</div> {% endif %}
{% endif %} </li>
</ul>
</div> </div>
</div> </div>
</div> </div>
<div class="grid-12 parent" id="header-household-details" > <div class="grid-12 parent" id="header-household-details" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div id="banner-misc"> <div id="banner-misc">
{%- set members = household.getCurrentMembersOrdered() -%} {%- set members = household.getCurrentMembersOrdered() -%}
{%- if members|length > 0 -%} {%- if members|length > 0 -%}
<span class="current-members-explain"> <span class="current-members-explain">
{{- 'household.Current household members'|trans }}: {{- 'household.Current household members'|trans }}:
</span> </span>
{%- for m in members|slice(0, 5) -%} {%- for m in members|slice(0, 5) -%}
{{- m.person|chill_entity_render_box({'addLink': false}) -}} {{- m.person|chill_entity_render_box({'addLink': false}) -}}
{%- if m.holder %} <span class="badge badge-primary">{{ 'household.holder'|trans }}</span>{% endif -%} {%- if m.holder %}
{%- if false == loop.last -%}, {% endif -%} <span class="badge badge-primary">
{%- endfor -%} {{ 'household.holder'|trans }}
{% if members|length > 5 %} </span>
<span class="current-members-more"> {% endif -%}
{{ 'household.and x other persons'|trans({'x': members|length-5}) }} {%- if false == loop.last -%}, {% endif -%}
</span> {%- endfor -%}
{% endif %} {% if members|length > 5 %}
{%- endif -%} <span class="current-members-more">
{{ 'household.and x other persons'|trans({'x': members|length-5}) }}
</span>
{% endif %}
{%- endif -%}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<span id="banner-household"></span>

View File

@ -16,38 +16,64 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
#} #}
{#
The layout of the admin section. All the page / template of the admin section must use this
layout.
#}
{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %} {% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %}
{% block top_banner %} {% block top_banner %}
<div class="subheader banner banner-person">
<div class="grid-12 parent" id="header-person-name" > <div class="grid-12 parent" id="header-person-name" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-3">
<span class="open_sansbold">{{ 'Name'|trans|upper }}&nbsp;:</span> {{ person|chill_entity_render_string }} <div class="grid-7">
<h1>
{% set gender =
(person.gender == "woman") ? 'female' :
(person.gender == "both") ? 'neuter' : 'male'
%}
<i class="fa fa-fw fa-{{ gender }}" title="{{ gender|capitalize|trans }}"></i>
{{ person|chill_entity_render_string }}
<span class="id-number" title="{{ 'Person'|trans ~ ' ' ~ person.id }}">
{{ person.id|upper }}
</span>
</h1>
</div> </div>
<div class="grid-3">
<span class="open_sansbold">{{ 'File number'|trans|upper}}&nbsp;:</span> {{ person.id|upper }} <div class="grid-5">
&mdash; <ul class="list-content fa-ul">
<i class="fa fa-{% apply spaceless %} <li>
{% if person.gender == "woman" %} <i class="fa fa-li fa-map-marker"></i>
female {%- if person.currentHouseholdAddress is not empty -%}
{% elseif person.gender == "both" %} {{ person.currentHouseholdAddress|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
neuter {%- elseif person.lastAddress is not empty -%}
{% else %} {{ person.lastAddress|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
male {%- else -%}
{% endif %} <span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% endapply %}"></i> {%- endif -%}
</div> </li>
<div class="grid-3"> <li>
<span class="open_sansbold">{{ 'Phonenumber'|trans|upper }}&nbsp;:</span> {% if person.mobilenumber %}
{% set phone = person.mobilenumber|default(person.phonenumber) %} <i class="fa fa-li fa-mobile"></i>
{% if phone is not empty %}{{ phone|chill_format_phonenumber }}{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %} <a href="{{ 'tel:' ~ person.mobilenumber }}" class="phone" title="{{ 'Mobilenumber'|trans }}">
{{ person.mobilenumber|chill_format_phonenumber }}</a>
{% else %}
<i class="fa fa-li fa-phone"></i>
{% if person.phonenumber %}
<a href="{{ 'tel:' ~ person.phonenumber }}" class="phone" title="{{ 'Phonenumber'|trans }}">
{{ person.phonenumber|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
{% endif %}
<span class="ml-3">
<i class="fa fa-fw fa-envelope-o"></i>
<a href="{{ 'mailto:' ~ person.email }}" class="email" title="{{ 'Email'|trans }}">
{{ person.email|chill_print_or_message("thirdparty.No_email") }}
</a>
</span>
</li>
</ul>
</div> </div>
</div> </div>
@ -55,16 +81,19 @@
<div class="grid-12 parent" id="header-person-details" > <div class="grid-12 parent" id="header-person-details" >
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent"> <div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<div class="grid-3">
<div class="grid-5">
<span class="open_sansbold">{{ 'Birthdate'|trans|upper }}&nbsp;:</span> <span class="open_sansbold">{{ 'Birthdate'|trans|upper }}&nbsp;:</span>
{% if person.birthdate == null %} {% if person.birthdate == null %}
{{ 'Unknown date of birth'|trans }} {{ 'Unknown date of birth'|trans }}
{% else %} {% else %}
{{ person.birthdate|format_date('long') }} {{ person.birthdate|format_date('short') }}
{% endif %} {% endif %}
<span class="age">{{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }}</span>
</div> </div>
{%- if chill_person.fields.nationality == 'visible' -%} {%- if chill_person.fields.nationality == 'visible' -%}
<div class="grid-3"> <div class="grid-4">
<span class="open_sansbold">{{ 'Nationality'|trans|upper}}&nbsp;:</span> <span class="open_sansbold">{{ 'Nationality'|trans|upper}}&nbsp;:</span>
{% if person.nationality is not null %} {% if person.nationality is not null %}
{{ person.nationality.name|localize_translatable_string }} {{ person.nationality.name|localize_translatable_string }}
@ -73,13 +102,17 @@
{% endif %} {% endif %}
</div> </div>
{%- endif -%} {%- endif -%}
{%- if chill_person.fields.spoken_languages == 'visible' -%} {%- if chill_person.fields.spoken_languages == 'visible' -%}
<div class="grid-3"> <div class="grid-3">
<span class="open_sansbold">{{ 'Center'|trans|upper}}&nbsp;:</span> {{ person.center.name|upper }} <span class="open_sansbold">{{ 'Center'|trans|upper}}&nbsp;:</span> {{ person.center.name|upper }}
</div> </div>
{%- endif -%} {%- endif -%}
</div> </div>
</div> </div>
</div>
<span id="banner-person"></span>
{% endblock %} {% endblock %}
{% block layout_wvm_content %} {% block layout_wvm_content %}
@ -98,4 +131,4 @@
<div class="block-post-menu"> <div class="block-post-menu">
{{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }} {{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }}
</div> </div>
{% endblock %} {% endblock %}

View File

@ -59,8 +59,10 @@ Remove phone: Supprimer
'Unknown spoken languages': 'Langues parlées inconnues' 'Unknown spoken languages': 'Langues parlées inconnues'
Male: Homme Male: Homme
Female: Femme Female: Femme
Neuter: Neutre
man: Homme man: Homme
woman: Femme woman: Femme
neuter: Neutre
Man: Homme Man: Homme
Woman: Femme Woman: Femme
both: Indéterminé both: Indéterminé
@ -364,4 +366,3 @@ accompanying_course_work:
results: Résultats - orientations results: Résultats - orientations
goal: Objectif - motif - dispositif goal: Objectif - motif - dispositif
Any work: Aucune action d'accompagnement Any work: Aucune action d'accompagnement