add an icon when the file is opened / closed in result list, and in person rendering macro

This commit is contained in:
Julien Fastré 2019-07-02 13:18:34 +02:00
parent 2aecaae749
commit 0ccc998e52
5 changed files with 37 additions and 6 deletions

View File

@ -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

View File

@ -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 {

View File

@ -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

View File

@ -30,7 +30,7 @@
<table>
<thead>
<tr>
<th class="chill-red">{% trans %}Name{% endtrans %}</th>
<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>
</tr>
@ -39,11 +39,16 @@
{% for person in persons %}
<tr>
<td>
<a href="{{ path('chill_person_view', {person_id : person.getId}) }}">
{% 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.firstName}} {{person.lastName}}
{% spaceless %}
{% if person.isOpen == false %}
<i class="icon-lock"></i>
{% if chill_person.fields.accompanying_period == 'visible' %}
{% if is_open == false %}
<i class="fa fa-folder" ></i>
{% else %}
<i class="fa fa-folder-open" ></i>
{% endif %}
{% endif %}
{% endspaceless %}
</a>

View File

@ -1 +1,19 @@
{% macro render(p, withLink=true) %}<span class="entity entity-person person-person">{% if withLink %}<a href="{{ path('chill_person_view', { 'person_id' : p.id } ) }}">{% endif %}{{ p.firstName }}&nbsp;{{ p.lastName }}{% if withLink %}</a>{% endif %}</span>{% endmacro %}
{% macro render(p, withLink=true, withClosingInfo=false) %}{%spaceless %}
<span class="entity entity-person person-person">
{% if withLink %}
<a href="{{ path('chill_person_view', { 'person_id' : p.id } ) }}">
{% endif %}
{{ p.firstName }}&nbsp;{{ p.lastName }}
{% if withClosingInfo %}
{% if chill_person.fields.accompanying_period == 'visible' %}
{% set is_open = p.isOpen() %}
{% if is_open == false %}
<i class="fa fa-folder" ></i>
{% else %}
<i class="fa fa-folder-open" ></i>
{% endif %}
{% endif %}
{% endif %}
{% if withLink %}</a>{% endif %}
</span>{% endspaceless %}
{% endmacro %}