mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 15:43:51 +00:00
Merge branch 'master' into notification/completion
This commit is contained in:
@@ -33,7 +33,7 @@ const fetchHouseholdSuggestionByAccompanyingPeriod = (personId) => {
|
||||
|
||||
throw Error ({m: 'Error while fetching household suggestion', status: response.status});
|
||||
}).then(data => Promise.resolve(data.results))
|
||||
.catch(e => console.err(e));
|
||||
.catch(e => console.error(e));
|
||||
;
|
||||
};
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
<div v-else>
|
||||
<p>
|
||||
{{ $t('household_members_editor.concerned.persons_will_be_moved') }} :
|
||||
<span v-for="c in concerned">
|
||||
<span v-for="c in concerned" :key=c.person.id>
|
||||
<person-render-box render="badge" :options="{addLink: false}" :person="c.person"></person-render-box>
|
||||
<button class="btn" @click="removePerson(c.person)" v-if="c.allowRemove" style="padding-left:0;">
|
||||
<span class="fa-stack fa-lg" :title="$t('household_members_editor.concerned.remove_concerned')">
|
||||
@@ -19,6 +19,17 @@
|
||||
</button>
|
||||
</span>
|
||||
</p>
|
||||
<div class="alert alert-info" v-if="concernedPersonsWithHouseholds.length > 0">
|
||||
<p>{{ $t('household_members_editor.concerned.persons_with_household') }}</p>
|
||||
<ul v-for="c in concernedPersonsWithHouseholds" :key=c.person.id>
|
||||
<li>
|
||||
{{ c.person.text }}
|
||||
{{ $t('household_members_editor.concerned.already_belongs_to_household') }}
|
||||
<a target="_blank" :href="this.makeHouseholdLink(c.person.current_household_id)">{{c.person.current_household_id}}</a>.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ul class="record_actions">
|
||||
@@ -59,7 +70,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState([
|
||||
'concerned'
|
||||
'concerned', 'household'
|
||||
]),
|
||||
...mapGetters([
|
||||
'persons',
|
||||
@@ -67,6 +78,15 @@ export default {
|
||||
noPerson () {
|
||||
return this.$store.getters.persons.length === 0;
|
||||
},
|
||||
concernedPersonsWithHouseholds () {
|
||||
if (this.$store.state.household) {
|
||||
return this.$store.state.concerned.filter(c =>
|
||||
c.person.current_household_id !== null && c.person.current_household_id !== this.$store.state.household.id
|
||||
)
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -92,6 +112,9 @@ export default {
|
||||
console.log('remove person in concerned', person);
|
||||
this.$store.dispatch('removePerson', person);
|
||||
},
|
||||
makeHouseholdLink(id) {
|
||||
return `/fr/person/household/${id}/summary`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -2,11 +2,11 @@
|
||||
<current-household></current-household>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li v-if="!hasHouseholdAddress && !isHouseholdForceAddress">
|
||||
<!-- <li v-if="!hasHouseholdAddress && !isHouseholdForceAddress">
|
||||
<button class="btn btn-misc" @click="markNoAddress">
|
||||
{{ $t('household_members_editor.household_address.mark_no_address') }}
|
||||
</button>
|
||||
</li>
|
||||
</li> -->
|
||||
<li v-if="!hasHouseholdAddress">
|
||||
<add-address
|
||||
:context="getAddressContext"
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
|
||||
import { ontheflyMessages } from 'ChillMainAssets/vuejs/OnTheFly/i18n';
|
||||
import { addressMessages } from 'ChillMainAssets/vuejs/Address/i18n';
|
||||
@@ -35,7 +36,7 @@ const appMessages = {
|
||||
create_new_address: "Créer une nouvelle adresse",
|
||||
},
|
||||
concerned: {
|
||||
title: "Usagers déplacés",
|
||||
title: "Usager(s) à (re)positionner dans un ménage",
|
||||
persons_will_be_moved: "Les usagers suivants vont être déplacés",
|
||||
add_at_least_onePerson: "Indiquez au moins un usager à déplacer",
|
||||
remove_concerned: "Ne plus transférer",
|
||||
@@ -45,6 +46,8 @@ const appMessages = {
|
||||
move_to: "Déplacer vers",
|
||||
persons_leaving: "Usagers quittant leurs ménages",
|
||||
no_person_in_position: "Aucun usager ne sera ajouté à cette position",
|
||||
persons_with_household: "Les usagers suivants sont associés à ces ménages:",
|
||||
already_belongs_to_household: "est associé au ménage"
|
||||
},
|
||||
positioning: {
|
||||
persons_to_positionnate: 'Usagers à positionner',
|
||||
|
@@ -224,18 +224,21 @@ const store = createStore({
|
||||
}
|
||||
|
||||
state.concerned.forEach((c, index) => {
|
||||
let m = {
|
||||
id: index * -1,
|
||||
person: c.person,
|
||||
holder: c.holder,
|
||||
position: c.position,
|
||||
};
|
||||
if (c.position === null) {
|
||||
m.position = {
|
||||
ordering: 999999
|
||||
if (!(h.members.map((m) => m.person.id)).includes(c.person.id)) {
|
||||
let m = {
|
||||
id: index * -1,
|
||||
person: c.person,
|
||||
holder: c.holder,
|
||||
position: c.position,
|
||||
};
|
||||
if (c.position === null) {
|
||||
m.position = {
|
||||
ordering: 999999
|
||||
}
|
||||
}
|
||||
h.new_members.push(m);
|
||||
}
|
||||
h.new_members.push(m);
|
||||
|
||||
})
|
||||
|
||||
console.log('fake household', h);
|
||||
@@ -307,7 +310,7 @@ const store = createStore({
|
||||
comment: "",
|
||||
});
|
||||
} else {
|
||||
console.err("person already included");
|
||||
console.error("person already included");
|
||||
}
|
||||
},
|
||||
markPosition(state, { person_id, position_id}) {
|
||||
@@ -533,10 +536,14 @@ const store = createStore({
|
||||
|
||||
// nothing to do anymore here, bye-bye !
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
if (params.has('returnPath')) {
|
||||
window.location.replace(params.get('returnPath'));
|
||||
} else {
|
||||
if (params.has('followAfter')) {
|
||||
window.location.replace(`/fr/person/household/${household_id}/summary`);
|
||||
} else {
|
||||
if (params.has('returnPath')) {
|
||||
window.location.replace(params.get('returnPath'));
|
||||
} else {
|
||||
window.location.replace(`/fr/person/household/${household_id}/summary`);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// we assume the answer was 422...
|
||||
|
@@ -10,6 +10,13 @@ const getPerson = (id) => {
|
||||
});
|
||||
};
|
||||
|
||||
const getPersonAltNames = () =>
|
||||
fetch('/api/1.0/person/config/alt_names.json').then(response => {
|
||||
if (response.ok) { return response.json(); }
|
||||
throw Error('Error with request resource response');
|
||||
});;
|
||||
|
||||
|
||||
/*
|
||||
* POST a new person
|
||||
*/
|
||||
@@ -48,6 +55,7 @@ const patchPerson = (id, body) => {
|
||||
|
||||
export {
|
||||
getPerson,
|
||||
getPersonAltNames,
|
||||
postPerson,
|
||||
patchPerson
|
||||
};
|
||||
|
@@ -21,14 +21,19 @@
|
||||
|
||||
<div v-else-if="action === 'edit' || action === 'create'">
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="lastname" v-model="lastName" v-bind:placeholder="$t('person.lastname')" />
|
||||
<label for="lastname">{{ $t('person.lastname') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="firstname" v-model="firstName" v-bind:placeholder="$t('person.firstname')" />
|
||||
<label for="firstname">{{ $t('person.firstname') }}</label>
|
||||
</div>
|
||||
|
||||
<div class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" id="lastname" v-model="lastName" v-bind:placeholder="$t('person.lastname')" />
|
||||
<label for="lastname">{{ $t('person.lastname') }}</label>
|
||||
<div v-for="(a) in config.altNames" :key="a.key" class="form-floating mb-3">
|
||||
<input class="form-control form-control-lg" :id="a.key" @input="onAltNameInput" />
|
||||
<label :for="a.key">{{ a.labels.fr }}</label>
|
||||
</div>
|
||||
|
||||
<!-- TODO fix placeholder if undefined
|
||||
@@ -71,11 +76,20 @@
|
||||
aria-describedby="mobilenumber" />
|
||||
</div>
|
||||
|
||||
<div class="input-group mb-3">
|
||||
<span class="input-group-text" id="email"><i class="fa fa-fw fa-at"></i></span>
|
||||
<input class="form-control form-control-lg"
|
||||
v-model="email"
|
||||
v-bind:placeholder="$t('person.email')"
|
||||
v-bind:aria-label="$t('person.email')"
|
||||
aria-describedby="email" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getPerson } from '../../_api/OnTheFly';
|
||||
import { getPerson, getPersonAltNames } from '../../_api/OnTheFly';
|
||||
import PersonRenderBox from '../Entity/PersonRenderBox.vue';
|
||||
|
||||
export default {
|
||||
@@ -88,13 +102,19 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
person: {
|
||||
type: 'person'
|
||||
}
|
||||
type: 'person',
|
||||
altNames: []
|
||||
},
|
||||
config: {
|
||||
altNames: []
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
firstName: {
|
||||
set(value) { this.person.firstName = value; },
|
||||
set(value) {
|
||||
this.person.firstName = value;
|
||||
},
|
||||
get() { return this.person.firstName; }
|
||||
},
|
||||
lastName: {
|
||||
@@ -125,6 +145,10 @@ export default {
|
||||
set(value) { this.person.mobilenumber = value; },
|
||||
get() { return this.person.mobilenumber; }
|
||||
},
|
||||
email: {
|
||||
set(value) { this.person.email = value; },
|
||||
get() { return this.person.email; }
|
||||
},
|
||||
genderClass() {
|
||||
switch (this.person.gender) {
|
||||
case 'woman':
|
||||
@@ -150,6 +174,10 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getPersonAltNames()
|
||||
.then(altNames => {
|
||||
this.config.altNames = altNames;
|
||||
});
|
||||
if (this.action !== 'create') {
|
||||
this.loadData();
|
||||
}
|
||||
@@ -162,7 +190,16 @@ export default {
|
||||
console.log('get person', this.person);
|
||||
resolve();
|
||||
}));
|
||||
}
|
||||
},
|
||||
onAltNameInput(event) {
|
||||
const key = event.target.id;
|
||||
const label = event.target.value;
|
||||
let updateAltNames = this.person.altNames.filter((a) => a.key !== key);
|
||||
updateAltNames.push(
|
||||
{'key': key, 'label': label}
|
||||
)
|
||||
this.person.altNames = updateAltNames;
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@@ -30,6 +30,7 @@ const personMessages = {
|
||||
phonenumber: "Téléphone",
|
||||
mobilenumber: "Mobile",
|
||||
altnames: "Autres noms",
|
||||
email: "Courriel",
|
||||
gender: {
|
||||
title: "Genre",
|
||||
placeholder: "Choisissez le genre de l'usager",
|
||||
|
Reference in New Issue
Block a user