mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
upgrade forms to update and create person
This commit is contained in:
parent
2a3ebb3659
commit
2358e2a9bb
@ -316,7 +316,7 @@ class PersonController extends Controller {
|
|||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
return $this->redirect($this->generateUrl('chill_person_view',
|
return $this->redirect($this->generateUrl('chill_person_view',
|
||||||
array('id' => $person->getId())));
|
array('person_id' => $person->getId())));
|
||||||
} else {
|
} else {
|
||||||
$r = new Response('this should not happen if you reviewed your submission');
|
$r = new Response('this should not happen if you reviewed your submission');
|
||||||
$r->setStatusCode(400);
|
$r->setStatusCode(400);
|
||||||
|
@ -25,22 +25,15 @@ class PersonType extends AbstractType
|
|||||||
->add('genre', new GenderType(), array(
|
->add('genre', new GenderType(), array(
|
||||||
'required' => false
|
'required' => false
|
||||||
))
|
))
|
||||||
->add('civil_union', new CivilType(), array(
|
|
||||||
'required' => false
|
|
||||||
))
|
|
||||||
->add('nbOfChild', 'integer', array('required' => false))
|
|
||||||
->add('belgian_national_number', new BelgianNationalNumberType(),
|
|
||||||
array('required' => false))
|
|
||||||
->add('memo', 'textarea', array('required' => false))
|
->add('memo', 'textarea', array('required' => false))
|
||||||
->add('address', 'textarea', array('required' => false))
|
|
||||||
->add('email', 'textarea', array('required' => false))
|
->add('email', 'textarea', array('required' => false))
|
||||||
->add('countryOfBirth', 'entity', array(
|
->add('countryOfBirth', 'entity', array(
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'class' => 'CL\Chill\MainBundle\Entity\Country'
|
'class' => 'Chill\MainBundle\Entity\Country'
|
||||||
))
|
))
|
||||||
->add('nationality', 'entity', array(
|
->add('nationality', 'entity', array(
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'class' => 'CL\Chill\MainBundle\Entity\Country'
|
'class' => 'Chill\MainBundle\Entity\Country'
|
||||||
))
|
))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@ -60,6 +53,6 @@ class PersonType extends AbstractType
|
|||||||
*/
|
*/
|
||||||
public function getName()
|
public function getName()
|
||||||
{
|
{
|
||||||
return 'cl_chill_personbundle_person';
|
return 'chill_personbundle_person';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
Chill\PersonBundle\Entity\Person:
|
Chill\PersonBundle\Entity\Person:
|
||||||
properties:
|
properties:
|
||||||
belgian_national_number:
|
|
||||||
- NotBlank:
|
|
||||||
groups: [general]
|
|
||||||
- CL\BelgianNationalNumberBundle\Validator\Constraint\BelgianNationalNumber:
|
|
||||||
groups: [general]
|
|
||||||
name:
|
name:
|
||||||
- NotBlank:
|
- NotBlank:
|
||||||
groups: [general, creation]
|
groups: [general, creation]
|
||||||
@ -28,14 +23,6 @@ Chill\PersonBundle\Entity\Person:
|
|||||||
- Date:
|
- Date:
|
||||||
message: validation.Person.constraint.dateOfBirth.not_valid
|
message: validation.Person.constraint.dateOfBirth.not_valid
|
||||||
groups: [general, creation]
|
groups: [general, creation]
|
||||||
nbOfChild:
|
|
||||||
- Range:
|
|
||||||
min: 0
|
|
||||||
max: 20
|
|
||||||
minMessage: validation.Person.constraint.nbOfChild_min
|
|
||||||
maxMessage: validation.Person.constraint.nbOfChild_max
|
|
||||||
invalidMessage: validation.Person.constraint.nbOfChild_invalid
|
|
||||||
groups: [general]
|
|
||||||
history:
|
history:
|
||||||
- Valid:
|
- Valid:
|
||||||
traverse: true
|
traverse: true
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "CLChillMainBundle::layout.html.twig" %}
|
{% extends "ChillMainBundle::layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'views.Person.creation.title'|trans }}{% endblock title %}
|
{% block title %}{{ 'views.Person.creation.title'|trans }}{% endblock title %}
|
||||||
|
|
||||||
@ -13,8 +13,6 @@
|
|||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="person_wrapper">
|
<div id="person_wrapper">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends "CLChillMainBundle::layout.html.twig" %}
|
{% extends "ChillMainBundle::layout.html.twig" %}
|
||||||
|
|
||||||
{% block title %}{{ 'views.Person.review.title'|trans }}{% endblock title %}
|
{% block title %}{{ 'views.Person.review.title'|trans }}{% endblock title %}
|
||||||
|
|
||||||
@ -13,7 +13,6 @@
|
|||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
@ -31,7 +30,7 @@
|
|||||||
{% for person in alternatePersons %}
|
{% for person in alternatePersons %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ path('chill_person_view', {'id': person.id } ) }}">
|
<a href="{{ path('chill_person_view', {'person_id': person.id } ) }}">
|
||||||
{{ person }}{% spaceless %}{% if person.isOpen == false %}<i class="icon-lock"></i>{% endif %}
|
{{ person }}{% spaceless %}{% if person.isOpen == false %}<i class="icon-lock"></i>{% endif %}
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
</a>
|
</a>
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
|
|
||||||
{% block personcontent %}
|
{% block personcontent %}
|
||||||
|
|
||||||
{% form_theme form 'CLChillMainBundle:Form:fields.html.twig' %}
|
{% form_theme form 'ChillMainBundle:Form:fields.html.twig' %}
|
||||||
|
|
||||||
{{ form_start(form) }}
|
{{ form_start(form) }}
|
||||||
{% set include_temp = 'ChillPersonBundle:Form:form_control.html.twig' %}
|
{% set include_temp = 'ChillPersonBundle:Form:form_control.html.twig' %}
|
||||||
{% set include_args = {'return_key': 'chill_person_view',
|
{% set include_args = {'return_key': 'chill_person_view',
|
||||||
'return_args' : { 'id' : person.id} } %}
|
'return_args' : { 'person_id' : person.id} } %}
|
||||||
{{ include(include_temp, include_args) }}
|
{{ include(include_temp, include_args) }}
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -32,26 +32,15 @@
|
|||||||
|
|
||||||
{{ include(include_temp, include_args) }}
|
{{ include(include_temp, include_args) }}
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<legend><h2>{{ 'views.Person.view.family'|trans }}</h2></legend>
|
|
||||||
{{ form_row(form.civil_union, {'label' : 'views.Person.view.civil_union'}) }}
|
|
||||||
{{ form_row(form.nbOfChild, {'label' : 'views.Person.view.nb_of_childs'}) }}
|
|
||||||
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
{{ include(include_temp, include_args) }}
|
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><h2>{{ 'views.Person.view.administrative'|trans }}</h2></legend>
|
<legend><h2>{{ 'views.Person.view.administrative'|trans }}</h2></legend>
|
||||||
{{ form_row(form.nationality, { 'label' : 'views.Person.view.nationality'|trans} ) }}
|
{{ form_row(form.nationality, { 'label' : 'views.Person.view.nationality'|trans} ) }}
|
||||||
{{ form_row(form.belgian_national_number, { 'label' : 'views.Person.view.national_number'}) }}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{ include(include_temp, include_args) }}
|
{{ include(include_temp, include_args) }}
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><h2>{{ 'views.Person.view.contact'|trans }}</h2></legend>
|
<legend><h2>{{ 'views.Person.view.contact'|trans }}</h2></legend>
|
||||||
{{ form_row(form.address, {'label' : 'views.Person.view.address'}) }}
|
|
||||||
{{ form_row(form.email, {'label': 'views.Person.view.email'}) }}
|
{{ form_row(form.email, {'label': 'views.Person.view.email'}) }}
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user