diff --git a/src/components/screens/allCases/allCasesFilters/FiltersContainer.tsx b/src/components/screens/allCases/allCasesFilters/FiltersContainer.tsx index eb40ecd7..a39d46c0 100644 --- a/src/components/screens/allCases/allCasesFilters/FiltersContainer.tsx +++ b/src/components/screens/allCases/allCasesFilters/FiltersContainer.tsx @@ -24,6 +24,7 @@ import { } from '../../../../reducer/allCasesSlice'; import RadioGroup from '../../../../../RN-UI-LIB/src/components/radio_button/RadioGroup'; import RadioButton from '../../../../../RN-UI-LIB/src/components/radio_button/RadioButton'; +import {Search} from '../../../../../RN-UI-LIB/src/utlis/search'; interface FilterContainerProps { closeFilterModal: () => void; @@ -194,15 +195,23 @@ const FiltersContainer: React.FC = props => { const Options = React.useMemo(() => { if (selectedFilterKey) { + const options = + filterSearchString.length > 0 + ? Search( + filterSearchString, + filters[selectedFilterKey].options || [], + {keys: ['label']}, + ).map(option => option.obj) + : filters[selectedFilterKey].options; + console.log('options..........', options); switch (filters[selectedFilterKey].selectionType) { case SELECTION_TYPES.MULTIPLE: - const options = filters[selectedFilterKey].options?.filter( - option => - option.label - .toLowerCase() - .indexOf(filterSearchString) > -1, - ); - // console.log('options..........', options); + // const options = filters[selectedFilterKey].options?.filter( + // option => + // option.label + // .toLowerCase() + // .indexOf(filterSearchString) > -1, + // ); // const selectedFilterValues = selectedFilters[ // selectedFilterKey // ]?.map((x: any) => x.value); @@ -236,7 +245,7 @@ const FiltersContainer: React.FC = props => { orientation="verticle" value={selectedFilters[selectedFilterKey]} onValueChange={handleFilterSelection}> - {filters[selectedFilterKey].options?.map( + {options?.map( option => ( = props => { styles.filterColumn, styles.borderRight1, ]}> - {filterKeys.map(key => ( - filters[key].filterType !== FILTER_TYPES.SEARCH && - { - setSelectedFilterKey(key); - setFilterSearchString(''); - }}> - - {filters[key].displayText} - - {selectedFilters[key] && ( - + filters[key].filterType !== FILTER_TYPES.SEARCH && ( + + styles.filterSelector, + GenericStyles.row, + GenericStyles.alignCenter, + GenericStyles.spaceBetween, + styles.mv8, + key === selectedFilterKey && + styles.selectedFilterKey, + ]} + activeOpacity={0.7} + onPress={() => { + setSelectedFilterKey(key); + setFilterSearchString(''); + }}> - {typeof selectedFilters[key] === - 'object' - ? Object.keys(selectedFilters[key]) - .length - : 1} + dark> + {filters[key].displayText} - - )} - - ))} + {selectedFilters[key] && ( + + + {typeof selectedFilters[key] === + 'object' + ? Object.keys( + selectedFilters[key], + ).length + : 1} + + + )} + + ), + )} {selectedFilterKey && ( diff --git a/src/constants/config.js b/src/constants/config.js index 1c4d773d..3cb54d22 100644 --- a/src/constants/config.js +++ b/src/constants/config.js @@ -1 +1 @@ -export const BASE_AV_APP_URL = 'https://dev-longhorn-portal.np.navi-tech.in/av'; \ No newline at end of file +export const BASE_AV_APP_URL = 'https://dev-longhorn-server.np.navi-tech.in/av/'; diff --git a/src/screens/allCases/AllCases.tsx b/src/screens/allCases/AllCases.tsx index 9ee3bb07..386d5b38 100644 --- a/src/screens/allCases/AllCases.tsx +++ b/src/screens/allCases/AllCases.tsx @@ -12,6 +12,7 @@ import {RootState} from '../../store/store'; import {CaseStatuses, ICaseItem, CaseTypes} from './interface'; import {COMPLETED_STATUSES, ListHeaderItems} from './contants'; import CaseItem from './CaseItem'; +import {Search} from "../../../RN-UI-LIB/src/utlis/search"; export const Separator = () => ; @@ -104,7 +105,8 @@ const AllCases = () => { }; const handleSearchChange = (query: string) => { - const filterList = pendingCases.filter(caseItem => caseItem); + console.log({compiledList}); + const filterList = Search(query , compiledList || [] , { keys: ['customerInfo.name']}); }; return ( diff --git a/src/store/store.ts b/src/store/store.ts index b24d6fdf..0960fed3 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -28,8 +28,8 @@ const persistConfig = { key: 'root', version: 1, storage: AsyncStorage, - whitelist: ['case', 'common', 'user'], - blackList:['case' , 'allCases'], + whitelist: ['case', 'allCases', 'common', 'user'], + blackList: ['case'], }; const persistedReducer = persistReducer(persistConfig, rootReducer);