From 84700a27af49c834e74fef7b58c5b0559d18c906 Mon Sep 17 00:00:00 2001 From: rhahao <26148770+rhahao@users.noreply.github.com> Date: Sat, 14 Dec 2024 12:41:36 +0300 Subject: [PATCH] feat(persons): allow search for talk titles in speakers catalog --- .../my_congregation/speaker_edit/index.tsx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/features/persons/speakers_catalog/my_congregation/speaker_edit/index.tsx b/src/features/persons/speakers_catalog/my_congregation/speaker_edit/index.tsx index f99fb5c509..6193dc0a46 100644 --- a/src/features/persons/speakers_catalog/my_congregation/speaker_edit/index.tsx +++ b/src/features/persons/speakers_catalog/my_congregation/speaker_edit/index.tsx @@ -118,6 +118,21 @@ const SpeakerEditView = ({ speaker }: SpeakerEditViewType) => { getOptionLabel={(option: PublicTalkType) => option.talk_number.toString() } + filterOptions={(options, params) => { + const inputValue = params.inputValue.toLowerCase(); + + return options.filter((record) => { + const numberMatch = record.talk_number + .toString() + .includes(inputValue); + + const titleMatch = record.talk_title + .toLowerCase() + .includes(inputValue); + + return numberMatch || titleMatch; + }); + }} value={selectedTalks} onChange={(e, value: PublicTalkType[]) => handleTalksUpdate(value)} renderOption={(props, option) => (