addNewPersons() method is called out of addPerson component

note: this allow to use same addPersons component
to add participations, requestor, or interlocutors
This commit is contained in:
2021-05-08 12:12:58 +02:00
parent 0f59be04a7
commit b24eb93c57
3 changed files with 35 additions and 15 deletions

View File

@@ -55,7 +55,8 @@
</template>
<template v-slot:footer>
<button class="sc-button green" @click="addNewPersons">
<button class="sc-button green"
@click.prevent="$emit('addNewPersons', { selected, modal })">
<i class="fa fa-plus fa-fw"></i>{{ $t('action.add')}}
</button>
</template>
@@ -119,16 +120,8 @@ export default {
this.$nextTick(function() {
this.$refs.search.focus();
})
},
addNewPersons() {
console.log('@@@ CLICK button addNewPersons')
this.selected.forEach(function(item) {
//console.log('# dispatch action for each item', item);
this.$store.dispatch('addParticipation', item);
}, this
);
this.modal.showModal = false;
}
}
},
emits: ['addNewPersons'],
}
</script>