diff --git a/src/screens/MainScreen/Dashboard/index.js b/src/screens/MainScreen/Dashboard/index.js index 54b9418..71c48af 100644 --- a/src/screens/MainScreen/Dashboard/index.js +++ b/src/screens/MainScreen/Dashboard/index.js @@ -191,6 +191,7 @@ const Dashboard = (props) => { const restItems = filteredGraphs?.slice(1); const graphDetails = mainDisplayJson?.graphDetails || []; const [visitedStoreData1, setVisitedStoreData] = useState([]); + const [searchQuery, setSearchQuery] = useState(''); // 🧠 Initialize tabCache state at the top of your component const [tabCache, setTabCache] = useState({}); @@ -592,7 +593,7 @@ const Dashboard = (props) => { setStoreList(resData) setLoading(false) - console.log('storeSearchApi====>', resData); + console.log('storeSearchApi====>', JSON.stringify(resData)); } catch (error) { setLoading(false) @@ -700,22 +701,22 @@ const Dashboard = (props) => { // hideRules={true} hideYAxisLine={true} yAxisThickness={0} - xAxisThickness={1} + xAxisThickness={0} rulesLength={chartWidth} // xAxisLength={chartWidth} - hideAxesAndRules={true} - // backgroundColor={'red'} + hideAxesAndRules={false} + // backgroundColor={'red'} - backgroundColor={'yellow'} + // backgroundColor={'yellow'} // xAxisLabelTextStyle={{ color: '#000', fontSize: 10, marginTop: 4 }} /> {/* */} - + ); - + case "Table": return ( @@ -800,6 +801,14 @@ const Dashboard = (props) => { const feedbackCount = visitedStoreData1?.filter(item => item?.UPLOAD_STATUS == 'U')?.length; + const filteredStores = storeList.filter((store) => { + const query = searchQuery.toLowerCase(); + return ( + store.StoreName.toLowerCase().includes(query) || + store.StoreId.toString().includes(query) + ); + }); + return ( @@ -1004,7 +1013,7 @@ const Dashboard = (props) => { {/* Score Card */} - + {firstItem && ( @@ -1055,15 +1064,15 @@ const Dashboard = (props) => { )} - `${item.GraphId}-${index}`} - renderItem={renderItem} - numColumns={2} - columnWrapperStyle={{ justifyContent: 'space-between', marginTop: 10 }} - contentContainerStyle={{ paddingHorizontal: 2, paddingVertical: 2 }} - showsVerticalScrollIndicator={false} - /> + `${item.GraphId}-${index}`} + renderItem={renderItem} + numColumns={2} + columnWrapperStyle={{ justifyContent: 'space-between', marginTop: 10 }} + contentContainerStyle={{ paddingHorizontal: 2, paddingVertical: 2 }} + showsVerticalScrollIndicator={false} + /> @@ -1376,10 +1385,22 @@ const Dashboard = (props) => { {searchResult ? - {storeList ? storeList.length : 0} Store + {/* {storeList ? storeList.length : 0} Store */} + {filteredStores.length} Store{filteredStores.length !== 1 ? 's' : ''} - {storeList && storeList.length > 0 ? storeList.map((store) => ( + + + + + + {filteredStores && filteredStores.length > 0 ? filteredStores.map((store) => ( onSelectStore(store)} key={store.StoreId} style={styles.storeCard}> {store.StoreName} diff --git a/src/screens/MainScreen/Dashboard/style.js b/src/screens/MainScreen/Dashboard/style.js index a122391..8b7fe26 100644 --- a/src/screens/MainScreen/Dashboard/style.js +++ b/src/screens/MainScreen/Dashboard/style.js @@ -340,4 +340,17 @@ export const styles = StyleSheet.create({ shadowRadius: 5, shadowOffset: { width: 0, height: 2 }, }, + searchByID: { + flexDirection: 'row', + alignItems: 'center', + height: 40, + width: '100%', + borderColor: '#ccc', + borderWidth: 1, + borderRadius: 10, + paddingHorizontal: 10, + marginTop: 10, + marginBottom: 10, + + } });