Graph and search store updated
This commit is contained in:
@@ -191,6 +191,7 @@ const Dashboard = (props) => {
|
|||||||
const restItems = filteredGraphs?.slice(1);
|
const restItems = filteredGraphs?.slice(1);
|
||||||
const graphDetails = mainDisplayJson?.graphDetails || [];
|
const graphDetails = mainDisplayJson?.graphDetails || [];
|
||||||
const [visitedStoreData1, setVisitedStoreData] = useState([]);
|
const [visitedStoreData1, setVisitedStoreData] = useState([]);
|
||||||
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
|
||||||
// 🧠 Initialize tabCache state at the top of your component
|
// 🧠 Initialize tabCache state at the top of your component
|
||||||
const [tabCache, setTabCache] = useState({});
|
const [tabCache, setTabCache] = useState({});
|
||||||
@@ -592,7 +593,7 @@ const Dashboard = (props) => {
|
|||||||
setStoreList(resData)
|
setStoreList(resData)
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
|
|
||||||
console.log('storeSearchApi====>', resData);
|
console.log('storeSearchApi====>', JSON.stringify(resData));
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
@@ -700,18 +701,18 @@ const Dashboard = (props) => {
|
|||||||
// hideRules={true}
|
// hideRules={true}
|
||||||
hideYAxisLine={true}
|
hideYAxisLine={true}
|
||||||
yAxisThickness={0}
|
yAxisThickness={0}
|
||||||
xAxisThickness={1}
|
xAxisThickness={0}
|
||||||
rulesLength={chartWidth}
|
rulesLength={chartWidth}
|
||||||
// xAxisLength={chartWidth}
|
// xAxisLength={chartWidth}
|
||||||
hideAxesAndRules={true}
|
hideAxesAndRules={false}
|
||||||
// backgroundColor={'red'}
|
// backgroundColor={'red'}
|
||||||
|
|
||||||
backgroundColor={'yellow'}
|
// backgroundColor={'yellow'}
|
||||||
|
|
||||||
// xAxisLabelTextStyle={{ color: '#000', fontSize: 10, marginTop: 4 }}
|
// xAxisLabelTextStyle={{ color: '#000', fontSize: 10, marginTop: 4 }}
|
||||||
/>
|
/>
|
||||||
{/* </View> */}
|
{/* </View> */}
|
||||||
<View style={{height:10}} />
|
<View style={{ height: 10 }} />
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -800,6 +801,14 @@ const Dashboard = (props) => {
|
|||||||
|
|
||||||
const feedbackCount = visitedStoreData1?.filter(item => item?.UPLOAD_STATUS == 'U')?.length;
|
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 (
|
return (
|
||||||
<SafeAreaView style={{ flex: 1, backgroundColor: GlobalTheme.colors.primary }}>
|
<SafeAreaView style={{ flex: 1, backgroundColor: GlobalTheme.colors.primary }}>
|
||||||
<View style={{ flex: 1, backgroundColor: '#fff' }}>
|
<View style={{ flex: 1, backgroundColor: '#fff' }}>
|
||||||
@@ -1004,7 +1013,7 @@ const Dashboard = (props) => {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* Score Card */}
|
{/* Score Card */}
|
||||||
<View style={{ margin:5 }}>
|
<View style={{ margin: 5 }}>
|
||||||
|
|
||||||
<View style={{ marginHorizontal: 5 }}>
|
<View style={{ marginHorizontal: 5 }}>
|
||||||
{firstItem && (
|
{firstItem && (
|
||||||
@@ -1055,15 +1064,15 @@ const Dashboard = (props) => {
|
|||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
<View style={{ marginHorizontal: 10 }}>
|
<View style={{ marginHorizontal: 10 }}>
|
||||||
<FlatList
|
<FlatList
|
||||||
data={restItems}
|
data={restItems}
|
||||||
keyExtractor={(item, index) => `${item.GraphId}-${index}`}
|
keyExtractor={(item, index) => `${item.GraphId}-${index}`}
|
||||||
renderItem={renderItem}
|
renderItem={renderItem}
|
||||||
numColumns={2}
|
numColumns={2}
|
||||||
columnWrapperStyle={{ justifyContent: 'space-between', marginTop: 10 }}
|
columnWrapperStyle={{ justifyContent: 'space-between', marginTop: 10 }}
|
||||||
contentContainerStyle={{ paddingHorizontal: 2, paddingVertical: 2 }}
|
contentContainerStyle={{ paddingHorizontal: 2, paddingVertical: 2 }}
|
||||||
showsVerticalScrollIndicator={false}
|
showsVerticalScrollIndicator={false}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<Loader visible={loading} />
|
<Loader visible={loading} />
|
||||||
@@ -1376,10 +1385,22 @@ const Dashboard = (props) => {
|
|||||||
{searchResult ?
|
{searchResult ?
|
||||||
<View style={{ marginBottom: 70 }}>
|
<View style={{ marginBottom: 70 }}>
|
||||||
<View style={{ marginTop: 20 }}>
|
<View style={{ marginTop: 20 }}>
|
||||||
<Text style={{ color: '#000', fontSize: 14 }}>{storeList ? storeList.length : 0} Store</Text>
|
{/* <Text style={{ color: '#000', fontSize: 14 }}>{storeList ? storeList.length : 0} Store</Text> */}
|
||||||
|
<Text style={{ color: '#000', fontSize: 14 }}>{filteredStores.length} Store{filteredStores.length !== 1 ? 's' : ''}</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{storeList && storeList.length > 0 ? storeList.map((store) => (
|
<View style={styles.searchByID}>
|
||||||
|
<Image source={IMAGES.searchIcon} style={{ height: 15, width: 15 }} />
|
||||||
|
<TextInput
|
||||||
|
placeholder="Search by Store Name or Store ID"
|
||||||
|
placeholderTextColor={'gray'}
|
||||||
|
value={searchQuery}
|
||||||
|
onChangeText={setSearchQuery}
|
||||||
|
style={{ color: '#000', marginLeft: 5, height: 38, width: '95%' }}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
|
|
||||||
|
{filteredStores && filteredStores.length > 0 ? filteredStores.map((store) => (
|
||||||
<TouchableOpacity onPress={() => onSelectStore(store)}
|
<TouchableOpacity onPress={() => onSelectStore(store)}
|
||||||
key={store.StoreId} style={styles.storeCard}>
|
key={store.StoreId} style={styles.storeCard}>
|
||||||
<Text style={styles.cardTextBold}>{store.StoreName}</Text>
|
<Text style={styles.cardTextBold}>{store.StoreName}</Text>
|
||||||
|
|||||||
@@ -340,4 +340,17 @@ export const styles = StyleSheet.create({
|
|||||||
shadowRadius: 5,
|
shadowRadius: 5,
|
||||||
shadowOffset: { width: 0, height: 2 },
|
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,
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user