ChillPersonBundle: Add numberOfDependents and numberOfDependentsWithDisabilities

This commit is contained in:
Christophe Siraut
2024-12-20 11:28:36 +01:00
parent 5f31473c90
commit fbdc0d32f0
15 changed files with 220 additions and 6 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

@@ -63,6 +63,12 @@
</h6>
<p>
{{ 'household_composition.numberOfChildren children in household'|trans({'numberOfChildren': currentComposition.numberOfChildren}) }}
{% if chill_person.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_person.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

@@ -206,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>