mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
add new / create address + tests
This commit is contained in:
@@ -74,6 +74,7 @@ Chill\PersonBundle\Entity\Person:
|
||||
referencedColumnName: id
|
||||
addresses:
|
||||
targetEntity: Chill\MainBundle\Entity\Address
|
||||
orderBy: { 'validFrom': 'DESC' }
|
||||
joinTable:
|
||||
name: chill_person_persons_to_addresses
|
||||
cascade: [persist, remove, merge, detach]
|
||||
|
@@ -70,6 +70,19 @@ chill_person_accompanying_period_open:
|
||||
path: /{_locale}/person/{person_id}/accompanying-period/open
|
||||
defaults: { _controller: ChillPersonBundle:AccompanyingPeriod:open }
|
||||
|
||||
chill_person_address_list:
|
||||
path: /{_locale}/person/{person_id}/address/list
|
||||
defaults: { _controller: ChillPersonBundle:PersonAddress:list }
|
||||
|
||||
chill_person_address_create:
|
||||
path: /{_locale}/person/{person_id}/address/create
|
||||
defaults: { _controller: ChillPersonBundle:PersonAddress:create }
|
||||
methods: [POST]
|
||||
|
||||
chill_person_address_new:
|
||||
path: /{_locale}/person/{person_id}/address/new
|
||||
defaults: { _controller: ChillPersonBundle:PersonAddress:new }
|
||||
|
||||
chill_person_address_edit:
|
||||
path: /{_locale}/person/{person_id}/address/{address_id}/edit
|
||||
defaults: { _controller: ChillPersonBundle:PersonAddress:edit }
|
||||
|
@@ -76,6 +76,12 @@ Since %date%: Depuis le %date%
|
||||
No address given: Pas d'adresse renseignée
|
||||
The address has been successfully updated: L'adresse a été mise à jour avec succès
|
||||
Update address for %name%: Mettre à jour une adresse pour %name%
|
||||
Addresses'history for %name%: Historique des adresses de %name%
|
||||
Addresses'history: Historique des adresses
|
||||
New address for %name% : Nouvelle adresse pour %name%
|
||||
The new address was created successfully: La nouvelle adresse a été créée
|
||||
Add an address: Ajouter une adresse
|
||||
Back to the person details: Retour aux détails de la personne
|
||||
|
||||
#timeline
|
||||
'An accompanying period is opened for %person% on %date%': Une période d'accompagnement a été ouverte le %date% pour %person%
|
||||
|
@@ -18,10 +18,12 @@
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% block title %}{{ 'Update address for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %}
|
||||
{% block title 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) %}
|
||||
|
||||
{% block personcontent %}
|
||||
|
||||
<h1>{{ 'Update address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_row(form.streetAddress1) }}
|
||||
@@ -29,7 +31,16 @@
|
||||
{{ form_row(form.postCode) }}
|
||||
{{ form_row(form.validFrom) }}
|
||||
|
||||
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-edit' } } ) }}
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-edit' } } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
|
84
Resources/views/Address/list.html.twig
Normal file
84
Resources/views/Address/list.html.twig
Normal file
@@ -0,0 +1,84 @@
|
||||
{#
|
||||
* 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" %}
|
||||
|
||||
{% import 'ChillMainBundle:Address:macro.html.twig' as address_macros %}
|
||||
|
||||
{% set activeRouteKey = '' %}
|
||||
|
||||
{% block title %}{{ 'Addresses\'history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
|
||||
|
||||
{% block personcontent %}
|
||||
|
||||
<h1>{{ 'Addresses\'history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
|
||||
|
||||
<table class="records_list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ 'Valid from'|trans }}</th>
|
||||
<th>{{ 'Address'|trans }}</th>
|
||||
<th> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% if person.addresses|length == 0 %}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
|
||||
{{ 'Add an address'|trans }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
{% for address in person.addresses %}
|
||||
<tr>
|
||||
<td><strong>{{ 'Since %date%'|trans( { '%date%' : address.validFrom|localizeddate('long', 'none') } ) }}</strong></td>
|
||||
|
||||
<td>
|
||||
{{ address_macros._render(address, { 'with_valid_from' : false } ) }}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="sc-button bt-edit">
|
||||
{{ 'Edit'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_view', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
|
||||
{{ 'Back to the person details'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}" class="sc-button btn-create">
|
||||
{{ 'Add an address'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{% endblock personcontent %}
|
47
Resources/views/Address/new.html.twig
Normal file
47
Resources/views/Address/new.html.twig
Normal file
@@ -0,0 +1,47 @@
|
||||
{#
|
||||
* 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 = '' %}
|
||||
|
||||
{% block title %}{{ 'New address for %name%'|trans({ '%name%': person.firstName|capitalize ~ ' ' ~ person.lastName } )|capitalize }}{% endblock %}
|
||||
|
||||
{% block personcontent %}
|
||||
|
||||
<h1>{{ 'New address for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}</h1>
|
||||
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_row(form.streetAddress1) }}
|
||||
{{ form_row(form.streetAddress2) }}
|
||||
{{ form_row(form.postCode) }}
|
||||
{{ form_row(form.validFrom) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_address_list', { 'person_id' : person.id } ) }}" class="sc-button btn-cancel">
|
||||
{{ 'Back to the list'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{{ form_row(form.submit, { 'attr' : { 'class': 'sc-button bt-create' } } ) }}
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
{{ form_end(form) }}
|
||||
|
||||
{% endblock personcontent %}
|
@@ -175,9 +175,15 @@ This view should receive those arguments:
|
||||
{{ address._render(person.lastAddress) }}
|
||||
<a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : person.lastAddress.id } ) }}">
|
||||
{{ 'Edit'|trans }}
|
||||
</a><br/>
|
||||
<a href="{{ path('chill_person_address_list', { 'person_id': person.id } ) }}">
|
||||
{{ 'Addresses\'history'|trans }}
|
||||
</a>
|
||||
{%- else -%}
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
|
||||
<a href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}" class="">
|
||||
{{ 'Add an address'|trans }}
|
||||
</a>
|
||||
{%- endif -%}
|
||||
</dd>
|
||||
</dl>
|
||||
|
Reference in New Issue
Block a user