Allow to add multiple participation

The participationController accept a new parameter : `persons_ids`,
which must receive a comma-separated list of person ids. A participation
will be create for all those peoples.

The `new` and `create` actions does not allow to receive both
`person_id` and `persons_ids`.

Tests are added.

ref #6
This commit is contained in:
2016-04-09 23:45:07 +02:00
parent bcfa2c2131
commit 9459d7a287
9 changed files with 626 additions and 31 deletions

View File

@@ -3,30 +3,57 @@
{% import 'ChillPersonBundle:Person:macro.html.twig' as person_macro %}
{% block title 'Participation creation'|trans %}
{% form_theme form _self %}
{% block _collection_row %}
<tr>
<td>
{{ form_widget(form) }}
</td>
<td>
{# {{ form_row(participationField.status) }} #}
</td>
</tr>
{% endblock %}
{% block event_content -%}
<h1>{{ 'Participation creation'|trans }}</h1>
<table>
<tbody>
<tr>
<th>{{ 'Associated person'|trans }}</th>
<td>{{ person_macro.render(participation.person) }}</td>
</tr>
<tr>
<th>{{ 'Associated event'|trans }} </th>
<td>{{ participation.event.name }}</td>
<td>{{ participations[0].event.name }}</td>
</tr>
</tbody>
</table>
{{ form_start(form) }}
{{ form_row(form.role) }}
{{ form_row(form.status) }}
{{ form_start(form) }}
<table>
<thead>
<tr>
<th>{{ 'Person'|trans }}</th>
<th>{{ 'Role'|trans }}</th>
<th>{{ 'Status'|trans }}</th>
</tr>
</thead>
<tbody>
{% for participationField in form.participations %}
<tr>
<td>{{ person_macro.render(participationField.vars.value.person) }}</td>
<td>{{ form_widget(participationField.role) }}</td>
<td>{{ form_widget(participationField.status) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="record_actions">
<li>
<a href="{{ path('chill_event__event_show', { 'event_id' : participation.event.id } ) }}" class="sc-button btn-cancel">
<a href="{{ path('chill_event__event_show', { 'event_id' : participations[0].event.id } ) }}" class="sc-button btn-cancel">
<i class="fa fa-arrow-left"></i>
{{ 'Back to the event'|trans }}
</a>

View File

@@ -21,6 +21,9 @@
</table>
{{ form_start(form) }}
{{ form_errors(form) }}
{{ form_row(form.role) }}
{{ form_row(form.status) }}