mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-22 07:33:50 +00:00
no store for AddPersons, move store in data component
note: this allow to use same addPersons component to add participations, requestor, or interlocutors. each addPersons component has his own data()
This commit is contained in:
@@ -25,9 +25,10 @@
|
||||
|
||||
<add-persons
|
||||
buttonTitle="persons_associated.add_persons"
|
||||
v-bind:key="addNewPersons.key"
|
||||
v-bind:options="addNewPersons.options"
|
||||
@addNewPersons="addNewPersons">
|
||||
v-bind:key="addPersons.key"
|
||||
v-bind:options="addPersons.options"
|
||||
@addNewPersons="addNewPersons"
|
||||
ref="addPersons"> <!-- to cast child method -->
|
||||
</add-persons>
|
||||
|
||||
</div>
|
||||
@@ -46,7 +47,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
addNewPersons: {
|
||||
addPersons: {
|
||||
key: 'persons_associated',
|
||||
options: {
|
||||
type: ['person'],
|
||||
@@ -62,6 +63,7 @@ export default {
|
||||
}),
|
||||
methods: {
|
||||
removeParticipation(item) {
|
||||
console.log('@@ CLICK remove participation: item', item);
|
||||
this.$store.dispatch('removeParticipation', item);
|
||||
},
|
||||
closeParticipation(item) {
|
||||
@@ -71,10 +73,10 @@ export default {
|
||||
addNewPersons({ selected, modal }) {
|
||||
console.log('@@@ CLICK button addNewPersons', selected);
|
||||
selected.forEach(function(item) {
|
||||
//console.log('# dispatch action for each item', item);
|
||||
this.$store.dispatch('addParticipation', item);
|
||||
}, this
|
||||
);
|
||||
this.$refs.addPersons.resetSearch(); // to cast child method
|
||||
modal.showModal = false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user