diff --git a/src/dispatch/static/dispatch/src/participant/ParticipantSearchPopover.vue b/src/dispatch/static/dispatch/src/participant/ParticipantSearchPopover.vue index 7073f9761470..f2a2a9ef8950 100644 --- a/src/dispatch/static/dispatch/src/participant/ParticipantSearchPopover.vue +++ b/src/dispatch/static/dispatch/src/participant/ParticipantSearchPopover.vue @@ -41,9 +41,14 @@ useHotKey([props.hotkey], () => { const emit = defineEmits(["participant-selected"]) // Fetch priorities -const fetchParticipants = async () => { +const fetchParticipants = async (query = "") => { try { - const options = { itemsPerPage: -1 } + const options = { + filter: JSON.stringify([ + { and: [{ model: "IndividualContact", field: "name", op: "like", value: `%${query}%` }] }, + ]), + itemsPerPage: 10, + } const response = await IndividualApi.getAll(options) participants.value = response.data.items.map((item: any) => item.name) } catch (error) { @@ -51,6 +56,14 @@ const fetchParticipants = async () => { } } +watch( + searchQuery, + async (newValue: string) => { + await fetchParticipants(newValue) + }, + { immediate: true } +) + onMounted(() => { fetchParticipants() })