176 lines
6.6 KiB
Twig

{#
* Copyright (C) 2014-2021, 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 "@ChillPerson/Person/layout.html.twig" %}
{% set activeRouteKey = '' %}
{% block title %}{{ 'Addresses history for %name%'|trans({ '%name%': person.firstName ~ ' ' ~ person.lastName } ) }}{% endblock %}
{% block personcontent %}
<div class="person-address">
<h1>{{ 'Addresses history'|trans }}</h1>
<ul class="record_actions my-3">
<li style="margin: auto;">
{# include vue_address component #}
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'create',
buttonSize: 'btn-lg',
buttonText: 'Add an address',
modalTitle: 'Add an address',
} %}
</li>
</ul>
<div class="address-timeline grid">
{% if person.addresses|length == 0 %}
<span class="chill-no-data-statement">{{ 'No address given'|trans }}</span>
{% else %}
<div class="top"><i class="fa fa-caret-up fa-3x"></i></div>
{% endif %}
<div class="col-a">
<h3 class="mb-5">{{ 'Person addresses'|trans }}</h3>
</div>
<div class="col-b"></div>
<div class="col-c">
<h3 class="mb-5">{{ 'Household addresses'|trans }}</h3>
</div>
{% set row = 0 %}
{% set previousRowFrom = null %}
{% for address in person.addresses %}
{% set row = row + 1 %}
{% if address.validTo is not empty and address.validTo < previousRowFrom %}
<div class="{{ 'row' ~ row ~ ' ' }}col-a action">
<a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div>
{# include vue_address component #}
{#
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit',
addressId: address.id,
bindModalStep1: false,
bindModalStep2: false,
} %}
#}
<div class="{{ 'row' ~ row ~ ' ' }}col-b"></div>
<div class="{{ 'row' ~ row ~ ' ' }}col-c action">
<a href="" class="btn btn-sm btn-create">{{ 'Insert an address'|trans }}</a></div>
{# include vue_address component #}
{#
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
targetEntity: { name: 'person', id: person.id },
backUrl: path('chill_person_address_list', { 'person_id': person.id }),
mode: 'edit',
addressId: address.id,
bindModalStep1: false,
bindModalStep2: false,
} %}
#}
<div class="date">
{% if address.validTo is not empty %}
{{ address.validTo|format_date('short') }}
{% endif %}
</div>
{% set row = row + 1 %}
{% endif %}
{# if person address #}
<div class="{{ 'row' ~ row ~ ' ' }}col-a content">
{{ address|chill_entity_render_box({
'render': 'bloc',
'multiline': true,
'extended_infos': true,
'has_no_address': true
}) }}
<ul class="record_actions">
<li><a href="{{ path('chill_person_address_edit', { 'person_id': person.id, 'address_id' : address.id } ) }}" class="btn btn-edit"></a></li>
</ul>
</div>
{# endif #}
<div class="{{ 'row' ~ row ~ ' ' }}col-b"></div>
{# if household address #}{#
<div class="col-c content rowXX">
<div class="address">...</div>
</div>
#}{# endif #}
<div class="date">
{% if address.validFrom is not empty %}
{{ address.validFrom|format_date('short') }}
{% endif %}
</div>
{% set previousRowFrom = address.validFrom %}
{% endfor %}
{# TEST HOUSEHOLD POSITION
#}
<div class="col-b"></div>
<div class="col-c content fake">
<div class="address">
<div class="street">
<span class="streetNumber">549, chemin De Sousa</span>
<span class="streetNumber">, 45, boulevard Aurore Roux</span>
</div>
<div class="postCode">
<span>10850</span> <span>Nanterre</span> <span class="country">(France)</span>
</div>
<ul class="record_actions"><li><a href="" class="btn btn-edit"></a></li></ul>
</div>
</div>
<div class="date">01/01/1970</div>
{# END TEST #}
</div>
<ul class="record_actions sticky-form-buttons">
<li class="cancel">
<a href="{{ path('chill_person_view', { 'person_id' : person.id } ) }}" class="btn btn-cancel">
{{ 'Back to the person details'|trans }}
</a>
</li>
<li>
<a class="btn btn-create"
href="{{ path('chill_person_address_new', { 'person_id' : person.id } ) }}">
{{ 'Add an address'|trans }}
</a>
</li>
</ul>
</div>
{% endblock %}