@dhiraj0720/report1chart 1.0.6 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +48 -8
- package/src/api/ApiService.jsx +180 -0
- package/src/api/ApiService.test.jsx +27 -0
- package/src/components/charts/BarChart.jsx +121 -0
- package/src/components/charts/ChartUtils.jsx +38 -0
- package/src/components/charts/LineChart.jsx +142 -0
- package/src/components/charts/PieChart.jsx +125 -0
- package/src/components/common/ErrorDisplay.jsx +51 -0
- package/src/components/common/LoadingSpinner.jsx +32 -0
- package/src/components/common/ReportCard.jsx +98 -0
- package/src/components/tables/CompactTable.jsx +269 -0
- package/src/components/tables/DefaultTable.jsx +225 -0
- package/src/components/tables/FreezeTable.jsx +264 -0
- package/src/components/tables/TableUtils.jsx +47 -0
- package/src/index.jsx +9 -1349
- package/src/screens/ReportDashboard.jsx +132 -0
- package/src/screens/ReportDetail.jsx +265 -0
- package/src/utils/Constants.jsx +38 -0
- package/src/utils/Formatters.jsx +24 -0
- package/src/utils/Validators.jsx +60 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const ErrorDisplay = ({ error, onRetry }) => {
|
|
10
|
+
return (
|
|
11
|
+
<View style={styles.container}>
|
|
12
|
+
<Text style={styles.errorText}>Error: {error}</Text>
|
|
13
|
+
{onRetry && (
|
|
14
|
+
<TouchableOpacity
|
|
15
|
+
style={styles.retryButton}
|
|
16
|
+
onPress={onRetry}
|
|
17
|
+
>
|
|
18
|
+
<Text style={styles.retryText}>Retry</Text>
|
|
19
|
+
</TouchableOpacity>
|
|
20
|
+
)}
|
|
21
|
+
</View>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const styles = StyleSheet.create({
|
|
26
|
+
container: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
alignItems: 'center',
|
|
30
|
+
padding: 40,
|
|
31
|
+
},
|
|
32
|
+
errorText: {
|
|
33
|
+
fontSize: 16,
|
|
34
|
+
color: '#d32f2f',
|
|
35
|
+
textAlign: 'center',
|
|
36
|
+
marginBottom: 20,
|
|
37
|
+
},
|
|
38
|
+
retryButton: {
|
|
39
|
+
backgroundColor: '#4CAF50',
|
|
40
|
+
paddingHorizontal: 24,
|
|
41
|
+
paddingVertical: 12,
|
|
42
|
+
borderRadius: 8,
|
|
43
|
+
},
|
|
44
|
+
retryText: {
|
|
45
|
+
color: '#fff',
|
|
46
|
+
fontSize: 16,
|
|
47
|
+
fontWeight: '600',
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export default ErrorDisplay;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
ActivityIndicator,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const LoadingSpinner = ({ message = 'Loading...' }) => {
|
|
10
|
+
return (
|
|
11
|
+
<View style={styles.container}>
|
|
12
|
+
<ActivityIndicator size="large" color="#4CAF50" />
|
|
13
|
+
<Text style={styles.message}>{message}</Text>
|
|
14
|
+
</View>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const styles = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
flex: 1,
|
|
21
|
+
justifyContent: 'center',
|
|
22
|
+
alignItems: 'center',
|
|
23
|
+
padding: 40,
|
|
24
|
+
},
|
|
25
|
+
message: {
|
|
26
|
+
marginTop: 16,
|
|
27
|
+
fontSize: 16,
|
|
28
|
+
color: '#666',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default LoadingSpinner;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const ReportCard = ({ report, onPress }) => {
|
|
10
|
+
const getColor = (id) => {
|
|
11
|
+
const colors = ['#4CAF50', '#2196F3', '#FF9800', '#E91E63', '#9C27B0'];
|
|
12
|
+
return colors[Math.floor(id) % colors.length];
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<TouchableOpacity
|
|
17
|
+
style={styles.card}
|
|
18
|
+
onPress={onPress}
|
|
19
|
+
>
|
|
20
|
+
<View style={[styles.icon, { backgroundColor: getColor(report.id) }]}>
|
|
21
|
+
<Text style={styles.iconText}>{Math.floor(report.id)}</Text>
|
|
22
|
+
</View>
|
|
23
|
+
<View style={styles.info}>
|
|
24
|
+
<Text style={styles.name}>{report.name}</Text>
|
|
25
|
+
<Text style={styles.title}>{report.title}</Text>
|
|
26
|
+
<Text style={styles.desc}>{report.description}</Text>
|
|
27
|
+
<Text style={styles.apiInfo}>
|
|
28
|
+
API: {report.apiConfig?.url ? 'Configured' : 'No API'}
|
|
29
|
+
</Text>
|
|
30
|
+
</View>
|
|
31
|
+
<Text style={styles.arrow}>›</Text>
|
|
32
|
+
</TouchableOpacity>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
card: {
|
|
38
|
+
flexDirection: 'row',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
backgroundColor: '#fff',
|
|
41
|
+
borderRadius: 12,
|
|
42
|
+
padding: 16,
|
|
43
|
+
marginBottom: 12,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: '#e8e8e8',
|
|
46
|
+
shadowColor: '#000',
|
|
47
|
+
shadowOffset: { width: 0, height: 1 },
|
|
48
|
+
shadowOpacity: 0.05,
|
|
49
|
+
shadowRadius: 2,
|
|
50
|
+
elevation: 2,
|
|
51
|
+
},
|
|
52
|
+
icon: {
|
|
53
|
+
width: 44,
|
|
54
|
+
height: 44,
|
|
55
|
+
borderRadius: 22,
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
marginRight: 12,
|
|
59
|
+
},
|
|
60
|
+
iconText: {
|
|
61
|
+
fontSize: 18,
|
|
62
|
+
fontWeight: '700',
|
|
63
|
+
color: '#fff',
|
|
64
|
+
},
|
|
65
|
+
info: {
|
|
66
|
+
flex: 1,
|
|
67
|
+
},
|
|
68
|
+
name: {
|
|
69
|
+
fontSize: 16,
|
|
70
|
+
fontWeight: '600',
|
|
71
|
+
color: '#000',
|
|
72
|
+
marginBottom: 2,
|
|
73
|
+
},
|
|
74
|
+
title: {
|
|
75
|
+
fontSize: 14,
|
|
76
|
+
fontWeight: '500',
|
|
77
|
+
color: '#4CAF50',
|
|
78
|
+
marginBottom: 4,
|
|
79
|
+
},
|
|
80
|
+
desc: {
|
|
81
|
+
fontSize: 13,
|
|
82
|
+
color: '#666',
|
|
83
|
+
lineHeight: 18,
|
|
84
|
+
marginBottom: 4,
|
|
85
|
+
},
|
|
86
|
+
apiInfo: {
|
|
87
|
+
fontSize: 12,
|
|
88
|
+
color: '#888',
|
|
89
|
+
fontStyle: 'italic',
|
|
90
|
+
},
|
|
91
|
+
arrow: {
|
|
92
|
+
fontSize: 24,
|
|
93
|
+
color: '#ccc',
|
|
94
|
+
fontWeight: '300',
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export default ReportCard;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
ScrollView,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const CompactTable = ({ data }) => {
|
|
10
|
+
const formatCurrency = (value) => {
|
|
11
|
+
const num = Number(value);
|
|
12
|
+
if (isNaN(num)) return '0';
|
|
13
|
+
|
|
14
|
+
if (num >= 1000000) {
|
|
15
|
+
return `${(num / 1000000).toFixed(1)}M`;
|
|
16
|
+
} else if (num >= 1000) {
|
|
17
|
+
return `${(num / 1000).toFixed(1)}K`;
|
|
18
|
+
}
|
|
19
|
+
return num.toLocaleString();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
if (!Array.isArray(data) || data.length === 0) {
|
|
23
|
+
return (
|
|
24
|
+
<View style={styles.noDataContainer}>
|
|
25
|
+
<Text style={styles.noDataText}>No data available</Text>
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ScrollView style={styles.container}>
|
|
32
|
+
{data.map((item, index) => (
|
|
33
|
+
<View
|
|
34
|
+
key={index}
|
|
35
|
+
style={[
|
|
36
|
+
styles.card,
|
|
37
|
+
item.isTotal && styles.totalCard,
|
|
38
|
+
index % 2 === 0 ? styles.evenCard : styles.oddCard
|
|
39
|
+
]}
|
|
40
|
+
>
|
|
41
|
+
{/* Card Header */}
|
|
42
|
+
<View style={styles.header}>
|
|
43
|
+
<Text style={[
|
|
44
|
+
styles.title,
|
|
45
|
+
item.isTotal && styles.totalTitle
|
|
46
|
+
]}>
|
|
47
|
+
{item.name}
|
|
48
|
+
</Text>
|
|
49
|
+
<Text style={[
|
|
50
|
+
styles.grossMargin,
|
|
51
|
+
styles.grossMarginText
|
|
52
|
+
]}>
|
|
53
|
+
Brüt Kar: {item.grossMarginPercent}%
|
|
54
|
+
</Text>
|
|
55
|
+
</View>
|
|
56
|
+
|
|
57
|
+
{/* Card Body - Grid Layout */}
|
|
58
|
+
<View style={styles.grid}>
|
|
59
|
+
{/* Column 1 */}
|
|
60
|
+
<View style={styles.column}>
|
|
61
|
+
<Text style={styles.label}>2024 Fiili</Text>
|
|
62
|
+
<Text style={styles.value}>
|
|
63
|
+
{formatCurrency(item.actual2024)}
|
|
64
|
+
</Text>
|
|
65
|
+
</View>
|
|
66
|
+
|
|
67
|
+
{/* Column 2 */}
|
|
68
|
+
<View style={styles.column}>
|
|
69
|
+
<Text style={styles.label}>2025 Fiili</Text>
|
|
70
|
+
<Text style={styles.value}>
|
|
71
|
+
{formatCurrency(item.actual2025)}
|
|
72
|
+
</Text>
|
|
73
|
+
</View>
|
|
74
|
+
|
|
75
|
+
{/* Column 3 */}
|
|
76
|
+
<View style={styles.column}>
|
|
77
|
+
<Text style={styles.label}>Fiili Artış</Text>
|
|
78
|
+
<View style={styles.percentBadge}>
|
|
79
|
+
<Text style={[
|
|
80
|
+
styles.percentText,
|
|
81
|
+
item.yoYChangePercent >= 0 ? styles.positive : styles.negative
|
|
82
|
+
]}>
|
|
83
|
+
{item.yoYChangePercent >= 0 ? '↑' : '↓'} {Math.abs(item.yoYChangePercent).toFixed(1)}%
|
|
84
|
+
</Text>
|
|
85
|
+
</View>
|
|
86
|
+
</View>
|
|
87
|
+
|
|
88
|
+
{/* Column 4 */}
|
|
89
|
+
<View style={styles.column}>
|
|
90
|
+
<Text style={styles.label}>2025 Bütçe</Text>
|
|
91
|
+
<Text style={styles.value}>
|
|
92
|
+
{formatCurrency(item.budget2025)}
|
|
93
|
+
</Text>
|
|
94
|
+
</View>
|
|
95
|
+
|
|
96
|
+
{/* Column 5 */}
|
|
97
|
+
<View style={styles.column}>
|
|
98
|
+
<Text style={styles.label}>Sapma</Text>
|
|
99
|
+
<View style={styles.percentBadge}>
|
|
100
|
+
<Text style={[
|
|
101
|
+
styles.percentText,
|
|
102
|
+
item.budgetVariancePercent >= 0 ? styles.positive : styles.negative
|
|
103
|
+
]}>
|
|
104
|
+
{item.budgetVariancePercent >= 0 ? '↑' : '↓'} {Math.abs(item.budgetVariancePercent).toFixed(1)}%
|
|
105
|
+
</Text>
|
|
106
|
+
</View>
|
|
107
|
+
</View>
|
|
108
|
+
</View>
|
|
109
|
+
|
|
110
|
+
{/* Status Indicator */}
|
|
111
|
+
<View style={styles.statusIndicator}>
|
|
112
|
+
<View style={[
|
|
113
|
+
styles.statusDot,
|
|
114
|
+
(item.yoYChangePercent >= 0 && item.budgetVariancePercent >= 0)
|
|
115
|
+
? styles.statusGood
|
|
116
|
+
: styles.statusWarning
|
|
117
|
+
]} />
|
|
118
|
+
<Text style={styles.statusText}>
|
|
119
|
+
{item.yoYChangePercent >= 0 && item.budgetVariancePercent >= 0
|
|
120
|
+
? 'Performans İyi'
|
|
121
|
+
: 'İnceleme Gerekli'}
|
|
122
|
+
</Text>
|
|
123
|
+
</View>
|
|
124
|
+
</View>
|
|
125
|
+
))}
|
|
126
|
+
</ScrollView>
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const styles = StyleSheet.create({
|
|
131
|
+
container: {
|
|
132
|
+
flex: 1,
|
|
133
|
+
paddingHorizontal: 8,
|
|
134
|
+
},
|
|
135
|
+
card: {
|
|
136
|
+
backgroundColor: '#fff',
|
|
137
|
+
borderRadius: 12,
|
|
138
|
+
marginBottom: 12,
|
|
139
|
+
padding: 16,
|
|
140
|
+
borderWidth: 1,
|
|
141
|
+
borderColor: '#e8e8e8',
|
|
142
|
+
shadowColor: '#000',
|
|
143
|
+
shadowOffset: { width: 0, height: 2 },
|
|
144
|
+
shadowOpacity: 0.1,
|
|
145
|
+
shadowRadius: 3,
|
|
146
|
+
elevation: 2,
|
|
147
|
+
},
|
|
148
|
+
totalCard: {
|
|
149
|
+
backgroundColor: '#e8f5e9',
|
|
150
|
+
borderColor: '#4CAF50',
|
|
151
|
+
borderWidth: 2,
|
|
152
|
+
},
|
|
153
|
+
evenCard: {
|
|
154
|
+
backgroundColor: '#fff',
|
|
155
|
+
},
|
|
156
|
+
oddCard: {
|
|
157
|
+
backgroundColor: '#f9f9f9',
|
|
158
|
+
},
|
|
159
|
+
header: {
|
|
160
|
+
flexDirection: 'row',
|
|
161
|
+
justifyContent: 'space-between',
|
|
162
|
+
alignItems: 'center',
|
|
163
|
+
marginBottom: 12,
|
|
164
|
+
paddingBottom: 12,
|
|
165
|
+
borderBottomWidth: 1,
|
|
166
|
+
borderBottomColor: '#eee',
|
|
167
|
+
},
|
|
168
|
+
title: {
|
|
169
|
+
fontSize: 14,
|
|
170
|
+
fontWeight: '600',
|
|
171
|
+
color: '#2c3e50',
|
|
172
|
+
flex: 1,
|
|
173
|
+
},
|
|
174
|
+
totalTitle: {
|
|
175
|
+
fontWeight: '700',
|
|
176
|
+
color: '#2c3e50',
|
|
177
|
+
fontSize: 15,
|
|
178
|
+
},
|
|
179
|
+
grossMargin: {
|
|
180
|
+
fontSize: 13,
|
|
181
|
+
fontWeight: '600',
|
|
182
|
+
paddingHorizontal: 8,
|
|
183
|
+
paddingVertical: 4,
|
|
184
|
+
borderRadius: 6,
|
|
185
|
+
backgroundColor: '#f0f0f0',
|
|
186
|
+
},
|
|
187
|
+
grossMarginText: {
|
|
188
|
+
color: '#2c3e50',
|
|
189
|
+
},
|
|
190
|
+
grid: {
|
|
191
|
+
flexDirection: 'row',
|
|
192
|
+
flexWrap: 'wrap',
|
|
193
|
+
justifyContent: 'space-between',
|
|
194
|
+
},
|
|
195
|
+
column: {
|
|
196
|
+
width: '48%',
|
|
197
|
+
marginBottom: 12,
|
|
198
|
+
backgroundColor: '#f8f9fa',
|
|
199
|
+
padding: 10,
|
|
200
|
+
borderRadius: 8,
|
|
201
|
+
alignItems: 'center',
|
|
202
|
+
},
|
|
203
|
+
label: {
|
|
204
|
+
fontSize: 11,
|
|
205
|
+
color: '#666',
|
|
206
|
+
marginBottom: 4,
|
|
207
|
+
textAlign: 'center',
|
|
208
|
+
},
|
|
209
|
+
value: {
|
|
210
|
+
fontSize: 13,
|
|
211
|
+
fontWeight: '600',
|
|
212
|
+
color: '#2c3e50',
|
|
213
|
+
fontFamily: 'monospace',
|
|
214
|
+
},
|
|
215
|
+
percentBadge: {
|
|
216
|
+
backgroundColor: '#fff',
|
|
217
|
+
paddingHorizontal: 10,
|
|
218
|
+
paddingVertical: 4,
|
|
219
|
+
borderRadius: 12,
|
|
220
|
+
borderWidth: 1,
|
|
221
|
+
borderColor: '#e0e0e0',
|
|
222
|
+
},
|
|
223
|
+
percentText: {
|
|
224
|
+
fontSize: 12,
|
|
225
|
+
fontWeight: '600',
|
|
226
|
+
fontFamily: 'monospace',
|
|
227
|
+
},
|
|
228
|
+
positive: {
|
|
229
|
+
color: '#27ae60',
|
|
230
|
+
},
|
|
231
|
+
negative: {
|
|
232
|
+
color: '#e74c3c',
|
|
233
|
+
},
|
|
234
|
+
statusIndicator: {
|
|
235
|
+
flexDirection: 'row',
|
|
236
|
+
alignItems: 'center',
|
|
237
|
+
marginTop: 12,
|
|
238
|
+
paddingTop: 12,
|
|
239
|
+
borderTopWidth: 1,
|
|
240
|
+
borderTopColor: '#eee',
|
|
241
|
+
},
|
|
242
|
+
statusDot: {
|
|
243
|
+
width: 8,
|
|
244
|
+
height: 8,
|
|
245
|
+
borderRadius: 4,
|
|
246
|
+
marginRight: 8,
|
|
247
|
+
},
|
|
248
|
+
statusGood: {
|
|
249
|
+
backgroundColor: '#4CAF50',
|
|
250
|
+
},
|
|
251
|
+
statusWarning: {
|
|
252
|
+
backgroundColor: '#FF9800',
|
|
253
|
+
},
|
|
254
|
+
statusText: {
|
|
255
|
+
fontSize: 12,
|
|
256
|
+
color: '#666',
|
|
257
|
+
},
|
|
258
|
+
noDataContainer: {
|
|
259
|
+
padding: 40,
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
},
|
|
262
|
+
noDataText: {
|
|
263
|
+
fontSize: 16,
|
|
264
|
+
color: '#999',
|
|
265
|
+
textAlign: 'center',
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
export default CompactTable;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
ScrollView,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
|
|
9
|
+
const DefaultTable = ({ data }) => {
|
|
10
|
+
const formatCurrency = (value) => {
|
|
11
|
+
const num = Number(value);
|
|
12
|
+
if (isNaN(num)) return '0';
|
|
13
|
+
|
|
14
|
+
if (num >= 1000000) {
|
|
15
|
+
return `${(num / 1000000).toFixed(1)}M`;
|
|
16
|
+
} else if (num >= 1000) {
|
|
17
|
+
return `${(num / 1000).toFixed(1)}K`;
|
|
18
|
+
}
|
|
19
|
+
return num.toLocaleString();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
if (!Array.isArray(data) || data.length === 0) {
|
|
23
|
+
return (
|
|
24
|
+
<View style={styles.noDataContainer}>
|
|
25
|
+
<Text style={styles.noDataText}>No data available</Text>
|
|
26
|
+
</View>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={true}>
|
|
32
|
+
<View style={styles.table}>
|
|
33
|
+
{/* Table Header */}
|
|
34
|
+
<View style={styles.tableHeader}>
|
|
35
|
+
<View style={[styles.headerCell, styles.firstColumn]}>
|
|
36
|
+
<Text style={styles.headerText}>FALİYET KAR/ZARAR</Text>
|
|
37
|
+
</View>
|
|
38
|
+
<View style={styles.headerCell}>
|
|
39
|
+
<Text style={styles.headerText}>2024 Fiili</Text>
|
|
40
|
+
</View>
|
|
41
|
+
<View style={styles.headerCell}>
|
|
42
|
+
<Text style={styles.headerText}>2025 Fiili</Text>
|
|
43
|
+
</View>
|
|
44
|
+
<View style={styles.headerCell}>
|
|
45
|
+
<Text style={styles.headerText}>Fiili Artış %</Text>
|
|
46
|
+
</View>
|
|
47
|
+
<View style={styles.headerCell}>
|
|
48
|
+
<Text style={styles.headerText}>2025 Bütçe</Text>
|
|
49
|
+
</View>
|
|
50
|
+
<View style={styles.headerCell}>
|
|
51
|
+
<Text style={styles.headerText}>Sapma %</Text>
|
|
52
|
+
</View>
|
|
53
|
+
<View style={styles.headerCell}>
|
|
54
|
+
<Text style={styles.headerText}>BRÜT KAR %</Text>
|
|
55
|
+
</View>
|
|
56
|
+
</View>
|
|
57
|
+
|
|
58
|
+
{/* Table Rows */}
|
|
59
|
+
{data.map((item, index) => (
|
|
60
|
+
<View
|
|
61
|
+
key={index}
|
|
62
|
+
style={[
|
|
63
|
+
styles.tableRow,
|
|
64
|
+
item.isTotal ? styles.totalRow : (index % 2 === 0 ? styles.evenRow : styles.oddRow)
|
|
65
|
+
]}
|
|
66
|
+
>
|
|
67
|
+
<View style={[styles.cell, styles.firstColumn]}>
|
|
68
|
+
<Text style={item.isTotal ? styles.totalText : styles.cellText}>
|
|
69
|
+
{item.name}
|
|
70
|
+
</Text>
|
|
71
|
+
</View>
|
|
72
|
+
|
|
73
|
+
<View style={styles.cell}>
|
|
74
|
+
<Text style={styles.numberText}>
|
|
75
|
+
{formatCurrency(item.actual2024)}
|
|
76
|
+
</Text>
|
|
77
|
+
</View>
|
|
78
|
+
|
|
79
|
+
<View style={styles.cell}>
|
|
80
|
+
<Text style={styles.numberText}>
|
|
81
|
+
{formatCurrency(item.actual2025)}
|
|
82
|
+
</Text>
|
|
83
|
+
</View>
|
|
84
|
+
|
|
85
|
+
<View style={styles.cell}>
|
|
86
|
+
<Text style={[
|
|
87
|
+
styles.percentText,
|
|
88
|
+
item.yoYChangePercent >= 0 ? styles.positive : styles.negative
|
|
89
|
+
]}>
|
|
90
|
+
{item.yoYChangePercent >= 0 ? '↑' : '↓'} {Math.abs(item.yoYChangePercent).toFixed(1)}%
|
|
91
|
+
</Text>
|
|
92
|
+
</View>
|
|
93
|
+
|
|
94
|
+
<View style={styles.cell}>
|
|
95
|
+
<Text style={styles.numberText}>
|
|
96
|
+
{formatCurrency(item.budget2025)}
|
|
97
|
+
</Text>
|
|
98
|
+
</View>
|
|
99
|
+
|
|
100
|
+
<View style={styles.cell}>
|
|
101
|
+
<Text style={[
|
|
102
|
+
styles.percentText,
|
|
103
|
+
item.budgetVariancePercent >= 0 ? styles.positive : styles.negative
|
|
104
|
+
]}>
|
|
105
|
+
{item.budgetVariancePercent >= 0 ? '↑' : '↓'} {Math.abs(item.budgetVariancePercent).toFixed(1)}%
|
|
106
|
+
</Text>
|
|
107
|
+
</View>
|
|
108
|
+
|
|
109
|
+
<View style={styles.cell}>
|
|
110
|
+
<Text style={[
|
|
111
|
+
styles.percentText,
|
|
112
|
+
styles.grossMargin
|
|
113
|
+
]}>
|
|
114
|
+
{item.grossMarginPercent}%
|
|
115
|
+
</Text>
|
|
116
|
+
</View>
|
|
117
|
+
</View>
|
|
118
|
+
))}
|
|
119
|
+
</View>
|
|
120
|
+
</ScrollView>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const styles = StyleSheet.create({
|
|
125
|
+
table: {
|
|
126
|
+
minWidth: 700,
|
|
127
|
+
marginBottom: 20,
|
|
128
|
+
},
|
|
129
|
+
tableHeader: {
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
backgroundColor: '#2c3e50',
|
|
132
|
+
borderBottomWidth: 1,
|
|
133
|
+
borderBottomColor: '#ddd',
|
|
134
|
+
},
|
|
135
|
+
headerCell: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
padding: 10,
|
|
138
|
+
minWidth: 100,
|
|
139
|
+
justifyContent: 'center',
|
|
140
|
+
alignItems: 'center',
|
|
141
|
+
borderRightWidth: 1,
|
|
142
|
+
borderRightColor: '#444',
|
|
143
|
+
},
|
|
144
|
+
firstColumn: {
|
|
145
|
+
flex: 1.5,
|
|
146
|
+
minWidth: 180,
|
|
147
|
+
},
|
|
148
|
+
headerText: {
|
|
149
|
+
color: '#fff',
|
|
150
|
+
fontWeight: '600',
|
|
151
|
+
fontSize: 11,
|
|
152
|
+
textAlign: 'center',
|
|
153
|
+
},
|
|
154
|
+
tableRow: {
|
|
155
|
+
flexDirection: 'row',
|
|
156
|
+
borderBottomWidth: 1,
|
|
157
|
+
borderBottomColor: '#eee',
|
|
158
|
+
minHeight: 40,
|
|
159
|
+
},
|
|
160
|
+
evenRow: {
|
|
161
|
+
backgroundColor: '#fff',
|
|
162
|
+
},
|
|
163
|
+
oddRow: {
|
|
164
|
+
backgroundColor: '#f9f9f9',
|
|
165
|
+
},
|
|
166
|
+
totalRow: {
|
|
167
|
+
backgroundColor: '#e8f5e9',
|
|
168
|
+
borderTopWidth: 2,
|
|
169
|
+
borderTopColor: '#4CAF50',
|
|
170
|
+
borderBottomWidth: 2,
|
|
171
|
+
borderBottomColor: '#4CAF50',
|
|
172
|
+
},
|
|
173
|
+
cell: {
|
|
174
|
+
flex: 1,
|
|
175
|
+
padding: 8,
|
|
176
|
+
minWidth: 100,
|
|
177
|
+
justifyContent: 'center',
|
|
178
|
+
alignItems: 'center',
|
|
179
|
+
borderRightWidth: 1,
|
|
180
|
+
borderRightColor: '#eee',
|
|
181
|
+
},
|
|
182
|
+
cellText: {
|
|
183
|
+
fontSize: 12,
|
|
184
|
+
color: '#333',
|
|
185
|
+
textAlign: 'center',
|
|
186
|
+
},
|
|
187
|
+
totalText: {
|
|
188
|
+
fontSize: 12,
|
|
189
|
+
fontWeight: '700',
|
|
190
|
+
color: '#2c3e50',
|
|
191
|
+
textAlign: 'center',
|
|
192
|
+
},
|
|
193
|
+
numberText: {
|
|
194
|
+
fontSize: 11,
|
|
195
|
+
fontWeight: '500',
|
|
196
|
+
fontFamily: 'monospace',
|
|
197
|
+
color: '#333',
|
|
198
|
+
},
|
|
199
|
+
percentText: {
|
|
200
|
+
fontSize: 12,
|
|
201
|
+
fontWeight: '600',
|
|
202
|
+
fontFamily: 'monospace',
|
|
203
|
+
},
|
|
204
|
+
positive: {
|
|
205
|
+
color: '#27ae60',
|
|
206
|
+
},
|
|
207
|
+
negative: {
|
|
208
|
+
color: '#e74c3c',
|
|
209
|
+
},
|
|
210
|
+
grossMargin: {
|
|
211
|
+
color: '#2c3e50',
|
|
212
|
+
fontWeight: '700',
|
|
213
|
+
},
|
|
214
|
+
noDataContainer: {
|
|
215
|
+
padding: 40,
|
|
216
|
+
alignItems: 'center',
|
|
217
|
+
},
|
|
218
|
+
noDataText: {
|
|
219
|
+
fontSize: 16,
|
|
220
|
+
color: '#999',
|
|
221
|
+
textAlign: 'center',
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
export default DefaultTable;
|