mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
256 lines
12 KiB
Twig
256 lines
12 KiB
Twig
{% extends '@ChillPerson/Household/layout.html.twig' %}
|
|
|
|
{% block title 'household.Household summary'|trans %}
|
|
|
|
{% block block_post_menu %}
|
|
<div class="post-menu"></div>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="household-summary">
|
|
|
|
{#
|
|
<h1>{{ block('title') }}</h1>
|
|
<h2>{{ 'household.Current address'|trans }}</h2>
|
|
#}
|
|
|
|
{% set address = household.currentAddress %}
|
|
|
|
<div class="row household-resume">
|
|
<div class="item-bloc col-5 col-address">
|
|
<h2>{{ 'Address'|trans }}</h2>
|
|
|
|
{% if address is empty %}
|
|
<p class="chill-no-data-statement">{{ 'household.Household does not have any address currently'|trans }}</p>
|
|
{% else %}
|
|
{{ address|chill_entity_render_box({'multiline': true, 'extended_infos': true }) }}
|
|
{% endif %}
|
|
|
|
<ul class="list-inline text-right mt-2">
|
|
<li class="list-inline-item">
|
|
{# include vue_address component #}
|
|
{% include '@ChillMain/Address/_insert_vue_address.html.twig' with {
|
|
targetEntity: { name: 'household', id: household.id },
|
|
backUrl: path('chill_person_household_summary', { 'household_id': household.id }),
|
|
onlyButton: true,
|
|
mode: 'new',
|
|
buttonSize: 'btn-sm',
|
|
buttonText: 'Move household',
|
|
modalTitle: 'Move household',
|
|
buttonDisplayText: false,
|
|
useValidFrom: true,
|
|
} %}
|
|
</li>
|
|
<li class="list-inline-item">
|
|
<a class="btn btn-secondary btn-sm" title="{{ "Addresses history"|trans }}"
|
|
href="{{ path('chill_person_household_addresses', { 'household_id': household.id } ) }}">
|
|
<i class="fa fa-list fa-fw"></i>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="item-bloc col-7 col-comment">
|
|
{% if form is null %}
|
|
{% set currentComposition = household.currentComposition %}
|
|
{% if currentComposition is not null %}
|
|
<div>
|
|
<h6>
|
|
{{ currentComposition.householdCompositionType.label|localize_translatable_string }}
|
|
</h6>
|
|
<p>
|
|
{{ 'household_composition.numberOfChildren children in household'|trans({'numberOfChildren': currentComposition.numberOfChildren}) }}
|
|
</p>
|
|
<p>
|
|
{{ 'household_composition.Since'|trans({'startDate': currentComposition.startDate}) }}
|
|
</p>
|
|
<ul class="record_actions">
|
|
<li>
|
|
<a class="btn btn-sm btn-update change-icon"
|
|
href="{{ path('chill_person_household_composition_index', {'id': household.id}) }}">
|
|
{{ 'household_composition.Update composition'|trans }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% else %}
|
|
<div class="alert alert-danger">
|
|
<p>
|
|
{{ 'household_composition.Currently no composition'|trans }}
|
|
</p>
|
|
<ul class="record_actions" style="margin-bottom: 0">
|
|
<li>
|
|
<a class="btn btn-sm btn-update change-icon"
|
|
href="{{ path('chill_person_household_composition_index', {'id': household.id}) }}">
|
|
{{ 'household_composition.Add a composition'|trans }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
{% if household.waitingForBirth or not household.commentMembers.isEmpty() %}
|
|
<div class="p-4 bg-light">
|
|
{% if household.waitingForBirth %}
|
|
<i class="fa fa-check-square-o pe-2"></i>
|
|
{% if household.waitingForBirthDate is not null %}
|
|
{{ 'household.Expecting for birth on date'|trans({ 'date': household.waitingForBirthDate|format_date('long') }) }}
|
|
{% else %}
|
|
{{ 'household.Expecting for birth'|trans }}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if not household.commentMembers.isEmpty() %}
|
|
{{ household.commentMembers|chill_entity_render_box }}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not household.commentMembers.isEmpty() %}
|
|
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
|
|
class="btn btn-edit btn-block">
|
|
{{ 'household.Edit comment and expecting birth'|trans }}
|
|
</a>
|
|
{% else %}
|
|
<a href="{{ chill_path_add_return_path('chill_person_household_summary', { 'household_id': household.id, 'edit': 1 }) }}"
|
|
class="btn btn-create btn-block">
|
|
{{ 'household.New comment and expecting birth'|trans }}
|
|
</a>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
{{ form_start(form) }}
|
|
<div id="waitingForBirthContainer">
|
|
{{ form_widget(form.waitingForBirth) }}
|
|
</div>
|
|
<div id="waitingForBirthDateContainer">
|
|
{{ form_widget(form.waitingForBirthDate) }}
|
|
</div>
|
|
<div class="mt-3">
|
|
{{ form_widget(form.commentMembers) }}
|
|
</div>
|
|
<ul class="record_actions">
|
|
<li>
|
|
<button type="submit" class="btn btn-save" id="form_household_comment_confirm">
|
|
{{ 'Save'|trans }}
|
|
</button>
|
|
</li>
|
|
</ul>
|
|
{{ form_end(form) }}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="my-5">{{ 'household.Household members'|trans }}</h2>
|
|
|
|
{% for p in positions|merge([ '_none' ]) %}
|
|
|
|
{% if p == '_none' %}
|
|
{% set members = household.currentMembersWithoutPosition %}
|
|
{% set old_members = household.nonCurrentMembersWithoutPosition %}
|
|
{% else %}
|
|
{%- set members = household.currentMembersByPosition(p) %}
|
|
{% set old_members = household.nonCurrentMembersByPosition(p) %}
|
|
{% endif %}
|
|
|
|
{% if not (p == '_none' and members|length == 0 and old_members|length == 0) %}
|
|
<div class="mb-5">
|
|
{% if p != '_none' %}
|
|
<h3>{{ p.label|localize_translatable_string }}
|
|
{% if false == p.shareHousehold %}
|
|
<i class="chill-help-tooltip" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-html="true"
|
|
title="{{ 'household.Those members does not share address'|trans }}"></i>
|
|
{% endif %}
|
|
</h3>
|
|
{% else %}
|
|
<h3 class="chill-entity">{{ 'household.Members without position'|trans }}</h3>
|
|
{% endif %}
|
|
|
|
|
|
{% macro customButtons(member, household) %}
|
|
<li>
|
|
<a href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'persons': [ member.person.id ], 'allow_leave_without_household': true } ) }}"
|
|
class="btn btn-sm btn-misc" title="{{ 'household.person.leave'|trans }}"><i class="fa fa-scissors"></i></a>
|
|
</li>
|
|
<li>
|
|
<a href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'persons': [ member.person.id ], 'household': household.id} ) }}"
|
|
class="btn btn-sm btn-misc" title="{{ 'household.Change position'|trans }}"><i class="fa fa-arrows-h"></i></a>
|
|
</li>
|
|
{% endmacro %}
|
|
|
|
{% if members|length > 0 %}
|
|
<div class="flex-table list-household-members">
|
|
{% for m in members %}
|
|
{% include '@ChillPerson/Household/_render_member.html.twig' with {
|
|
'member': m,
|
|
'customButtons': { 'before': _self.customButtons(m, household) }
|
|
} %}
|
|
{% endfor %}
|
|
</div>
|
|
{% else %}
|
|
<p class="chill-no-data-statement">{{ 'household.Any persons into this position'|trans }}</p>
|
|
{% endif %}
|
|
|
|
{% if old_members|length > 0 %}
|
|
<div class="accordion" id="nonCurrent">
|
|
<div class="accordion-item">
|
|
<h2 class="accordion-header" id="heading_{{ p == '_none' ? '_none' : p.id }}">
|
|
<button
|
|
class="accordion-button collapsed"
|
|
type="button"
|
|
data-bs-toggle="collapse"
|
|
data-bs-target="#collapse_{{ p == '_none' ? '_none' : p.id }}"
|
|
aria-expanded="false"
|
|
aria-controls="collapse_{{ p == '_none' ? '_none' : p.id }}">
|
|
<span class="folded">{{ 'household.Show future or past memberships'|trans({'length': old_members|length}) }}</span>
|
|
<span class="unfolded text-secondary">{{ 'household.Hide memberships'|trans }}</span>
|
|
</button>
|
|
</h2>
|
|
|
|
{% macro buttonsOldMembers(member) %}
|
|
{% set household = member.person.getCurrentHousehold %}
|
|
{% if household is not null %}
|
|
<li>
|
|
<a href="{{ path('chill_person_household_summary', { 'household_id': household.id }) }}" class="btn btn-sm btn-chill-beige"><i class="fa fa-home"></i></a>
|
|
</li>
|
|
{% endif %}
|
|
{% endmacro %}
|
|
|
|
<div id="collapse_{{ p == '_none' ? '_none' : p.id }}"
|
|
class="accordion-collapse collapse"
|
|
aria-labelledby="heading_{{ p == '_none' ? '_none' : p.id }}"
|
|
data-bs-parent="#nonCurrent">
|
|
<div class="flex-table my-0 list-household-members">
|
|
{% for m in old_members %}
|
|
{% include '@ChillPerson/Household/_render_member.html.twig' with {
|
|
'member': m,
|
|
'customButtons': { 'before': _self.buttonsOldMembers(m) }
|
|
} %}
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
|
|
|
|
<ul class="record_actions">
|
|
<li>
|
|
<a href="{{ chill_path_add_return_path('chill_person_household_members_editor', {'household': household.id }) }}"
|
|
class="btn btn-create">
|
|
{{ 'household.Add a member'|trans }}
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block js %}
|
|
{{ encore_entry_script_tags('page_household_edit_metadata') }}
|
|
{% endblock %}
|