From fc639552055e094085bc2c11640d3b4e6a6d15f6 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 1 Jul 2021 16:13:07 +0200 Subject: [PATCH] improve banners render : context person, with common improvements on accompanyingcourse and household context --- .../Resources/public/scss/chillmain.scss | 22 +++++ .../ChillPersonBundle/Entity/Person.php | 7 +- .../views/AccompanyingCourse/banner.html.twig | 9 +- .../views/AccompanyingCourse/index.html.twig | 12 ++- .../views/Household/banner.html.twig | 68 ++++++++------ .../Resources/views/layout.html.twig | 93 +++++++++++++------ .../translations/messages.fr.yml | 3 +- 7 files changed, 144 insertions(+), 70 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss index c001c31b9..44b0190d0 100644 --- a/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss +++ b/src/Bundle/ChillMainBundle/Resources/public/scss/chillmain.scss @@ -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 */ diff --git a/src/Bundle/ChillPersonBundle/Entity/Person.php b/src/Bundle/ChillPersonBundle/Entity/Person.php index 3cd0eacd5..c4b36a348 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person.php @@ -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 diff --git a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig index aea493eff..c80dbb4db 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/AccompanyingCourse/banner.html.twig @@ -1,17 +1,19 @@ -
+