mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fix double person creation + button for creating accompanying course on creation + simplification person create
The controller now register data from a previous post on the form, and register it in the session. The next post compare the data with previous one and, if yes, show a review page if there are "alternate persons.
This commit is contained in:
@@ -20,27 +20,70 @@
|
||||
{% block content %}
|
||||
<div class="col-md-10 col-xxl person-new">
|
||||
|
||||
<h1>{{ 'Add a person'|trans }}</h1>
|
||||
|
||||
{% if alternatePersons is not empty %}
|
||||
<div class="alert alert-warning flash_message">
|
||||
<span>
|
||||
{% transchoice alternatePersons|length with { '%nb%': alternatePersons|length } %}
|
||||
%nb% person with similar name. Please verify that this is a new person
|
||||
{% endtranschoice %}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<table class="table table-bordered border-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="chill-red">{{ 'Name'|trans }}</th>
|
||||
<th class="chill-green">{{ 'Date of birth'|trans }}</th>
|
||||
<th class="chill-orange">{{ 'Nationality'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for person in alternatePersons %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ path('chill_person_view', {'person_id': person.id } ) }}">
|
||||
{{ person|chill_entity_render_string }}{% apply spaceless %}
|
||||
{% if person.isOpen == false %}
|
||||
<i class="icon-lock"></i>
|
||||
{% endif %}
|
||||
{% endapply %}
|
||||
</a>
|
||||
</td>
|
||||
<td>{% if person.birthdate is not null %}{{ person.birthdate|format_date('long') }}{% else %} {% endif %}</td>
|
||||
<td>
|
||||
{% if person.nationality is not null %}{{ person.nationality.name|localize_translatable_string }}{% else %}{{ 'Without nationality'|trans }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
<h1>{{ 'Add a person'|trans }}</h1>
|
||||
|
||||
{{ form_row(form.firstName, { 'label' : 'First name'|trans }) }}
|
||||
{{ form_row(form.firstName, { 'label' : 'First name'|trans }) }}
|
||||
|
||||
{{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }}
|
||||
{{ form_row(form.lastName, { 'label' : 'Last name'|trans }) }}
|
||||
|
||||
{% if form.altNames is defined %}
|
||||
{{ form_widget(form.altNames) }}
|
||||
{% endif %}
|
||||
{% if form.altNames is defined %}
|
||||
{{ form_widget(form.altNames) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.birthdate, { 'label' : 'Date of birth'|trans }) }}
|
||||
{{ form_row(form.birthdate, { 'label' : 'Date of birth'|trans }) }}
|
||||
|
||||
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
||||
{{ form_row(form.gender, { 'label' : 'Gender'|trans }) }}
|
||||
|
||||
{{ form_rest(form) }}
|
||||
|
||||
<button class="btn btn-create" type="submit" alt="add a person">
|
||||
{{ 'Add the person'|trans }}
|
||||
</button>
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
{{ form_widget(form.editPerson, { 'attr': { 'class': 'btn btn-create' }}) }}
|
||||
</li>
|
||||
<li>
|
||||
{{ form_widget(form.createPeriod, { 'attr': { 'class': 'btn btn-create' }}) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
|
@@ -1,97 +0,0 @@
|
||||
{#
|
||||
* 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 "@ChillMain/layout.html.twig" %}
|
||||
|
||||
{% block title %}{{ 'Alreay existing person'|trans }}{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-md-10 col-xxl person-new">
|
||||
|
||||
<div class="alert alert-warning flash_message">
|
||||
<span>
|
||||
{% transchoice alternatePersons|length with { '%nb%': alternatePersons|length } %}
|
||||
%nb% person with similar name. Please verify that this is a new person
|
||||
{% endtranschoice %}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{% if alternatePersons is not empty %}
|
||||
<table class="table table-bordered border-dark">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="chill-red">{{ 'Name'|trans }}</th>
|
||||
<th class="chill-green">{{ 'Date of birth'|trans }}</th>
|
||||
<th class="chill-orange">{{ 'Nationality'|trans }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for person in alternatePersons %}
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ path('chill_person_view', {'person_id': person.id } ) }}">
|
||||
{{ person|chill_entity_render_string }}{% apply spaceless %}
|
||||
{% if person.isOpen == false %}
|
||||
<i class="icon-lock"></i>
|
||||
{% endif %}
|
||||
{% endapply %}
|
||||
</a>
|
||||
</td>
|
||||
<td>{% if person.birthdate is not null %}{{ person.birthdate|format_date('long') }}{% else %} {% endif %}</td>
|
||||
<td>
|
||||
{% if person.nationality is not null %}{{ person.nationality.name|localize_translatable_string }}{% else %}{{ 'Without nationality'|trans }}{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endif %}
|
||||
|
||||
<div id="person_details" class="my-5">
|
||||
{{ form_start(form) }}
|
||||
<h2>{{ 'You will create this person'|trans }}</h2>
|
||||
<dl>
|
||||
<dt>{{ 'Name'|trans }}</dt>
|
||||
<dd>{{ person|chill_entity_render_string }}</dd>
|
||||
|
||||
<dt>{{ 'Date of birth'|trans }}</dt>
|
||||
{% if birthdate is empty %}
|
||||
<dd>{{ 'Unknown date of birth'|trans }}</dd>
|
||||
{% else %}
|
||||
<dd>{{ birthdate|format_date('long') }}</dd>
|
||||
{% endif %}
|
||||
|
||||
<dt>{{ 'Gender'|trans }}</dt>
|
||||
<dd>{{ gender|trans }}</dd>
|
||||
|
||||
{% if form.altNames is defined %}
|
||||
{# mark as rendered #}
|
||||
{{ form_widget(form.altNames) }}
|
||||
{% endif %}
|
||||
</dl>
|
||||
|
||||
{{ form_rest(form) }}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button class="sc-button bt-create change-icon" type="submit"><i class="fa fa-check"></i> {{ 'Confirm the creation'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(form) }}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
Reference in New Issue
Block a user