diff options
-rw-r--r-- | src/components/EntityPicker/ContactsPicker.vue | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/components/EntityPicker/ContactsPicker.vue b/src/components/EntityPicker/ContactsPicker.vue index e35813ed..72181d49 100644 --- a/src/components/EntityPicker/ContactsPicker.vue +++ b/src/components/EntityPicker/ContactsPicker.vue @@ -13,6 +13,7 @@ :data-types="pickerTypes" :data-set="pickerData" @close="onContactPickerClose" + @search="onSearch" @submit="onContactPickerPick" /> </template> @@ -25,6 +26,8 @@ import { NcModal as Modal } from '@nextcloud/vue' import AddToGroupView from '../../views/Processing/AddToGroupView.vue' import appendContactToGroup from '../../services/appendContactToGroup.js' import EntityPicker from './EntityPicker.vue' +import { getSuggestions } from '../../services/collaborationAutocompletion' +import { showError } from '@nextcloud/dialogs' export default { name: 'ContactsPicker', @@ -167,6 +170,20 @@ export default { }) }, + /** + * On EntityPicker search. + * + * @param {string} term the searched term + */ + async onSearch(term) { + try { + this.pickerData = await getSuggestions(term) + } catch (error) { + console.error('Unable to get the results', error) + showError(t('contacts', 'Unable to get the results')) + } + }, + closeProcess() { this.pickerforGroup = null this.isProcessing = false |