Merge branch 'add-dependents' into 'master'

add household properties :  number of dependents and number of dependents with disabilities

See merge request Chill-Projet/chill-bundles!778
This commit is contained in:
2025-02-13 12:41:29 +00:00
35 changed files with 915 additions and 7 deletions

View File

@@ -47,6 +47,36 @@
/>
</div>
</div>
<div v-if="this.displayDependents" class="mb-3 row">
<label class="col-form-label col-sm-4 required">{{
$t("household_members_editor.composition.number_of_dependents")
}}</label>
<div class="col-sm-8">
<input
type="number"
v-model="numberOfDependents"
min="0"
max="30"
class="form-control"
/>
</div>
</div>
<div v-if="this.displayDependents" class="mb-3 row">
<label class="col-form-label col-sm-4 required">{{
$t(
"household_members_editor.composition.number_of_dependents_with_disabilities",
)
}}</label>
<div class="col-sm-8">
<input
type="number"
v-model="numberOfDependentsWithDisabilities"
min="0"
max="30"
class="form-control"
/>
</div>
</div>
</div>
</template>
@@ -62,6 +92,11 @@ export default {
computed: {
...mapState(["householdCompositionTypes"]),
...mapGetters(["isHouseholdNew"]),
displayDependents: {
get() {
return window.household_members_editor_data.displayDependents;
},
},
householdCompositionType: {
get() {
if (this.$store.state.householdCompositionType !== null) {
@@ -81,6 +116,22 @@ export default {
this.$store.commit("setNumberOfChildren", value);
},
},
numberOfDependents: {
get() {
return this.$store.state.numberOfDependents;
},
set(value) {
this.$store.commit("setNumberOfDependents", value);
},
},
numberOfDependentsWithDisabilities: {
get() {
return this.$store.state.numberOfDependentsWithDisabilities;
},
set(value) {
this.$store.commit("setNumberOfDependentsWithDisabilities", value);
},
},
startDate: {
get() {
return this.$store.state.startDate;

View File

@@ -91,6 +91,9 @@ const appMessages = {
composition: "Composition familiale",
household_composition: "Composition du ménage",
number_of_children: "Nombre d'enfants mineurs au sein du ménage",
number_of_dependents: "Nombre de personnes majeures à charge",
number_of_dependents_with_disabilities:
"Nombre de personnes à charge reconnues handicapées",
},
confirmation: {
save: "Enregistrer",

View File

@@ -73,6 +73,8 @@ const store = createStore({
window.household_members_editor_expand_suggestions === 1,
householdCompositionType: null,
numberOfChildren: 0,
numberOfDependents: 0,
numberOfDependentsWithDisabilities: 0,
addressesSuggestion: [],
showAddressSuggestion: true,
householdCompositionTypes: [],
@@ -322,6 +324,9 @@ const store = createStore({
start_date: {
datetime: datetimeToISO(ISOToDate(state.startDate)),
},
number_of_dependents: state.numberOfDependents,
number_of_dependents_with_disabilities:
state.numberOfDependentsWithDisabilities,
};
}
@@ -455,6 +460,12 @@ const store = createStore({
setNumberOfChildren(state, number) {
state.numberOfChildren = Number.parseInt(number);
},
setNumberOfDependents(state, number) {
state.numberOfDependents = Number.parseInt(number);
},
setNumberOfDependentsWithDisabilities(state, number) {
state.numberOfDependentsWithDisabilities = Number.parseInt(number);
},
addAddressesSuggestion(state, addresses) {
let existingIds = state.addressesSuggestion.map((a) => a.address_id);

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_edit_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_edit_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -0,0 +1,42 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_index.html.twig' %}
{% block table_entities_thead_tr %}
<th>id</th>
<th>{{ 'name'|trans }}</th>
<th>{{ 'active'|trans }}</th>
<th>{{ 'ordering'|trans }}</th>
<th></th>
{% endblock %}
{% block table_entities_tbody %}
{% for entity in entities %}
<tr>
<td>{{ entity.id }}</td>
<td>{{ entity.name|localize_translatable_string }}</td>
<td style="text-align:center;">
{%- if entity.active -%}
<i class="fa fa-check-square-o"></i>
{%- else -%}
<i class="fa fa-square-o"></i>
{%- endif -%}
</td>
<td>{{ entity.order }}</td>
<td>
<ul class="record_actions">
<li>
<a href="{{ chill_path_add_return_path('chill_crud_administrative_status_edit', { 'id': entity.id}) }}" class="btn btn-sm btn-edit btn-mini"></a>
</li>
</ul>
</td>
</tr>
{% endfor %}
{% endblock %}
{% block actions_before %}
<li class='cancel'>
<a href="{{ path('chill_main_admin_central') }}" class="btn btn-cancel">{{'Back to the admin'|trans}}</a>
</li>
{% endblock %}
{% endembed %}
{% endblock %}

View File

@@ -0,0 +1,11 @@
{% extends '@ChillMain/CRUD/Admin/index.html.twig' %}
{% block title %}
{% include('@ChillMain/CRUD/_new_title.html.twig') %}
{% endblock %}
{% block admin_content %}
{% embed '@ChillMain/CRUD/_new_content.html.twig' %}
{% block content_form_actions_save_and_show %}{% endblock %}
{% endembed %}
{% endblock admin_content %}

View File

@@ -63,6 +63,12 @@
</h6>
<p>
{{ 'household_composition.numberOfChildren children in household'|trans({'numberOfChildren': currentComposition.numberOfChildren}) }}
{% if chill_household.fields.number_of_dependents == 'visible' %}
<br />
{{ 'household_composition.numberOfDependents adult dependents'|trans({'numberOfDependents': currentComposition.numberOfDependents}) }}
<br />
{{ 'household_composition.numberOfDependentsWithDisabilities dependents with disabilities'|trans({'numberOfDependentsWithDisabilities': currentComposition.numberOfDependentsWithDisabilities}) }}
{% endif %}
</p>
<p>
{{ 'household_composition.Since'|trans({'startDate': currentComposition.startDate}) }}

View File

@@ -21,6 +21,10 @@
<div class="item-col">
<h3>{{ c.householdCompositionType.label|localize_translatable_string }}</h3>
<p>{{ 'household_composition.numberOfChildren'|trans }}: {{ c.numberOfChildren }}</p>
{% if chill_household.fields.number_of_dependents == 'visible' %}
<p>{{ 'household_composition.numberOfDependents'|trans }}: {{ c.numberOfDependents }}</p>
<p>{{ 'household_composition.numberOfDependentsWithDisabilities'|trans }}: {{ c.numberOfDependentsWithDisabilities }}</p>
{% endif %}
</div>
<div class="item-col" style="justify-content: flex-end">{{ 'household_composition.Since'|trans({'startDate': c.startDate}) }}</div>
</div>

View File

@@ -107,6 +107,9 @@
{%- if form.spokenLanguages is defined -%}
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
{%- endif -%}
{%- if form.administrativeStatus is defined -%}
{{ form_row(form.administrativeStatus, {'label' : 'Administrative status'}) }}
{%- endif -%}
{%- if form.employmentStatus is defined -%}
{{ form_row(form.employmentStatus, {'label' : 'Employment status'}) }}
{%- endif -%}

View File

@@ -170,8 +170,20 @@ This view should receive those arguments:
</dd>
</dl>
{%- endif -%}
{% if chill_person.fields.administrative_status == 'visible' %}
<dl>
<dt>{{ 'Administrative status'|trans }}&nbsp;:</dt>
<dd>
{% if person.administrativeStatus is not empty %}
{{ person.administrativeStatus.name|localize_translatable_string }}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</dd>
</dl>
{% endif %}
{% if chill_person.fields.employment_status == 'visible' %}
<dl>
{% if chill_person.fields.employment_status == 'visible' %}
<dt>{{ 'Employment status'|trans }}&nbsp;:</dt>
<dd>
{% if person.employmentStatus is not empty %}
@@ -180,8 +192,8 @@ This view should receive those arguments:
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</dd>
{% endif %}
</dl>
{% endif %}
{%- if chill_person.fields.number_of_children == 'visible' -%}
<dl>
<dt>{{'Number of children'|trans}}&nbsp;:</dt>
@@ -194,6 +206,28 @@ This view should receive those arguments:
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.number_of_dependents == 'isible' -%}
<dl>
<dt>{{'Number of dependents'|trans}}&nbsp;:</dt>
<dd>
{% if person.numberOfDependents is not null %}
{{ person.numberOfDependents }}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</dd>
</dl>
<dl>
<dt>{{'Number of dependents with disabilities'|trans}}&nbsp;:</dt>
<dd>
{% if person.numberOfDependents is not null %}
{{ person.numberOfDependentsWithDisabilities }}
{% else %}
<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>
{% endif %}
</dd>
</dl>
{%- endif -%}
{%- if chill_person.fields.marital_status == 'visible' -%}
<dl>
<dt>{{'Marital status'|trans}}&nbsp;:</dt>