list template adapted to display aside activities ordered by date (DESC)

This commit is contained in:
Julie Lenaerts 2021-08-10 14:18:37 +02:00
parent a1ed0d3ce4
commit bbb69bcfe0
3 changed files with 49 additions and 60 deletions

View File

@ -1,44 +0,0 @@
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h1>{{ 'ActivityType list'|trans }}</h1>
<table class="records_list table table-bordered border-dark">
<thead>
<tr>
{# <th>{{ 'Name'|trans }}</th> #}
<th>{{ 'Active'|trans }}</th>
<th>{{ 'Actions'|trans }}</th>
</tr>
</thead>
<tbody>
{% for entity in entities %}
<tr>
{# <td>{{ entity.name|localize_translatable_string }}</td> #}
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>
<ul class="record_actions sticky-form-buttons">
<li>
<a href="{{ path('chill_crud_activity_type_edit', { 'id': entity.id }) }}" class="btn btn-edit" title="{{ 'edit'|trans }}"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('chill_crud_activity_type_new') }}" class="btn btn-create">
{{ 'Create a new activity type'|trans }}
</a>
</li>
</ul>
{% endblock %}

View File

@ -1,11 +1,7 @@
{# {% set person_id = null %}
{% if person %}
{% set person_id = person.id %}
{% endif %} #}
{% extends "@ChillActivity/Admin/layout_activity.html.twig" %}
{% block admin_content %}
<h2>{{ 'Activity list' |trans }}</h2>
<h2>{{ 'My aside activities' |trans }}</h2>
{% if entities|length == 0 %}
<p class="chill-no-data-statement">
@ -15,15 +11,23 @@
{% else %}
<div class="flex-table list-records">
{% for entity in entities %}
{# Sort activities according to date in descending order #}
{% for entity in entities|sort ((a, b) => b.date <=> a.date) %}
{% set t = entity.type %}
{# only load aside activities of current user. #}
{% if entity.agent == app.user %}
<div class="item-bloc">
<div class="item-row main">
<div class="item-col">
<h3>
<b>{{ entity.type.title | localize_translatable_string }}</b>
</h3>
{% if entity.date %}
<h3>{{ entity.date|format_date('long') }}</h3>
<p>{{ entity.date|format_date('long') }}</p>
{% endif %}
<div class="duration">
@ -38,17 +42,13 @@
<ul class="list-content">
{% if entity.createdBy %}
<li>
<b>{{ 'by'|trans }}{{ entity.createdBy.usernameCanonical }}</b>
<b>{{ 'Created by: '|trans }}{{ entity.createdBy.usernameCanonical }}</b>
</li>
{% endif %}
<li>
<b>{{ entity.type.title | localize_translatable_string }}</b>
</li>
</ul>
</div>
</div>
{%
if entity.note is not empty
or entity.createdBy|length > 0
@ -59,14 +59,42 @@
{{ entity.note|chill_entity_render_box( { 'limit_lines': 3, 'metadata': false } ) }}
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endif %}
<div class="item-col">
<ul class="list-content">
<ul class="record_actions">
{# <li>
<a href="{{ path('chill_crud_aside_activity_show', { 'id': entity.id} ) }}" class="btn btn-show "></a>
</li> #}
{# TOOD
{% if is_granted('CHILL_ACTIVITY_UPDATE', activity) %}
#}
<li>
<a href="{{ path('chill_crud_aside_activity_edit', { 'id': entity.id }) }}" class="btn btn-update "></a>
</li>
{# TOOD
{% endif %}
{% if is_granted('CHILL_ACTIVITY_DELETE', activity) %}
#}
{# <li>
<a href="{{ path('chill_aside_activity_delete', { 'id': entity.id } ) }}" class="btn btn-delete "></a>
</li> #}
{#
{% endif %}
#}
</ul>
</ul>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{# TODO set this condition in configuration #}
<ul class="record_actions">
<li>

View File

@ -29,3 +29,8 @@ Choose a category: Choisir un categorie
1 hour 30: 1 heure 30
1 hour 45: 1 heure 45
2 hours: 2 heures
#list
My aside activities: Mes activités annexes
Date: Date
Created by: Creér par