mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
search household in household mmebers editor
This commit is contained in:
parent
bc90664480
commit
d1a0934bb1
@ -22,6 +22,7 @@ $chill-theme-buttons: (
|
|||||||
"cancel": $gray-300,
|
"cancel": $gray-300,
|
||||||
"choose": $gray-300,
|
"choose": $gray-300,
|
||||||
"notify": $gray-300,
|
"notify": $gray-300,
|
||||||
|
"search": $gray-300,
|
||||||
"unlink": $chill-red,
|
"unlink": $chill-red,
|
||||||
"tpchild": $chill-pink,
|
"tpchild": $chill-pink,
|
||||||
);
|
);
|
||||||
@ -108,6 +109,7 @@ $chill-theme-buttons: (
|
|||||||
&.btn-notify::before { content: "\f1d8"; } // fa-paper-plane
|
&.btn-notify::before { content: "\f1d8"; } // fa-paper-plane
|
||||||
&.btn-tpchild::before { content: "\f007"; } // fa-user
|
&.btn-tpchild::before { content: "\f007"; } // fa-user
|
||||||
&.btn-download::before { content: "\f019"; } // fa-download
|
&.btn-download::before { content: "\f019"; } // fa-download
|
||||||
|
&.btn-search::before { content: "\f002"; } // fa-search
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
{{ $t('user')}}
|
{{ $t('user')}}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
<span v-if="entity.type === 'household'" class="badge rounded-pill bg-user">
|
||||||
|
{{ $t('household')}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@ -40,7 +45,8 @@ export default {
|
|||||||
company: "Personne morale",
|
company: "Personne morale",
|
||||||
contact: "Personne physique",
|
contact: "Personne physique",
|
||||||
},
|
},
|
||||||
user: 'TMS'
|
user: 'TMS',
|
||||||
|
household: 'Ménage',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,16 @@
|
|||||||
<li v-if="hasHousehold">
|
<li v-if="hasHousehold">
|
||||||
<button @click="resetMode" class="btn btn-sm btn-misc">{{ $t('household_members_editor.household.reset_mode')}}</button>
|
<button @click="resetMode" class="btn btn-sm btn-misc">{{ $t('household_members_editor.household.reset_mode')}}</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li v-if="!hasHousehold">
|
||||||
|
<add-persons
|
||||||
|
modalTitle="Chercher un ménage existant"
|
||||||
|
buttonTitle="Chercher un ménage existant"
|
||||||
|
v-bind:key="addPersons.key"
|
||||||
|
v-bind:options="addPersons.options"
|
||||||
|
@addNewPersons="pickHouseholdFound"
|
||||||
|
ref="pickHousehold"> <!-- to cast child method -->
|
||||||
|
</add-persons>
|
||||||
|
</li>
|
||||||
<li v-if="!hasHousehold">
|
<li v-if="!hasHousehold">
|
||||||
<button @click="setModeNew" class="btn btn-sm btn-create">{{ $t('household_members_editor.household.create_household') }}</button>
|
<button @click="setModeNew" class="btn btn-sm btn-create">{{ $t('household_members_editor.household.create_household') }}</button>
|
||||||
</li>
|
</li>
|
||||||
@ -77,16 +87,30 @@
|
|||||||
import { mapGetters, mapState } from 'vuex';
|
import { mapGetters, mapState } from 'vuex';
|
||||||
import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue';
|
import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue';
|
||||||
import CurrentHousehold from './CurrentHousehold';
|
import CurrentHousehold from './CurrentHousehold';
|
||||||
|
import AddPersons from 'ChillPersonAssets/vuejs/_components/AddPersons';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Household',
|
name: 'Household',
|
||||||
components: {
|
components: {
|
||||||
|
AddPersons,
|
||||||
CurrentHousehold,
|
CurrentHousehold,
|
||||||
HouseholdRenderBox,
|
HouseholdRenderBox,
|
||||||
},
|
},
|
||||||
emits: ['readyToGo'],
|
emits: ['readyToGo'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
addPersons: {
|
||||||
|
key: 'household_find',
|
||||||
|
options: {
|
||||||
|
type: ['household'],
|
||||||
|
priority: null,
|
||||||
|
uniq: true,
|
||||||
|
button: {
|
||||||
|
size: 'btn-sm',
|
||||||
|
type: 'btn-search',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
addAddress: {
|
addAddress: {
|
||||||
key: 'household_new',
|
key: 'household_new',
|
||||||
options: {
|
options: {
|
||||||
@ -166,6 +190,13 @@ export default {
|
|||||||
this.$store.dispatch('selectHousehold', h);
|
this.$store.dispatch('selectHousehold', h);
|
||||||
this.$emit('readyToGo');
|
this.$emit('readyToGo');
|
||||||
},
|
},
|
||||||
|
pickHouseholdFound({selected, modal}) {
|
||||||
|
selected.forEach(function(item) {
|
||||||
|
this.selectHousehold(item.result);
|
||||||
|
}, this);
|
||||||
|
this.$refs.pickHousehold.resetSearch(); // to cast child method
|
||||||
|
modal.showModal = false;
|
||||||
|
},
|
||||||
removeHouseholdAddress() {
|
removeHouseholdAddress() {
|
||||||
this.$store.commit('removeHouseholdAddress');
|
this.$store.commit('removeHouseholdAddress');
|
||||||
},
|
},
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<ul class="record_actions">
|
<ul class="record_actions">
|
||||||
<li class="add-persons">
|
<li class="add-persons">
|
||||||
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
<a class="btn" :class="getClassButton" :title="$t(buttonTitle)"
|
||||||
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
@click="openModal"><span v-if="displayTextButton">{{ $t(buttonTitle) }}</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<teleport to="body">
|
<teleport to="body">
|
||||||
<modal v-if="modal.showModal"
|
<modal v-if="modal.showModal"
|
||||||
:modalDialogClass="modal.modalDialogClass"
|
:modalDialogClass="modal.modalDialogClass"
|
||||||
@close="modal.showModal = false">
|
@close="modal.showModal = false">
|
||||||
@ -181,7 +181,7 @@ export default {
|
|||||||
},
|
},
|
||||||
hasPriorSuggestion() {
|
hasPriorSuggestion() {
|
||||||
return this.search.priorSuggestion.key ? true : false;
|
return this.search.priorSuggestion.key ? true : false;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModal() {
|
openModal() {
|
||||||
|
@ -25,6 +25,11 @@
|
|||||||
v-if="item.result.type === 'user'"
|
v-if="item.result.type === 'user'"
|
||||||
v-bind:item="item">
|
v-bind:item="item">
|
||||||
</suggestion-user>
|
</suggestion-user>
|
||||||
|
|
||||||
|
<suggestion-household
|
||||||
|
v-if="item.result.type === 'household'"
|
||||||
|
v-bind:item="item">
|
||||||
|
</suggestion-household>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@ -34,6 +39,7 @@
|
|||||||
import SuggestionPerson from './TypePerson';
|
import SuggestionPerson from './TypePerson';
|
||||||
import SuggestionThirdParty from './TypeThirdParty';
|
import SuggestionThirdParty from './TypeThirdParty';
|
||||||
import SuggestionUser from './TypeUser';
|
import SuggestionUser from './TypeUser';
|
||||||
|
import SuggestionHousehold from './TypeHousehold';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PersonSuggestion',
|
name: 'PersonSuggestion',
|
||||||
@ -41,6 +47,7 @@ export default {
|
|||||||
SuggestionPerson,
|
SuggestionPerson,
|
||||||
SuggestionThirdParty,
|
SuggestionThirdParty,
|
||||||
SuggestionUser,
|
SuggestionUser,
|
||||||
|
SuggestionHousehold,
|
||||||
},
|
},
|
||||||
props: [
|
props: [
|
||||||
'item',
|
'item',
|
||||||
@ -70,7 +77,7 @@ export default {
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
div.results {
|
div.results {
|
||||||
div.list-item {
|
div.list-item {
|
||||||
padding: 0.4em 0.8em;
|
padding: 0.4em 0.8em;
|
||||||
@ -83,7 +90,7 @@ export default {
|
|||||||
label {
|
label {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
div.container {
|
div.container:not(.household) {
|
||||||
& > input {
|
& > input {
|
||||||
margin-right: 0.8em;
|
margin-right: 0.8em;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<div class="container household">
|
||||||
|
<household-render-box :household="item.result" :isAddressMultiline="false"></household-render-box>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="right_actions">
|
||||||
|
<badge-entity
|
||||||
|
:entity="item.result"
|
||||||
|
:options="{ displayLong: true }">
|
||||||
|
</badge-entity>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import BadgeEntity from 'ChillMainAssets/vuejs/_components/BadgeEntity.vue';
|
||||||
|
import HouseholdRenderBox from 'ChillPersonAssets/vuejs/_components/Entity/HouseholdRenderBox.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'SuggestionHousehold',
|
||||||
|
components: {
|
||||||
|
BadgeEntity,
|
||||||
|
HouseholdRenderBox,
|
||||||
|
},
|
||||||
|
props: ['item'],
|
||||||
|
}
|
||||||
|
</script>
|
@ -91,6 +91,7 @@ class SearchHouseholdApiProvider implements SearchApiInterface
|
|||||||
'JOIN chill_person_person AS person ON vcpha.person_id = person.id'
|
'JOIN chill_person_person AS person ON vcpha.person_id = person.id'
|
||||||
)
|
)
|
||||||
->setSelectKey('household')
|
->setSelectKey('household')
|
||||||
|
->andWhereClause('vcpha.validTo IS NULL', [])
|
||||||
->setSelectJsonbMetadata("jsonb_build_object('id', vcpha.household_id)");
|
->setSelectJsonbMetadata("jsonb_build_object('id', vcpha.household_id)");
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user