202 lines
7.5 KiB
Twig

{% extends "@ChillPerson/layout.html.twig" %}
{% set activeRouteKey = 'chill_person_view' %}
{% block title 'household.Household history for %name%'|trans({'name': person|chill_entity_render_string}) %}
{% block personcontent %}
<h1>{{ block('title') }}</h1>
<h2>{{ 'household.Household shared'|trans }}</h2>
{% set memberships = person.getHouseholdParticipationsShareHousehold() %}
{% if memberships|length == 0 %}
<p class="chill-no-data-statement">{{ 'household.Never in any household'|trans }}</p>
<ul class="record_actions">
<li>
<a class="sc-button"
href="{{
chill_path_add_return_path(
'chill_person_household_members_editor',
{ 'persons': [ person.id ]}) }}"
>
<i class="fa fa-sign-out"></i>
{{ 'household.Join'|trans }}
</a>
</li>
</ul>
{% else %}
<div class="household">
<div class="household__address">
{% if not person.isSharingHousehold() %}
<div class="row">
<div class="household__address--date"></div>
<div class="household__address--content">
<div class="cell">
<a class="sc-button"
href="{{
chill_path_add_return_path(
'chill_person_household_members_editor',
{ 'persons': [ person.id ]}) }}"
>
<i class="fa fa-sign-out"></i>
{{ 'household.Join'|trans }}
</a>
</div>
</div>
</div>
{% endif %}
{% for p in memberships %}
<div class="row">
<div class="household__address--date">
<div class="cell">
<div class="pill">
{{ p.startDate|format_date('long') }}
</div>
</div>
</div>
<div class="household__address--content">
<div class="cell">
<i class="dot"></i>
<div>
<div>
<p>
<i class="fa fa-home"></i>
<a
href="{{ chill_path_add_return_path(
'chill_person_household_summary',
{ 'household_id': p.household.id }
) }}"
>
{{ 'household.Household number'|trans({'household_num': p.household.id }) }}
</a>
</p>
<p>{{ p.position.label|localize_translatable_string }} {% if p.holder %}<span class="badge badge-primary">{{ 'household.holder'|trans }}</span>{% endif %}
</div>
<div>
{% set simultaneous = p.household.getMembersDuringMembership(p) %}
{% if simultaneous|length == 0 %}
<p class="chill-no-data-statement">
{{ 'household.Any simultaneous members'|trans }}
</p>
{% else %}
{{ 'household.Members at same time'|trans }}:
{% for p in simultaneous -%}
{{- p.person|chill_entity_render_box({'addLink': true }) -}}
{%- if p.holder %} <span class="badge badge-primary">{{'household.holder'|trans }}</span> {% endif %}
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{% endif %}
<ul class="record_actions">
<li>
<a
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { id: p.id }) }}"
class="sc-button bt-edit"
></a>
</li>
{% if p.isCurrent() %}
<li>
<a class="sc-button"
href="{{ chill_path_add_return_path(
'chill_person_household_members_editor',
{ 'persons': [ person.id ], 'allow_leave_without_household': true }) }}"
>
<i class="fa fa-sign-out"></i>
{{ 'household.Leave'|trans }}
</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endif %}
<h2>{{ 'household.Household not shared'|trans }}</h2>
{% set memberships = person.getHouseholdParticipationsNotShareHousehold() %}
{% if memberships|length == 0 %}
<p class="chill-no-data-statement">{{ 'household.Never in any household'|trans }}</p>
{% else %}
<table>
<thead>
<tr>
<th>{{ 'household.from'|trans }}</th>
<th>{{ 'household.to'|trans }}</th>
<th>{{ 'household.Household'|trans }}</th>
</tr>
</thead>
<tbody>
{% for p in memberships %}
<tr>
<td>{{ p.startDate|format_date('long') }}</td>
<td>
{% if p.endDate is not empty %}
{{ p.endDate|format_date('long') }}
{% else %}
{{ 'household.Membership currently running'|trans }}
{% endif %}
</td>
<td>
<div>
<p>
<i class="fa fa-home"></i>
<a
href="{{ chill_path_add_return_path(
'chill_person_household_summary',
{ 'household_id': p.household.id }
) }}"
>
{{ 'household.Household number'|trans({'household_num': p.household.id }) }}
</a>
</p>
<p>{{ p.position.label|localize_translatable_string }} {% if p.holder %}<span class="badge badge-primary">{{ 'household.holder'|trans }}</span>{% endif %}
</div>
<div>
{% set simultaneous = p.household.getMembersDuringMembership(p) %}
{% if simultaneous|length == 0 %}
<p class="chill-no-data-statement">
{{ 'household.Any simultaneous members'|trans }}
</p>
{% else %}
{{ 'household.Members at same time'|trans }}:
{% for p in simultaneous -%}
{{- p.person|chill_entity_render_box({'addLink': true }) -}}
{%- if p.holder %} <span class="badge badge-primary">{{'household.holder'|trans }}</span> {% endif %}
{%- if not loop.last %}, {% endif -%}
{%- endfor -%}
{% endif %}
</div>
</td>
<td>
<ul class="record_actions">
<li>
<a
href="{{ chill_path_add_return_path('chill_person_household_member_edit', { id: p.id }) }}"
class="sc-button bt-edit"
></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}