Merge remote-tracking branch 'origin/master' into features/edit-accompanying-period-social-work

This commit is contained in:
2021-06-25 21:26:21 +02:00
25 changed files with 644 additions and 78 deletions

View File

@@ -0,0 +1,57 @@
import { ShowHide } from 'ShowHide/show_hide.js';
const maritalStatus = document.getElementById("maritalStatus");
const maritalStatusDate = document.getElementById("maritalStatusDate");
const personEmail = document.getElementById("personEmail");
const personAcceptEmail = document.getElementById("personAcceptEmail");
const personPhoneNumber = document.getElementById("personPhoneNumber");
const personAcceptSMS = document.getElementById("personAcceptSMS");
new ShowHide({
froms: [maritalStatus],
container: [maritalStatusDate],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('select').values()) {
if (input.value) {
return true
}
}
}
return false;
},
event_name: 'change'
});
new ShowHide({
froms: [personEmail],
container: [personAcceptEmail],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value) {
return true
}
}
}
return false;
},
event_name: 'input'
});
new ShowHide({
froms: [personPhoneNumber],
container: [personAcceptSMS],
test: function(froms) {
for (let f of froms.values()) {
for (let input of f.querySelectorAll('input').values()) {
if (input.value) {
return true
}
}
}
return false;
},
event_name: 'input'
});

View File

@@ -24,6 +24,12 @@
<div v-if="errors.length > 0">
{{ errors }}
</div>
<div v-if="loading">
{{ $t('loading') }}
</div>
<div v-if="success">
{{ $t('household_address_move_success') }}
</div>
</div>
<div>
<ul class="record_actions sticky-form-buttons">
@@ -65,6 +71,12 @@ export default {
},
errors() {
return this.$store.state.errorMsg;
},
loading() {
return this.$store.state.loading;
},
success() {
return this.$store.state.success;
}
},
methods: {

View File

@@ -7,7 +7,9 @@ const appMessages = {
add_an_address_to_household: 'Déménager le ménage',
validFrom: 'Date du déménagement',
move_date: 'Date du déménagement',
back_to_the_list: 'Retour à la liste'
back_to_the_list: 'Retour à la liste',
household_address_move_success: 'La nouvelle adresse du ménage est enregistrée',
loading: 'chargement en cours...'
}
};

View File

