mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
Household/composition add + fixes household composition editor
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
{%- set countPersonLocation = accompanyingCourse.availablePersonLocation|length -%}
|
||||
{%- set hasPersonLocation = countPersonLocation > 0 -%}
|
||||
<div class="alert alert-danger {% if hasPersonLocation %}alert-with-actions{% endif %}">
|
||||
<div class="float-button bottom"><div class="box">
|
||||
<div class="action">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-sm btn-update change-icon"
|
||||
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-20' }) }}">
|
||||
<i class="fa fa-fw fa-crosshairs"></i>
|
||||
{{ 'fix it'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="float-button bottom">
|
||||
<div class="box">
|
||||
<div class="action">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a class="btn btn-sm btn-update change-icon"
|
||||
href="{{ path('chill_person_accompanying_course_edit', { 'accompanying_period_id': accompanyingCourse.id, '_fragment': 'section-20' }) }}">
|
||||
<i class="fa fa-fw fa-crosshairs"></i>
|
||||
{{ 'fix it'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<p>
|
||||
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}</p>
|
||||
{% if not hasPersonLocation %}
|
||||
<p>
|
||||
{{ 'Associate at least one member with an household, and set an address to this household'|trans }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p>
|
||||
{{ 'This course is located at a temporarily address. You should locate this course to an user'|trans }}</p>
|
||||
{% if not hasPersonLocation %}
|
||||
<p>
|
||||
{{ 'Associate at least one member with an household, and set an address to this household'|trans }}</p>
|
||||
{% endif %}
|
||||
</div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -4,12 +4,14 @@
|
||||
{% block title 'household.Edit household members'|trans %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-md-10 col-xxl household-members">
|
||||
<div class="row">
|
||||
<div class="col-md-10 col-xxl household-members">
|
||||
|
||||
<h1>{{ block('title') }}</h1>
|
||||
<div id="household_members_editor"></div>
|
||||
<h1>{{ block('title') }}</h1>
|
||||
<div id="household_members_editor"></div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
|
@@ -51,7 +51,42 @@
|
||||
</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 %}
|
||||
@@ -176,13 +211,26 @@
|
||||
<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 } %}
|
||||
{% include '@ChillPerson/Household/_render_member.html.twig' with {
|
||||
'member': m,
|
||||
'customButtons': { 'before': _self.buttonsOldMembers(m) }
|
||||
} %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -0,0 +1,96 @@
|
||||
{% extends '@ChillPerson/Household/layout.html.twig' %}
|
||||
|
||||
{% block title 'household_composition.Compositions'|trans %}
|
||||
|
||||
{% block block_post_menu %}
|
||||
<div class="post-menu"></div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="household_composition">
|
||||
<h1>{{ block('title') }}</h1>
|
||||
|
||||
{% if compositions|length == 0 %}
|
||||
<p class="chill-no-data-statement">{{ 'household_composition.No composition yet'|trans }}</p>
|
||||
{% else %}
|
||||
<div class="flex-table">
|
||||
{% for c in compositions %}
|
||||
{% if c.id != editId %}
|
||||
<div class="item-bloc">
|
||||
<div class="item-row">
|
||||
<div class="item-col">
|
||||
<h3>{{ c.householdCompositionType.label|localize_translatable_string }}</h3>
|
||||
<p>{{ 'household_composition.numberOfChildren'|trans }}: {{ c.numberOfChildren }}</p>
|
||||
</div>
|
||||
<div class="item-col">{{ 'household_composition.Since'|trans({'startDate': c.startDate}) }}</div>
|
||||
</div>
|
||||
<div class="item-row">
|
||||
<div class="item-col">
|
||||
{% if c.endDate is null %}
|
||||
<span class="chill-no-data-statement">{{ 'household_composition.Still active'|trans }}</span>
|
||||
{% else %}
|
||||
{{ 'household_composition.Until'|trans({'endDate': c.endDate })}}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% if c.comment.comment is not empty %}
|
||||
<div class="item-row separator">
|
||||
{{ c.comment|chill_entity_render_box }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if is_granted('CHILL_PERSON_HOUSEHOLD_EDIT', c.household) %}
|
||||
<div class="item-row">
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<a href="{{ path('chill_person_household_composition_index', {'id': c.household.id, 'edit': c.id}) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('chill_person_household_composition_index', {'id': c.household.id, 'edit': c.id}) }}" class="btn btn-edit"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_widget(form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li class="cancel">
|
||||
<a href="{{ path('chill_person_household_composition_index', {'id': c.household.id}) }}">{{ 'Cancel'|trans }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(form) }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="collapseForm" class="{% if not isPosted %}collapse{% endif %}">
|
||||
{{ form_start(form) }}
|
||||
|
||||
{{ form_widget(form) }}
|
||||
|
||||
<ul class="record_actions">
|
||||
<li>
|
||||
<button type="submit" class="btn btn-create">{{ 'Save'|trans }}</button>
|
||||
</li>
|
||||
</ul>
|
||||
{{ form_end(form) }}
|
||||
</div>
|
||||
|
||||
{% if editId == -1 %}
|
||||
<ul class="record_actions sticky-form-buttons">
|
||||
<li>
|
||||
<button class="btn btn-primary btn-create change-icon" type="button" data-bs-toggle="collapse" data-bs-target="#collapseForm" aria-expanded="false" aria-controls="collapseForm">
|
||||
{{ 'Create'|trans }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user