store dna all done

This commit is contained in:
CPM
2025-07-30 10:35:06 +05:30
commit b0399b39c6
157 changed files with 35444 additions and 0 deletions
+275
View File
@@ -0,0 +1,275 @@
// const getTabData = async (tabData) => {
// try {
// const params = {
// parameters: {
// projectid: 41654,
// year: 2025,
// monthno: 6,
// storeid: storeData?.StoreId
// }
// };
// const graphDetails = tabData?.graphDetails || [];
// const uniqueUrls = [...new Set(graphDetails.map(graph => graph.GraphUrl))];
// // console.log('🔄 Unique URLs:', uniqueUrls);
// const apiCalls = uniqueUrls.map(url => post(url, params));
// const results = await Promise.all(apiCalls);
// const dataMap = {};
// uniqueUrls.forEach((url, idx) => {
// dataMap[url] = results[idx];
// });
// setGraphApiData(dataMap);
// } catch (err) {
// console.log("❌ Error fetching tab data:", err);
// }
// };
// Handle scroll event to show/hide button
// const getTabData = async () => {
// try {
// const params = {
// parameters: {
// projectid: 41654,
// year: 2025,
// monthno: 6,
// storeid: 2702
// }
// };
// // Extract all unique GraphUrls
// const uniqueUrls = [...new Set(graphDetails.map(graph => graph.GraphUrl))];
// console.log('uniqueUrls---->', uniqueUrls);
// // Call all APIs in parallel
// const apiCalls = uniqueUrls.map(url => post(url, params));
// const results = await Promise.all(apiCalls);
// // Optional: Map result to url if needed
// const dataMap = {};
// uniqueUrls.forEach((url, idx) => {
// dataMap[url] = results[idx];
// });
// setGraphApiData(dataMap);
// console.log("✅ All API responses:", JSON.stringify(dataMap));
// // You can now store `dataMap` into a state if needed
// // setGraphApiData(dataMap);
// } catch (err) {
// console.log("❌ Error fetching tab data:", err);
// }
// };
// const getTabData = () => {
// let params = {
// "parameters": {
// "projectid": 41654,
// "year": 2025,
// "monthno": 6,
// "storeid": 2702
// }
// }
// post(ApiURL.pssscoreApi, params)
// .then(res => {
// console.log('psscoreApi res==>', res);
// })
// }
// const renderItem = ({ item }) => {
// switch (item.GraphType) {
// case "ScoreCard":
// return (
// <View style={[styles.percentBox, { backgroundColor: item.GraphBackground }]}>
// <Text style={styles.boxText}>{item.GraphTitle}</Text>
// <Text style={[styles.boxText, { fontWeight: '500', fontSize: 24, marginTop: 10 }]}>{"45%"}</Text>
// </View>
// );
// case "BarGraph":
// const barData = {
// labels: ["Jan", "Feb", "Mar", "Apr"],
// datasets: [{ data: [35, 45, 20, 55] }]
// };
// return (
// <View style={{ padding: 10, backgroundColor: '', borderRadius: 8 }}>
// <Text style={{ fontSize: 16, fontWeight: '600', marginBottom: 10 }}>
// SOS Compliance Trend
// </Text>
// <BarChart
// data={barData}
// width={screenWidth - 40}
// height={220}
// yAxisSuffix="%"
// chartConfig={chartConfig}
// fromZero
// showValuesOnTopOfBars
// withInnerLines
// />
// </View>
// );
// case "Table":
// return (
// <View style={{ flex: 1, }}>
// <ScrollView>
// <View style={{ flexDirection: 'row', borderWidth: 1, borderColor: '#EAEAEA', alignItems: 'center', alignSelf: 'flex-start', padding: 5, borderRadius: 15 }}>
// <TouchableOpacity
// style={[styles.subTab, { backgroundColor: '#113F8C' }]}>
// <Text style={[styles.tabText, { color: "#fff" }]}>{'Asset'}</Text>
// </TouchableOpacity>
// <TouchableOpacity
// style={[styles.subTab, { backgroundColor: '#113F8C' }]}>
// <Text style={[styles.tabText, { color: "#fff" }]}>{'Asset Details'}</Text>
// </TouchableOpacity>
// </View>
// {assetData && assetData.map((table, index) => (
// <View key={index} style={{ marginTop: 10 }}>
// <Text style={{ fontSize: 16, color: '#000', fontWeight: '500' }}>{table.section}</Text>
// <View style={{ marginTop: 5, backgroundColor: '#fff', elevation: 5, padding: 10, borderRadius: 10 }}>
// <View style={{ flexDirection: 'row', borderBottomWidth: 1, borderColor: '#E0E0E0', paddingBottom: 7, }}>
// <Text style={{ width: '50%', color: '#676767', fontSize: 14 }}>Display</Text>
// <Text style={{ width: '50%', color: '#676767', fontSize: 14 }}>Present</Text>
// </View>
// {
// table && table.data.map((item) => (
// <View style={{ marginTop: 3, flexDirection: 'row', paddingBottom: 7, borderBottomWidth: 1, borderColor: '#E0E0E0', }}>
// <Text style={{ width: '50%', color: '#000', fontSize: 14, }}>{item.display}</Text>
// <Text style={{ width: '50%', color: '#000', fontSize: 14, }}>{item?.present}</Text>
// </View>
// ))}
// </View>
// </View>
// ))}
// <View style={{ marginBottom: 500 }} />
// </ScrollView>
// </View>
// )
// case "LineChart":
// return (
// <View style={{ flex: 1, }}>
// <Text>Bezier Line Chart</Text>
// <LineChart
// data={{
// labels: ["January", "February", "March", "April", "May", "June"],
// datasets: [
// {
// data: [
// Math.random() * 100,
// Math.random() * 100,
// Math.random() * 100,
// Math.random() * 100,
// Math.random() * 100,
// Math.random() * 100
// ]
// }
// ]
// }}
// width={Dimensions.get("window").width} // from react-native
// height={220}
// yAxisLabel="$"
// yAxisSuffix="k"
// yAxisInterval={1} // optional, defaults to 1
// chartConfig={{
// backgroundColor: "#e26a00",
// backgroundGradientFrom: "lgray",
// backgroundGradientTo: "lightblue",
// decimalPlaces: 2, // optional, defaults to 2dp
// color: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
// labelColor: (opacity = 1) => `rgba(255, 255, 255, ${opacity})`,
// style: {
// borderRadius: 16
// },
// propsForDots: {
// r: "6",
// strokeWidth: "2",
// stroke: "#ffa726"
// }
// }}
// bezier
// style={{
// marginVertical: 8,
// borderRadius: 16
// }}
// />
// </View>
// )
// case "PieChart":
// return (
// <View style={{ flex: 1, }}>
// <PieChart
// data={PieData}
// width={screenWidth}
// height={220}
// chartConfig={chartConfig}
// accessor={"population"}
// backgroundColor={"transparent"}
// paddingLeft={"15"}
// center={[10, 50]}
// absolute
// />
// </View>
// )
// default:
// return (
// <View style={[styles.percentBox, { backgroundColor: "#f8d7da", padding: 10, marginVertical: 5 }]}>
// <Text style={[styles.boxText, { color: "#721c24" }]}>
// Unsupported Graph Type: {item.GraphType}
// </Text>
// </View>
// );
// }
// };
// const getFilterStateCity = () => {
// let data = JSON.stringify({
// "UserId": "RH5"
// });
// let config = {
// method: 'post',
// maxBodyLength: Infinity,
// url: 'https://api1.parinaam.in/api/dabur/StoreDNAfilter',
// headers: {
// 'api_key': '9a1f056fecb84eaf8eb4152dda22ab0501955c4f9bbe7daa8780740459fdde7a',
// 'Content-Type': 'application/json'
// },
// data: data
// };
// axios.request(config)
// .then((response) => {
// console.log("filter", JSON.stringify(response.data));
// })
// .catch((error) => {
// console.log(error);
// });
// }