Skip to content

Commit

Permalink
personFilter: Expand filter rules to look for last name
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Jul 20, 2023
1 parent 190c767 commit 3f7d7e2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/components/common/person/PersonAutoCompleteFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ export const personFilter = (
options: PersonResponse[],
state: FilterOptionsState<PersonResponse>,
) => {
const displayOptions = options.filter(
(option) =>
option.firstName.toLowerCase().trim().includes(state.inputValue.toLowerCase().trim()) ||
option.email.toLowerCase().trim().includes(state.inputValue.toLowerCase().trim()),
)
const displayOptions = options.filter((option) => {
const name = `${option.firstName.toLowerCase()} ${option.lastName.toLowerCase()}`
return (
name.includes(state.inputValue.toLowerCase()) ||
option.email.toLowerCase().includes(state.inputValue.toLowerCase())
)
})

return displayOptions
}

0 comments on commit 3f7d7e2

Please sign in to comment.