From 0ccc998e521e61a6359e5e10a052b1dbac13b4fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 2 Jul 2019 13:18:34 +0200 Subject: [PATCH] add an icon when the file is opened / closed in result list, and in person rendering macro --- CHANGELOG.md | 1 + Entity/AccompanyingPeriod.php | 7 ++++++- Resources/translations/messages.fr.yml | 2 ++ Resources/views/Person/list.html.twig | 13 +++++++++---- Resources/views/Person/macro.html.twig | 20 +++++++++++++++++++- 5 files changed, 37 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e09cbb8d..298b375a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,3 +46,4 @@ Branche master - fix error on macro renderPerson / withLink not taken into account - add a link between accompanying person and user +- add an icon when the file is opened / closed in result list, and in person rendering macro diff --git a/Entity/AccompanyingPeriod.php b/Entity/AccompanyingPeriod.php index 872a2a978..debc0a18d 100644 --- a/Entity/AccompanyingPeriod.php +++ b/Entity/AccompanyingPeriod.php @@ -128,7 +128,12 @@ class AccompanyingPeriod * * @return boolean */ - public function isOpen() { + public function isOpen(): bool + { + if ($this->getOpeningDate() > new \DateTime('now')) { + return false; + } + if ($this->getClosingDate() === null) { return true; } else { diff --git a/Resources/translations/messages.fr.yml b/Resources/translations/messages.fr.yml index a0bb3a805..17005b044 100644 --- a/Resources/translations/messages.fr.yml +++ b/Resources/translations/messages.fr.yml @@ -120,6 +120,8 @@ Update accompanying period: Mettre à jour une période d'accompagnement 'Closing motive': 'Motif de clôture' 'Person details': 'Détails de la personne' 'Update details for %name%': 'Modifier détails de %name%' +Any accompanying periods are open: Aucune période d'accompagnement ouverte +An accompanying period is open: Une période d'accompagnement est ouverte Accompanying period list: Périodes d'accompagnement Choose a motive: Motif de fermeture Re-open accompanying period: Ré-ouvrir la période d'accompagnement diff --git a/Resources/views/Person/list.html.twig b/Resources/views/Person/list.html.twig index 11252404c..ab1a12a7d 100644 --- a/Resources/views/Person/list.html.twig +++ b/Resources/views/Person/list.html.twig @@ -30,7 +30,7 @@ - + @@ -39,11 +39,16 @@ {% for person in persons %}
{% trans %}Name{% endtrans %}{% trans %}Name{% endtrans %} {% trans %}Date of birth{% endtrans %} {% trans %}Nationality{% endtrans %}
- + {% set is_open = person.isOpen() %} + {{person.firstName}} {{person.lastName}} {% spaceless %} - {% if person.isOpen == false %} - + {% if chill_person.fields.accompanying_period == 'visible' %} + {% if is_open == false %} + + {% else %} + + {% endif %} {% endif %} {% endspaceless %} diff --git a/Resources/views/Person/macro.html.twig b/Resources/views/Person/macro.html.twig index 6c3a50f55..2b193c835 100644 --- a/Resources/views/Person/macro.html.twig +++ b/Resources/views/Person/macro.html.twig @@ -1 +1,19 @@ -{% macro render(p, withLink=true) %}{% if withLink %}{% endif %}{{ p.firstName }} {{ p.lastName }}{% if withLink %}{% endif %}{% endmacro %} \ No newline at end of file +{% macro render(p, withLink=true, withClosingInfo=false) %}{%spaceless %} + + {% if withLink %} + + {% endif %} + {{ p.firstName }} {{ p.lastName }} + {% if withClosingInfo %} + {% if chill_person.fields.accompanying_period == 'visible' %} + {% set is_open = p.isOpen() %} + {% if is_open == false %} + + {% else %} + + {% endif %} + {% endif %} + {% endif %} + {% if withLink %}{% endif %} +{% endspaceless %} +{% endmacro %}