diff --git a/src/components/ContactsList.vue b/src/components/ContactsList.vue index 2e1b3fe4d..ae2965fc0 100644 --- a/src/components/ContactsList.vue +++ b/src/components/ContactsList.vue @@ -35,6 +35,22 @@ + + + + + + + +
+ + + + + +
@@ -103,9 +137,12 @@ import { NcTextField, } from '@nextcloud/vue' import { VList } from 'virtua/vue' +import IconAccountMultiple from 'vue-material-design-icons/AccountMultipleOutline.vue' +import IconBookAccount from 'vue-material-design-icons/BookAccountOutline.vue' import IconSelect from 'vue-material-design-icons/CloseThick.vue' import IconSetMerge from 'vue-material-design-icons/SetMerge.vue' import IconDelete from 'vue-material-design-icons/TrashCanOutline.vue' +import Batch from './ContactsList/Batch.vue' import ContactsListItem from './ContactsList/ContactsListItem.vue' import Merging from './ContactsList/Merging.vue' import RouterMixin from '../mixins/RouterMixin.js' @@ -121,11 +158,14 @@ export default { IconSelect, IconDelete, IconSetMerge, + IconAccountMultiple, + IconBookAccount, NcDialog, NcModal, Merging, NcLoadingIcon, ContactsListItem, + Batch, NcTextField, }, @@ -178,6 +218,8 @@ export default { lastToggledIndex: undefined, isMerging: false, isMergingLoading: false, + isGrouping: false, + isMovingAddressbook: false, } }, @@ -233,6 +275,18 @@ export default { ? t('contacts', 'Merge contacts') : t('contacts', 'Please select two editable contacts to merge') }, + + groupActionTitle() { + return this.isAtLeastOneEditable + ? n('contacts', 'Add {number} contact to group', 'Add {number} contacts to group', this.multiSelectedContacts.size, { number: this.multiSelectedContacts.size }) + : t('contacts', 'Please select at least one editable contact to add to a group') + }, + + addressbookActionTitle() { + return this.isAtLeastOneEditable + ? n('contacts', 'Move {number} contact to addressbook', 'Move {number} contacts to addressbook', this.multiSelectedContacts.size, { number: this.multiSelectedContacts.size }) + : t('contacts', 'Please select at least one editable contact to move to an addressbook') + }, }, watch: { @@ -403,6 +457,17 @@ export default { name: 'root', }) }, + + async finishBatch() { + this.isGrouping = false + this.isMovingAddressbook = false + + for (const contact of this.multiSelectedContacts.values()) { + await this.$store.dispatch('fetchFullContact', { contact, forceReFetch: true }) + } + + this.unselectAllMultiSelected() + }, }, } diff --git a/src/components/ContactsList/Batch.vue b/src/components/ContactsList/Batch.vue new file mode 100644 index 000000000..79443713c --- /dev/null +++ b/src/components/ContactsList/Batch.vue @@ -0,0 +1,237 @@ + + + + + + + diff --git a/src/components/ContactsList/ContactsListItem.vue b/src/components/ContactsList/ContactsListItem.vue index 7a1186700..8dc42fea2 100644 --- a/src/components/ContactsList/ContactsListItem.vue +++ b/src/components/ContactsList/ContactsListItem.vue @@ -13,27 +13,27 @@ :key="source.key" class="list-item-style envelope" :name="source.displayName" - :to="{ name: 'contact', params: { selectedGroup: selectedGroup, selectedContact: source.key } }"> + :to="isStatic ? undefined : { name: 'contact', params: { selectedGroup: selectedGroup, selectedContact: source.key } }">