Revert "TP-53768 | Sublabels added in filters"

This commit is contained in:
Anshuman Rai
2024-05-03 11:17:39 +05:30
committed by GitHub
parent 5f9233fadf
commit 228fd20de6
7 changed files with 10 additions and 69 deletions

View File

@@ -134,8 +134,8 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
def VERSION_CODE = 148
def VERSION_NAME = "2.9.7"
def VERSION_CODE = 147
def VERSION_NAME = "2.9.6"
android {
ndkVersion rootProject.ext.ndkVersion

View File

@@ -1,7 +1,7 @@
{
"name": "AV_APP",
"version": "2.9.7",
"buildNumber": "148",
"version": "2.9.6",
"buildNumber": "147",
"private": true,
"scripts": {
"android:dev": "yarn move:dev && react-native run-android",

View File

@@ -25,11 +25,6 @@ export const RANGE_FILTER_SEPARATOR = '-';
export interface Option {
label: string;
value: any;
meta?: Record<string, string[]>;
}
export interface SubLabelOption extends Option {
subLabel?: string;
}
export enum FirestoreUpdateTypes {

View File

@@ -9,7 +9,6 @@ import { IFilterOptionsProps } from './Interface';
import { useSelector } from 'react-redux';
import { RootState } from '../../../../store/store';
import styles from './styles';
import {getKeys, getOptions} from "@components/screens/allCases/allCasesFilters/FilterUtils";
const FilterOptions: React.FC<IFilterOptionsProps> = ({
selectedFilterKey,
@@ -20,21 +19,19 @@ const FilterOptions: React.FC<IFilterOptionsProps> = ({
const { filters } = useSelector((state: RootState) => ({
filters: state.filters.filters,
}));
if (Object.keys(filters).length === 0) {
return null;
return <></>;
}
if (selectedFilterKey) {
const options =
filterSearchString.length > 0
? Search(
filterSearchString,
getOptions(filters[selectedFilterKey.filterGroup].filters[selectedFilterKey.filterKey].options, selectedFilterKey.filterKey) ||
filters[selectedFilterKey.filterGroup].filters[selectedFilterKey.filterKey].options ||
[],
{ keys: getKeys(selectedFilterKey.filterKey) }
{ keys: ['label'] }
).map((option) => option.obj)
: getOptions(filters[selectedFilterKey.filterGroup].filters[selectedFilterKey.filterKey].options, selectedFilterKey.filterKey);
: filters[selectedFilterKey.filterGroup].filters[selectedFilterKey.filterKey].options;
switch (
filters[selectedFilterKey.filterGroup].filters[selectedFilterKey.filterKey].selectionType
) {

View File

@@ -7,14 +7,12 @@ import {
} from '../../../../screens/allCases/interface';
import {
CONDITIONAL_OPERATORS,
FILTER_TYPES, Option,
FILTER_TYPES,
RANGE_FILTER_SEPARATOR,
SELECTION_TYPES, SubLabelOption,
SELECTION_TYPES,
} from '../../../../common/Constants';
import { getObjectValueFromKeys } from '../../../utlis/parsers';
import { _map } from '../../../../../RN-UI-LIB/src/utlis/common';
import { pluralise } from "@utils/commonFunctions";
import { FilterKeys, OptionTypes } from "@components/screens/allCases/allCasesFilters/types";
export const evaluateFilterForCases = (
caseRecord: CaseDetail,
@@ -171,40 +169,3 @@ export function filterTransformer(filterResponseList: FilterResponse[]) {
});
return { filterGroupMap, quickFilters };
}
const populateSubLabelsAndSort = (options: Option[], subLabelKey: string) => options.map(option => {
const subLabelList = option?.meta? option.meta[subLabelKey]: [""];
const subLabel = subLabelList?.length > 0 ? subLabelList[0] : "";
return {
...option,
subLabel
};
}).sort((firstOption, secondOption) => {
if (firstOption.subLabel && secondOption.subLabel && firstOption.subLabel.localeCompare(secondOption.subLabel) === 0) {
return firstOption.label.localeCompare(secondOption.label);
} else if (firstOption.subLabel && secondOption.subLabel) {
return firstOption.subLabel.localeCompare(secondOption.subLabel);
} else if (firstOption?.subLabel) {
return -1;
} else if (secondOption?.subLabel) {
return 1;
} else {
return firstOption.label.localeCompare(secondOption.label);
}
});
export const getOptions = (options: Option[], filterKey: string) => {
if (filterKey === FilterKeys.PIN_CODE) {
return populateSubLabelsAndSort(options, OptionTypes.LOCALITY);
}
return options;
}
export const getKeys = (filterKey: string) => {
if (filterKey === FilterKeys.PIN_CODE) {
return ["label", "subLabel"];
}
return ["label"];
}

View File

@@ -1,8 +0,0 @@
export enum OptionTypes {
COLLECTION_CASE = 'COLLECTION_CASE',
LOCALITY = 'LOCALITY'
}
export enum FilterKeys {
PIN_CODE = 'PINCODE'
}

View File

@@ -520,8 +520,4 @@ export const sendDeviceDetailsToClickstream = async () => {
});
};
export const pluralise = (count: number, singularWord: string, pluralWord: string) => {
return count === 1 ? singularWord : pluralWord;
}
export const isFunction = (fn: unknown): fn is (...args: any[]) => void => typeof fn === 'function';