@@ -10,16 +10,19 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
1010import { Dialog , DialogContent , DialogHeader , DialogTitle , DialogDescription } from ' @/components/ui/dialog'
1111import { Phone , PhoneIncoming , PhoneOutgoing , PhoneOff , PhoneMissed , Clock , RefreshCw , Mic } from ' lucide-vue-next'
1212import DataTable , { type Column } from ' @/components/shared/DataTable.vue'
13+ import SearchInput from ' @/components/shared/SearchInput.vue'
1314
1415const { t } = useI18n ()
1516const store = useCallingStore ()
1617
1718// Filters
19+ const phoneSearch = ref (' ' )
1820const statusFilter = ref (' all' )
1921const accountFilter = ref (' all' )
2022const directionFilter = ref (' all' )
2123const ivrFlowFilter = ref (' all' )
2224const currentPage = ref (1 )
25+ let searchTimeout: number | null = null
2326const pageSize = 20
2427const accounts = ref <{ name: string }[]>([])
2528const ivrFlows = ref <IVRFlow []>([])
@@ -56,6 +59,7 @@ function fetchLogs() {
5659 account: accountFilter .value !== ' all' ? accountFilter .value : undefined ,
5760 direction: directionFilter .value !== ' all' ? directionFilter .value : undefined ,
5861 ivr_flow_id: ivrFlowFilter .value !== ' all' ? ivrFlowFilter .value : undefined ,
62+ phone: phoneSearch .value || undefined ,
5963 page: currentPage .value ,
6064 limit: pageSize
6165 })
@@ -148,6 +152,14 @@ watch([statusFilter, accountFilter, directionFilter, ivrFlowFilter], () => {
148152 currentPage .value = 1
149153 fetchLogs ()
150154})
155+
156+ watch (phoneSearch , () => {
157+ if (searchTimeout ) clearTimeout (searchTimeout )
158+ searchTimeout = window .setTimeout (() => {
159+ currentPage .value = 1
160+ fetchLogs ()
161+ }, 300 )
162+ })
151163 </script >
152164
153165<template >
@@ -166,7 +178,8 @@ watch([statusFilter, accountFilter, directionFilter, ivrFlowFilter], () => {
166178 <!-- Filters -->
167179 <Card >
168180 <CardContent class =" pt-6" >
169- <div class =" flex gap-4 flex-wrap" >
181+ <div class =" flex gap-4 flex-wrap items-center" >
182+ <SearchInput v-model =" phoneSearch" :placeholder =" t('calling.searchByPhone')" class =" w-48" />
170183 <Select v-model =" statusFilter" >
171184 <SelectTrigger class =" w-48" >
172185 <SelectValue :placeholder =" t('calling.filterByStatus')" />
@@ -218,7 +231,7 @@ watch([statusFilter, accountFilter, directionFilter, ivrFlowFilter], () => {
218231
219232 <!-- Table -->
220233 <Card >
221- <CardContent class =" p-0 " >
234+ <CardContent class =" pt-6 " >
222235 <DataTable
223236 :items =" store.callLogs"
224237 :columns =" columns"
0 commit comments