Fix issues with inexisting fields

This commit is contained in:
Julien Fastré 2024-02-08 21:00:16 +01:00
parent 6e2cce9531
commit cf7338b690
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
3 changed files with 77 additions and 67 deletions

View File

@ -24,85 +24,89 @@
{% block content %} {% block content %}
<h2>{{ 'Events participation' |trans }}</h2> <h2>{{ 'Events participation' |trans }}</h2>
<table class="table table-striped table-bordered border-dark align-middle mt-3 events"> {% if participations|length == 0 %}
<thead> <p class="chill-no-data-statement">{{ 'Any participation for this person'|trans }}</p>
<tr> {% else %}
<th class="chill-green">{{ 'Date'|trans }}</th> <table class="table table-striped table-bordered border-dark align-middle mt-3 events">
<th class="chill-red">{{ 'Name'|trans }}</th> <thead>
<th class="chill-orange">{{ 'Event type'|trans }}</th> <tr>
<th class="chill-red">{{ 'Role'|trans }}</th> <th class="chill-green">{{ 'Date'|trans }}</th>
<th class="chill-green">{{ 'Status'|trans }}</th> <th class="chill-red">{{ 'Name'|trans }}</th>
<th> </th> <th class="chill-orange">{{ 'Event type'|trans }}</th>
</tr> <th class="chill-red">{{ 'Role'|trans }}</th>
</thead> <th class="chill-green">{{ 'Status'|trans }}</th>
<tbody> <th> </th>
{% for participation in participations %} </tr>
<tr> </thead>
<td>{{ participation.event.date|format_date('short') }}</td> <tbody>
<td>{{ participation.event.name }}</td> {% for participation in participations %}
<td>{{ participation.event.type.name|localize_translatable_string }}</td> <tr>
<td>{{ participation.role.name|localize_translatable_string }}</td> <td>{{ participation.event.date|format_date('short') }}</td>
<td>{{ participation.status.name|localize_translatable_string }}</td> <td>{{ participation.event.name }}</td>
<td> <td>{{ participation.event.type.name|localize_translatable_string }}</td>
<div class="btn-group" role="group" aria-label="Button group actions"> <td>{{ participation.role.name|localize_translatable_string }}</td>
<td>{{ participation.status.name|localize_translatable_string }}</td>
<td>
<div class="btn-group" role="group" aria-label="Button group actions">
{% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %} {% set currentPath = path(app.request.attributes.get('_route'), app.request.attributes.get('_route_params')) %}
{% set returnLabel = 'Back to %person% events'|trans({ '%person%' : currentPerson } ) %} {% set returnLabel = 'Back to %person% events'|trans({ '%person%' : currentPerson } ) %}
{% if is_granted('CHILL_EVENT_SEE_DETAILS', participation.event) %} {% 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 } ) }}" <a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel } ) }}"
class="btn btn-primary btn-sm" title="{{ 'See details of the event'|trans }}"> class="btn btn-primary btn-sm" title="{{ 'See details of the event'|trans }}">
<i class="fa fa-fw fa-eye"></i> <i class="fa fa-fw fa-eye"></i>
</a> </a>
{% endif %} {% endif %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) {% if is_granted('CHILL_EVENT_UPDATE', participation.event)
and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %} and is_granted('CHILL_EVENT_PARTICIPATION_UPDATE', participation) %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button class="btn btn-sm btn-warning dropdown-toggle" type="button" id="dropdownEdit" data-bs-toggle="dropdown" aria-expanded="false"> <button class="btn btn-sm btn-warning dropdown-toggle" type="button" id="dropdownEdit" data-bs-toggle="dropdown" aria-expanded="false">
<i class="fa fa-pencil"></i> <i class="fa fa-pencil"></i>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="dropdownEdit"> <ul class="dropdown-menu" aria-labelledby="dropdownEdit">
<li> <li>
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="dropdown-item">
{{ 'Edit the event'|trans }}
</a>
</li>
<li>
<a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="dropdown-item">
{{ 'Edit the participation'|trans }}
</a>
</li>
</ul>
</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 }) }}" <a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="dropdown-item"> class="btn btn-warning btn-sm">
{{ 'Edit the event'|trans }} {{ 'Edit the event'|trans }}
</a> </a>
</li> {% endif %}
<li> {% 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 }) }}" <a href="{{ path('chill_event_participation_edit', { 'participation_id' : participation.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="dropdown-item"> class="btn btn-warning btn-sm">
{{ 'Edit the participation'|trans }} {{ 'Edit the participation'|trans }}
</a> </a>
</li> {% endif %}
</ul>
</div>
{% else %}
{% if is_granted('CHILL_EVENT_UPDATE', participation.event) %} {% endif %}
<a href="{{ path('chill_event__event_edit', { 'event_id' : participation.event.id, 'return_path' : currentPath, 'return_label' : returnLabel }) }}"
class="btn btn-warning btn-sm">
{{ '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="btn btn-warning btn-sm">
{{ 'Edit the participation'|trans }}
</a>
{% endif %}
{% endif %}
</div> </div>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
{% endif %}
{% if participations|length < paginator.getTotalItems %} {% if participations|length < paginator.getTotalItems %}
{{ chill_pagination(paginator) }} {{ chill_pagination(paginator) }}

View File

@ -49,8 +49,12 @@
<tr> <tr>
<th>{{ 'event.fields.location'|trans }}</th> <th>{{ 'event.fields.location'|trans }}</th>
<td> <td>
{{ event.location.name }} {% if event.location is not null %}
{% if event.location.address is not same as(null) %}{{ event.location.address|chill_entity_render_box({'multiline': false, 'with_picto': (event.location.name is empty), 'details_button': true}) }}{% endif %} {{ event.location.name }}
{% if event.location.address is not same as(null) %}{{ event.location.address|chill_entity_render_box({'multiline': false, 'with_picto': (event.location.name is empty), 'details_button': true}) }}{% endif %}
{% else %}
<span class="chill-no-data-statement">{{ 'Any location for this event'|trans }}</span>
{% endif %}
</td> </td>
</tr> </tr>
</tbody> </tbody>

View File

@ -27,6 +27,7 @@ Edit the event: Modifier l'événement
The event was updated: L'événement a été modifié The event was updated: L'événement a été modifié
The event was created: L'événement a été créé The event was created: L'événement a été créé
List of events: Liste des événements List of events: Liste des événements
Any location for this event: Aucune localisation pour cet événement
#crud participation #crud participation
Edit all the participations: Modifier toutes les participations Edit all the participations: Modifier toutes les participations
@ -51,6 +52,7 @@ Remove participation: Supprimer la participation
Delete event: Supprimer l'événement Delete event: Supprimer l'événement
Are you sure you want to remove that participation ?: Êtes-vous certain de vouloir supprimer cette participation ? Are you sure you want to remove that participation ?: Êtes-vous certain de vouloir supprimer cette participation ?
Are you sure you want to remove that event ?: Êtes-vous certain de vouloir supprimer cet événement, ainsi que toutes les participations associées ? Are you sure you want to remove that event ?: Êtes-vous certain de vouloir supprimer cet événement, ainsi que toutes les participations associées ?
Any participation for this person: Cet usager ne participe à aucun évenements
#search #search
Event search: Recherche d'événements Event search: Recherche d'événements