chill-bundles/Resources/views/Event/listByPerson.html.twig

114 lines
5.8 KiB
Twig

{#
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "ChillPersonBundle::layout.html.twig" %}
{% set activeRouteKey = 'chill_event__list_by_person' %}
{% set currentPerson = person.firstName ~ ' ' ~ person.lastName %}
{% block title %}{{ 'Events participation' |trans }}{% endblock title %}
{% block personcontent %}
<h2>{{ 'Events participation' |trans }}</h2>
<table class="events">
<thead>
<tr>
<th class="chill-green">{{ 'Date'|trans }}</th>
<th class="chill-red">{{ 'Name'|trans }}</th>
<th class="chill-orange">{{ 'Event type'|trans }}</th>
<th class="chill-red">{{ 'Role'|trans }}</th>
<th class="chill-green">{{ 'Status'|trans }}</th>
<th> </th>
</tr>
</thead>
<tbody>
{% for participation in participations %}
<tr>
<td>{{ participation.event.date|format_date('long', 'short') }}</td>
<td>{{ participation.event.name }}</td>
<td>{{ participation.event.type.name|localize_translatable_string }}</td>
<td>{{ participation.role.name|localize_translatable_string }}</td>
<td>{{ participation.status.name|localize_translatable_string }}</td>
<td>
<ul class="record_actions">
<li>
{% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
{% set returnLabel = 'Back to %person% events'|trans({ '%person%' : currentPerson } ) %}
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %}
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel } ) }}"
class="sc-button bt-show" title="{{ 'See details of the event'|trans }}"></a>
{% endif %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event)
and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<div class="bt-dropdown">
<a href="" class="sc-button bt-update"></a>
<div class="bt-dropdown-content">
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the event'|trans }}
</a>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the participation'|trans }}
</a>
</div>
</div>
{% else %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) %}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the event'|trans }}
</a>
{% endif %}
{% if is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="sc-button bt-update">
{{ 'Edit the participation'|trans }}
</a>
{% endif %}
{% endif %}
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if participations|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }}
{% endif %}
<div style="margin-bottom: 1.5em; margin-top: 2.5em;">
{{ form_start(form_add_event_participation_by_person) }}
{{ form_widget(form_add_event_participation_by_person.event_id, { 'attr' : { 'style' : 'width: 25em; display:inline-block; ' } } ) }}
{{ form_widget(form_add_event_participation_by_person.submit, { 'attr' : { 'class' : 'sc-button bt-create' } } ) }}
{{ form_rest(form_add_event_participation_by_person) }}
{{ form_end(form_add_event_participation_by_person) }}
</div>
{% endblock %}