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
*/

View File

@ -102,7 +102,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
*
* @ORM\Column(type="date", nullable=true)
*/
private $birthdate; //to change in birthdate
private $birthdate;
/**
* The person's deathdate
@ -733,6 +733,11 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
{
return $this->birthdate;
}
public function getAge(): int
{
return date_diff($this->birthdate, date_create('now'))->format("%y");
}
/**
* 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-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>
<i class="fa fa-random fa-fw"></i>
{{ 'Accompanying Course'|trans }}
<span style="font-weight: lighter; font-size: 50%;">(n°{{ accompanyingCourse.id }})</span>
<span class="id-number">{{ accompanyingCourse.id }}</span>
</h1>
</div>
{# vue teleport fragment here #}
<div class="grid-3" id="banner-flags"></div>
{# vue teleport fragment here #}
<div class="grid-3" id="banner-status"></div>
</div>
@ -19,6 +21,7 @@
<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">
{# vue teleport fragment here #}
<div id="banner-social-issues"></div>
</div>

View File

@ -81,11 +81,12 @@
<ul class="list-content fa-ul">
<li>
{% 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 %}
<i class="fa fa-li fa-phone"></i>
{% 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 %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
@ -150,11 +151,12 @@
<ul class="list-content fa-ul">
<li>
{% 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 %}
<i class="fa fa-li fa-phone"></i>
{% if r.phonenumber %}
<a href="{{ 'tel:' ~ r.phonenumber }}">{{ r.phonenumber }}</a>
<a href="{{ 'tel:' ~ r.phonenumber }}">{{ r.phonenumber|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
@ -195,7 +197,7 @@
</li>
<li><i class="fa fa-li fa-phone"></i>
{% if r.telephone %}
<a href="{{ 'tel:' ~ r.telephone }}">{{ r.telephone }}</a>
<a href="{{ 'tel:' ~ r.telephone }}">{{ r.telephone|chill_format_phonenumber }}</a>
{% else %}
<span class="chill-no-data-statement">{{ 'thirdparty.No_phonenumber'|trans }}</span>
{% 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-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>
<i class="fa fa-home"></i>
{{ 'household.Household'|trans }}
<span style="font-weight: lighter; font-size: 50%;">(n°{{ household.id }})</span>
<span class="id-number">{{ household.id }}</span>
</h1>
</div>
<div class="grid-3" id="banner-flags"></div>
<div class="grid-3" id="banner-status">
{% set address = household.currentAddress %}
{% if address is empty %}
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
{% else %}
<div>
{{ address|chill_entity_render_box({'multiline': true, 'with_valid_from': false}) }}
</div>
{% endif %}
<div class="grid-5">
<ul class="list-content fa-ul">
<li>
{% set address = household.currentAddress %}
<i class="fa fa-li fa-map-marker"></i>
{% if address is empty %}
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
{% else %}
{{ address|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
{% endif %}
</li>
</ul>
</div>
</div>
</div>
<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 id="banner-misc">
{%- set members = household.getCurrentMembersOrdered() -%}
{%- if members|length > 0 -%}
<span class="current-members-explain">
{{- 'household.Current household members'|trans }}:
</span>
{%- for m in members|slice(0, 5) -%}
{{- m.person|chill_entity_render_box({'addLink': false}) -}}
{%- if m.holder %} <span class="badge badge-primary">{{ 'household.holder'|trans }}</span>{% endif -%}
{%- if false == loop.last -%}, {% endif -%}
{%- endfor -%}
{% if members|length > 5 %}
<span class="current-members-more">
{{ 'household.and x other persons'|trans({'x': members|length-5}) }}
</span>
{% endif %}
{%- endif -%}
{%- set members = household.getCurrentMembersOrdered() -%}
{%- if members|length > 0 -%}
<span class="current-members-explain">
{{- 'household.Current household members'|trans }}:
</span>
{%- for m in members|slice(0, 5) -%}
{{- m.person|chill_entity_render_box({'addLink': false}) -}}
{%- if m.holder %}
<span class="badge badge-primary">
{{ 'household.holder'|trans }}
</span>
{% endif -%}
{%- if false == loop.last -%}, {% endif -%}
{%- endfor -%}
{% if members|length > 5 %}
<span class="current-members-more">
{{ 'household.and x other persons'|trans({'x': members|length-5}) }}
</span>
{% endif %}
{%- endif -%}
</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/>.
#}
{#
The layout of the admin section. All the page / template of the admin section must use this
layout.
#}
{% extends "@ChillMain/layoutWithVerticalMenu.html.twig" %}
{% block top_banner %}
<div class="subheader banner banner-person">
<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-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 class="grid-3">
<span class="open_sansbold">{{ 'File number'|trans|upper}}&nbsp;:</span> {{ person.id|upper }}
&mdash;
<i class="fa fa-{% apply spaceless %}
{% if person.gender == "woman" %}
female
{% elseif person.gender == "both" %}
neuter
{% else %}
male
{% endif %}
{% endapply %}"></i>
</div>
<div class="grid-3">
<span class="open_sansbold">{{ 'Phonenumber'|trans|upper }}&nbsp;:</span>
{% set phone = person.mobilenumber|default(person.phonenumber) %}
{% if phone is not empty %}{{ phone|chill_format_phonenumber }}{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}
<div class="grid-5">
<ul class="list-content fa-ul">
<li>
<i class="fa fa-li fa-map-marker"></i>
{%- if person.currentHouseholdAddress is not empty -%}
{{ person.currentHouseholdAddress|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
{%- elseif person.lastAddress is not empty -%}
{{ person.lastAddress|chill_entity_render_box({'multiline': false, 'with_valid_from': false}) }}
{%- else -%}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{%- endif -%}
</li>
<li>
{% if person.mobilenumber %}
<i class="fa fa-li fa-mobile"></i>
<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>
@ -55,16 +81,19 @@
<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-3">
<div class="grid-5">
<span class="open_sansbold">{{ 'Birthdate'|trans|upper }}&nbsp;:</span>
{% if person.birthdate == null %}
{{ 'Unknown date of birth'|trans }}
{% else %}
{{ person.birthdate|format_date('long') }}
{{ person.birthdate|format_date('short') }}
{% endif %}
<span class="age">{{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }}</span>
</div>
{%- if chill_person.fields.nationality == 'visible' -%}
<div class="grid-3">
<div class="grid-4">
<span class="open_sansbold">{{ 'Nationality'|trans|upper}}&nbsp;:</span>
{% if person.nationality is not null %}
{{ person.nationality.name|localize_translatable_string }}
@ -73,13 +102,17 @@
{% endif %}
</div>
{%- endif -%}
{%- if chill_person.fields.spoken_languages == 'visible' -%}
<div class="grid-3">
<span class="open_sansbold">{{ 'Center'|trans|upper}}&nbsp;:</span> {{ person.center.name|upper }}
</div>
{%- endif -%}
</div>
</div>
</div>
<span id="banner-person"></span>
{% endblock %}
{% block layout_wvm_content %}
@ -98,4 +131,4 @@
<div class="block-post-menu">
{{ chill_delegated_block('person_post_vertical_menu', { 'person': person } ) }}
</div>
{% endblock %}
{% endblock %}

View File

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