mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
[household member editor] integrate with adresses and course
* redirection to a returnPath given into query search * button for creating address
This commit is contained in:
@@ -7,25 +7,33 @@
|
||||
</div>
|
||||
<div v-if="isHouseholdNew && !hasHouseholdAddress">
|
||||
|
||||
<h3>À quelle adresse habite ce ménage ?</h3>
|
||||
<h3 >À quelle adresse habite ce ménage ?</h3>
|
||||
|
||||
<ul v-if="filterAddressesSuggestion.length > 0">
|
||||
<li v-for="a in filterAddressesSuggestion">
|
||||
<show-address :address="a"></show-address>
|
||||
<button class="btn" @click="setHouseholdAddress(a)">
|
||||
<div v-if="filterAddressesSuggestion.length > 0" class="flex-table householdAddressSuggestionList">
|
||||
<div v-for="a in filterAddressesSuggestion" class="item-bloc">
|
||||
<show-address :address="a"></show-address>
|
||||
<button class="btn btn-action" @click="setHouseholdAddress(a)">
|
||||
Le ménage habite cette adresse
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else>
|
||||
<span class="chill-no-data-statement">Aucune adresse à suggérer</span>
|
||||
</div>
|
||||
|
||||
<ul class="record_actions">
|
||||
<li >
|
||||
<button class="btn">
|
||||
Créer une adresse
|
||||
</button>
|
||||
<add-address
|
||||
:context="addAddress.context"
|
||||
:key="addAddress.key"
|
||||
:options="addAddress.options"
|
||||
:result="addAddress.result"
|
||||
@submitAddress="setHouseholdAddress"
|
||||
ref="addAddress">
|
||||
</add-address>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
<div v-if="isHouseholdNew && hasHouseholdAddress">
|
||||
<ul class="record_actions">
|
||||
@@ -35,7 +43,7 @@
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div v-else-if="isForceLeaveWithoutHousehold">
|
||||
@@ -51,7 +59,7 @@
|
||||
class="btn btn-misc"
|
||||
@click="toggleHouseholdSuggestion"
|
||||
>
|
||||
{{ $tc('household_members_editor.show_household_suggestion',
|
||||
{{ $tc('household_members_editor.show_household_suggestion',
|
||||
countHouseholdSuggestion) }}
|
||||
</button>
|
||||
</li>
|
||||
@@ -106,11 +114,24 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
div.householdAddressSuggestionList {
|
||||
/*
|
||||
display: flex;
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
|
||||
*/
|
||||
|
||||
& > li {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.householdSuggestionList {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@@ -136,12 +157,45 @@
|
||||
import { mapGetters, mapState } from 'vuex';
|
||||
import HouseholdViewer from 'ChillPersonAssets/vuejs/_components/Household/Household.vue';
|
||||
import ShowAddress from 'ChillMainAssets/vuejs/Address/components/ShowAddress.vue';
|
||||
import AddAddress from 'ChillMainAssets/vuejs/Address/components/AddAddress.vue';
|
||||
|
||||
export default {
|
||||
name: 'Household',
|
||||
components: {
|
||||
HouseholdViewer,
|
||||
ShowAddress,
|
||||
AddAddress,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addAddress: {
|
||||
context: {
|
||||
entity: {
|
||||
type: 'household',
|
||||
id: 0
|
||||
},
|
||||
edit: false,
|
||||
addressId: null
|
||||
},
|
||||
key: 'household_new',
|
||||
options: {
|
||||
hideDateFrom: true,
|
||||
bindModal: {
|
||||
|
||||
},
|
||||
button: {
|
||||
text: {
|
||||
create: null,
|
||||
edit: null,
|
||||
}
|
||||
},
|
||||
title: {
|
||||
create: null,
|
||||
edit: null,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
@@ -172,13 +226,13 @@ export default {
|
||||
allowRemoveHousehold() {
|
||||
return this.$store.getters.hasHousehold &&
|
||||
(
|
||||
this.allowHouseholdCreate || this.allowHouseholdSearch ||
|
||||
this.allowHouseholdCreate || this.allowHouseholdSearch ||
|
||||
this.allowLeaveWithoutHousehold
|
||||
)
|
||||
;
|
||||
},
|
||||
allowChangeHousehold() {
|
||||
return this.allowHouseholdCreate || this.allowHouseholdSearch ||
|
||||
return this.allowHouseholdCreate || this.allowHouseholdSearch ||
|
||||
this.allowLeaveWithoutHousehold;
|
||||
},
|
||||
isForceLeaveWithoutHousehold() {
|
||||
|
@@ -14,8 +14,6 @@ const concerned = window.household_members_editor_data.persons.map(p => {
|
||||
};
|
||||
});
|
||||
|
||||
console.log('expand suggestions', window.household_members_editor_expand_suggestions === 1);
|
||||
|
||||
const store = createStore({
|
||||
strict: debug,
|
||||
state: {
|
||||
@@ -211,7 +209,12 @@ const store = createStore({
|
||||
)
|
||||
},
|
||||
createHousehold(state) {
|
||||
state.household = { type: 'household', members: [], current_address: null, current_members_id: [] }
|
||||
state.household = {
|
||||
type: 'household',
|
||||
members: [],
|
||||
current_address: null,
|
||||
current_members_id: []
|
||||
};
|
||||
state.forceLeaveWithoutHousehold = false;
|
||||
},
|
||||
removeHousehold(state) {
|
||||
@@ -373,8 +376,14 @@ const store = createStore({
|
||||
} else {
|
||||
if (household.type === 'household') {
|
||||
household_id = household.id;
|
||||
|
||||
// nothing to do anymore here, bye-bye !
|
||||
window.location.replace(`/fr/person/household/${household_id}/summary`);
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
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...
|
||||
error = household;
|
||||
|
Reference in New Issue
Block a user