@@ -12,7 +12,9 @@ const store = createStore({
newAddress: {},
household: {},
validFrom: {},
errorMsg: []
errorMsg: [],
loading: false,
success: false
},
getters: {
},
@@ -31,12 +33,18 @@ const store = createStore({
addDateToAddress(state, validFrom) {
console.log('@M addDateToAddress address.validFrom', validFrom);
state.validFrom = validFrom;
},
setLoading(state, b) {
state.loading = b;
},
setSuccess(state, b) {
state.success = b;
}
},
actions: {
addAddress({ commit }, payload) {
console.log('@A addAddress payload', payload);
commit('setLoading', true);
if('newPostalCode' in payload){
postPostalCode(payload.newPostalCode)
.then(postalCode => {
@@ -46,9 +54,11 @@ const store = createStore({
.then(address => new Promise((resolve, reject) => {
commit('addAddress', address);
resolve();
commit('setLoading', false);
}))
.catch((error) => {
commit('catchError', error);
commit('setLoading', false);
});
})
@@ -57,15 +67,17 @@ const store = createStore({
.then(address => new Promise((resolve, reject) => {
commit('addAddress', address);
resolve();
commit('setLoading', false);
}))
.catch((error) => {
commit('catchError', error);
commit('setLoading', false);
});
}
},
addDateToAddressAndAddressToHousehold({ commit }, payload) {
console.log('@A addDateToAddressAndAddressToHousehold payload', payload);
commit('setLoading', true);
patchAddress(payload.addressId, payload.body)
.then(address => new Promise((resolve, reject) => {
commit('addDateToAddress', address.validFrom);
@@ -74,14 +86,18 @@ const store = createStore({
postAddressToHousehold(payload.householdId, payload.addressId)
.then(household => new Promise((resolve, reject) => {
commit('addAddressToHousehold', household);
commit('setSuccess', true);
commit('setLoading', false);
resolve();
}))
.catch((error) => {
commit('catchError', error);
commit('setLoading', false);
})
))
.catch((error) => {
commit('catchError', error);
commit('setLoading', false);
});
},
}

View File

@@ -67,9 +67,9 @@
<h3>{{ p.person.firstname ~ ' ' ~ p.person.lastname }}</h3>
<p>
{% set born = (p.person.gender == 'woman') ? 'née': 'né' %}
{% set gender = (p.person.gender == 'woman') ? 'fa-venus' :
{% set gender = (p.person.gender == 'woman') ? 'fa-venus' :
(p.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
{% set genderTitle = (p.person.gender == 'woman') ? 'femme' :
{% set genderTitle = (p.person.gender == 'woman') ? 'femme' :
(p.person.gender == 'man') ? 'homme' : 'neutre' %}
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle }}"></i>{{ born ~ ' le ' ~ p.person.birthdate|format_date('short') }}
</p>
@@ -103,9 +103,9 @@
</li>
{% if p.person.isSharingHousehold %}
<li>
<a
<a
href="{{ chill_path_add_return_path(
'chill_person_household_summary',
'chill_person_household_summary',
{ 'household_id': p.person.getCurrentHousehold.id }
) }}"
class="sc-button">
@@ -128,7 +128,7 @@
{% for r in accompanyingCourse.resources %}
<div class="item-bloc">
{% if r.person %}
<div class="item-row">
<div class="item-col">
<h3>
@@ -137,9 +137,9 @@
</h3>
<p>
{% set born = (r.person.gender == 'woman') ? 'née': 'né' %}
{% set gender = (r.person.gender == 'woman') ? 'fa-venus' :
{% set gender = (r.person.gender == 'woman') ? 'fa-venus' :
(r.person.gender == 'man') ? 'fa-mars' : 'fa-neuter' %}
{% set genderTitle = (r.person.gender == 'woman') ? 'femme' :
{% set genderTitle = (r.person.gender == 'woman') ? 'femme' :
(r.person.gender == 'homme') ? 'fa-mars' : 'neutre' %}
<i class="fa fa-fw {{ gender }}" title="{{ genderTitle }}"></i>{{ born ~ ' le ' ~ r.person.birthdate|format_date('short') }}
</p>
@@ -174,10 +174,10 @@
</ul>
</div>
</div>
{% endif %}
{% if r.thirdParty %}
<div class="item-row">
<div class="item-col">
<h3>
@@ -214,7 +214,7 @@
</ul>
</div>
</div>
{% endif %}
</div>
{% endfor %}
@@ -222,9 +222,11 @@
<h2>{{ 'Social actions'|trans }}</h2>
<h2>{{ 'Last events on accompanying course'|trans }}</h2>
{% set person = null %}
{% block contentActivity %}
{% include 'ChillActivityBundle:Activity:list.html.twig' with {'context': 'accompanyingCourse', 'context': 'person'} %}
{% endblock %}
{# ==> insert accompanyingCourse vue component #}
<div id="accompanying-course"></div>
<div id="accompanying-course"></div>
{% endblock %}

View File

@@ -43,6 +43,7 @@
{{ form_widget(form.altNames, { 'label': 'Alternative names'}) }}
{% endif %}
{{ form_row(form.gender, {'label' : 'Gender'}) }}
{{ form_row(form.genderComment, { 'label' : 'Comment on the gender'} ) }}
</fieldset>
<fieldset>
@@ -54,9 +55,12 @@
{%- if form.countryOfBirth is defined -%}
{{ form_row(form.countryOfBirth, { 'label' : 'Country of birth' } ) }}
{%- endif -%}
{%- if form.deathdate is defined -%}
{{ form_row(form.deathdate, { 'label' : 'Date of death' } ) }}
{%- endif -%}
</fieldset>
{%- if form.nationality is defined or form.spokenLanguages is defined or form.maritalStatus is defined -%}
{%- if form.nationality is defined or form.spokenLanguages is defined -%}
<fieldset>
<legend><h2>{{ 'Administrative information'|trans }}</h2></legend>
{%- if form.nationality is defined -%}
@@ -65,8 +69,21 @@
{%- if form.spokenLanguages is defined -%}
{{ form_row(form.spokenLanguages, {'label' : 'Spoken languages'}) }}
{%- endif -%}
</fieldset>
{%- endif -%}
{%- if form.numberOfChildren is defined or form.maritalStatus is defined -%}
<fieldset>
<legend><h2>{{ 'Marital status'|trans }}</h2></legend>
{{ form_row(form.numberOfChildren, {'label' : 'Number of children'}) }}
{%- if form.maritalStatus is defined -%}
{{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }}
<div id="maritalStatus">
{{ form_row(form.maritalStatus, { 'label' : 'Marital status'} ) }}
</div>
<div id="maritalStatusDate">
{{ form_row(form.maritalStatusDate, { 'label' : 'Date of last marital status change'} ) }}
{{ form_row(form.maritalStatusComment, { 'label' : 'Comment on the marital status'} ) }}
</div>
{%- endif -%}
</fieldset>
{%- endif -%}
@@ -75,13 +92,24 @@
<fieldset>
<legend><h2>{{ 'Contact information'|trans }}</h2></legend>
{%- if form.email is defined -%}
{{ form_row(form.email, {'label': 'Email'}) }}
<div id="personEmail">
{{ form_row(form.email, {'label': 'Email'}) }}
</div>
<div id="personAcceptEmail">
{{ form_row(form.acceptEmail, {'label' : 'Accept emails ?'}) }}
</div>
{%- endif -%}
{%- if form.phonenumber is defined -%}
{{ form_row(form.phonenumber, {'label': 'Phonenumber'}) }}
{%- endif -%}
{%- if form.mobilenumber is defined -%}
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
<div id="personPhoneNumber">
{{ form_row(form.mobilenumber, {'label': 'Mobilenumber'}) }}
</div>
<div id="personAcceptSMS">
{{ form_row(form.acceptSMS, {'label' : 'Accept short text message ?'}) }}
</div>
{%- endif -%}
{%- if form.otherPhoneNumbers is defined -%}
{{ form_widget(form.otherPhoneNumbers) }}
@@ -114,3 +142,8 @@
{% endblock personcontent %}
{% block js %}
<script type="text/javascript" src="{{ asset('build/person.js') }}"></script>
{% endblock js %}

View File

@@ -73,12 +73,14 @@ This view should receive those arguments:
<dt>{{ 'Gender'|trans }}&nbsp;:</dt>
<dd>{{ ( person.gender|default('Not given'))|trans }}</dd>
{% if not person.genderComment.isEmpty %}
<dt>{{ 'Gender comment'|trans }}&nbsp;:</dt>
<dd>{{ person.genderComment|chill_entity_render_box }}</dd>
{% endif %}
</dl>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
@@ -114,11 +116,14 @@ This view should receive those arguments:
{% endif %}
{% endapply %}</dd>
{%- endif -%}
{% if person.deathdate is not null %}
<dt>{{ 'Date of death'|trans }}&nbsp;:</dt>
<dd>{{ person.deathdate|format_date('long') }}</dd>
{% endif %}
</dl>
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
</div>
@@ -155,6 +160,21 @@ This view should receive those arguments:
</dd>
</dl>
{%- endif -%}
{%-if chill_person.fields.number_of_children == 'visible' -%}
<dl>
<dt>{{'Number of children'|trans}}&nbsp;:</dt>
<dd>
{% if person.numberOfChildren is not null %}
{{ person.numberOfChildren }}
{% 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>
@@ -166,11 +186,24 @@ This view should receive those arguments:
{% endif %}
</dd>
</dl>
<dl>
<dt>{{'Date of last marital status change'|trans}}&nbsp;:</dt>
{% if person.maritalStatusDate is not null %}
<dd>
{{ person.maritalStatusDate|format_date('long') }}
</dd>
{% endif %}
</dl>
<dl>
{% if not person.maritalStatusComment.isEmpty %}
<dt>{{'Comment on the marital status'|trans}}&nbsp;:</dt>
<dd>
{{ person.maritalStatusComment|chill_entity_render_box }}
</dd>
{% endif %}
</dl>
{%- endif -%}
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
{%- endif -%}
@@ -213,6 +246,13 @@ This view should receive those arguments:
<dl>
<dt>{{ 'Email'|trans }}&nbsp;:</dt>
<dd>{% if person.email is not empty %}<a href="mailto:{{ person.email|escape('html_attr') }}">{{ person.email }}</a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}</span>{% endif %}</dd>
{%- if person.email is not empty and person.acceptEmail -%}
<dd>
<span class="badge badge-secondary">
{{- 'Accept emails'|trans -}}
</span>
</dd>
{%- endif -%}
</dl>
{%- endif -%}
{%- if chill_person.fields.phonenumber == 'visible' -%}
@@ -225,6 +265,13 @@ This view should receive those arguments:
<dl>
<dt>{{ 'Mobilenumber'|trans }}&nbsp;:</dt>
<dd>{% if person.mobilenumber is not empty %}<a href="tel:{{ person.mobilenumber }}"><pre>{{ person.mobilenumber|chill_format_phonenumber }}</pre></a>{% else %}<span class="chill-no-data-statement">{{ 'No data given'|trans }}{% endif %}</dd>
{%- if person.mobilenumber is not empty and person.acceptSMS -%}
<dd>
<span class="badge badge-secondary">
{{- 'Accept short text message'|trans -}}
</span>
</dd>
{%- endif -%}
</dl>
{% endif %}
{% for pp in person.otherPhoneNumbers %}
@@ -253,9 +300,6 @@ This view should receive those arguments:
</dl>
{%- endif -%}
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
{%- endif -%}
@@ -272,14 +316,21 @@ This view should receive those arguments:
<div class="grid-10 push-1 grid-mobile-12 grid-tablet-12 push-mobile-0 push-tablet-0 parent">
<figure class="person-details">
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
{{ include(edit_tmp_name, edit_tmp_args) }}
{% endif %}
</figure>
</div>
{% endif %}
{% if is_granted('CHILL_PERSON_UPDATE', person) %}
<ul class="grid-12 sticky-form-buttons record_actions ">
<li>
<a class="sc-button bt-update" href="{{ path('chill_person_general_edit', { 'person_id': person.id }) }}">
{{ 'Edit'|trans }}
</a>
</li>
</ul>
{% endif %}
</div> <!-- end of div.person-view -->
{% endblock %}