filters
This commit is contained in:
@@ -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<FilterContainerProps> = 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<FilterContainerProps> = props => {
|
||||
orientation="verticle"
|
||||
value={selectedFilters[selectedFilterKey]}
|
||||
onValueChange={handleFilterSelection}>
|
||||
{filters[selectedFilterKey].options?.map(
|
||||
{options?.map(
|
||||
option => (
|
||||
<RadioButton
|
||||
value={option.label}
|
||||
@@ -279,56 +288,59 @@ const FiltersContainer: React.FC<FilterContainerProps> = props => {
|
||||
styles.filterColumn,
|
||||
styles.borderRight1,
|
||||
]}>
|
||||
{filterKeys.map(key => (
|
||||
filters[key].filterType !== FILTER_TYPES.SEARCH &&
|
||||
<TouchableOpacity
|
||||
style={[
|
||||
styles.filterSelector,
|
||||
GenericStyles.row,
|
||||
GenericStyles.alignCenter,
|
||||
GenericStyles.spaceBetween,
|
||||
styles.mv8,
|
||||
key === selectedFilterKey &&
|
||||
styles.selectedFilterKey,
|
||||
]}
|
||||
activeOpacity={0.7}
|
||||
onPress={() => {
|
||||
setSelectedFilterKey(key);
|
||||
setFilterSearchString('');
|
||||
}}>
|
||||
<Text
|
||||
style={[
|
||||
key === selectedFilterKey &&
|
||||
styles.blueText,
|
||||
]}
|
||||
dark>
|
||||
{filters[key].displayText}
|
||||
</Text>
|
||||
{selectedFilters[key] && (
|
||||
<View
|
||||
{filterKeys.map(
|
||||
key =>
|
||||
filters[key].filterType !== FILTER_TYPES.SEARCH && (
|
||||
<TouchableOpacity
|
||||
style={[
|
||||
key === selectedFilterKey
|
||||
? styles.filterCountSelected
|
||||
: styles.filterCount,
|
||||
]}>
|
||||
styles.filterSelector,
|
||||
GenericStyles.row,
|
||||
GenericStyles.alignCenter,
|
||||
GenericStyles.spaceBetween,
|
||||
styles.mv8,
|
||||
key === selectedFilterKey &&
|
||||
styles.selectedFilterKey,
|
||||
]}
|
||||
activeOpacity={0.7}
|
||||
onPress={() => {
|
||||
setSelectedFilterKey(key);
|
||||
setFilterSearchString('');
|
||||
}}>
|
||||
<Text
|
||||
style={[
|
||||
key === selectedFilterKey &&
|
||||
GenericStyles.whiteText,
|
||||
styles.blueText,
|
||||
]}
|
||||
bold
|
||||
dark
|
||||
small>
|
||||
{typeof selectedFilters[key] ===
|
||||
'object'
|
||||
? Object.keys(selectedFilters[key])
|
||||
.length
|
||||
: 1}
|
||||
dark>
|
||||
{filters[key].displayText}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
))}
|
||||
{selectedFilters[key] && (
|
||||
<View
|
||||
style={[
|
||||
key === selectedFilterKey
|
||||
? styles.filterCountSelected
|
||||
: styles.filterCount,
|
||||
]}>
|
||||
<Text
|
||||
style={[
|
||||
key === selectedFilterKey &&
|
||||
GenericStyles.whiteText,
|
||||
]}
|
||||
bold
|
||||
dark
|
||||
small>
|
||||
{typeof selectedFilters[key] ===
|
||||
'object'
|
||||
? Object.keys(
|
||||
selectedFilters[key],
|
||||
).length
|
||||
: 1}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
</TouchableOpacity>
|
||||
),
|
||||
)}
|
||||
</View>
|
||||
<View style={[styles.p8, styles.filterColumn]}>
|
||||
{selectedFilterKey && (
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const BASE_AV_APP_URL = 'https://dev-longhorn-portal.np.navi-tech.in/av';
|
||||
export const BASE_AV_APP_URL = 'https://dev-longhorn-server.np.navi-tech.in/av/';
|
||||
|
||||
@@ -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 = () => <View style={styles.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 (
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user