Tests untereinander

This commit is contained in:
2024-10-14 19:24:53 +02:00
parent 22f24947ae
commit 09fd5f3032

View File

@@ -111,19 +111,29 @@ const Calendar = () => {
refreshControl={<RefreshControl refreshing={loading} onRefresh={refresh} colors={[colors.primary]} />}
data={calendarData.tests}
keyExtractor={(item) => item.date + item.hourFrom + item.hourUntil + item.subject}
renderItem={({ item }) => (
<View style={[styles.dayBox, styles.rowContainer, { backgroundColor: colors.backPrimary }]}>
<ThemeText style={{ width: 82, fontWeight: 'bold' }}>{format(item.date, 'dd.MM.yyyy')}</ThemeText>
<ThemeText style={{ width: 60 }}>{item.subject}</ThemeText>
<ThemeText style={{ width: 25 }}>{item.type}</ThemeText>
<ThemeText style={{ width: 40 }}>{item.room}</ThemeText>
<ThemeText style={{ width: 40 }}>{item.hourFrom}-{item.hourUntil}</ThemeText>
<ThemeText style={{ width: 82 }}>{item.timeFrom}-{item.timeUntil}</ThemeText>
{userInformation.usertype == 'teacher' && <ThemeText style={{ width: 30 }}>{item.class}</ThemeText>}
{userInformation.usertype == 'pupil' && <ThemeText style={{ width: 30 }}>{item.teacher}</ThemeText>}
renderItem={({ item }) => (
<View style={{ marginLeft: 5, marginBottom: 5, borderBottomWidth: 1, borderColor: '#ccc' }}>
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 3 }}>
<ThemeText style={{ fontWeight: 'bold', marginRight: 5 }}>
{format(item.date, 'dd.MM.yyyy')}
</ThemeText>
<ThemeText style={{ marginRight: 5 }}>{item.subject}</ThemeText>
<ThemeText style={{ marginRight: 5 }}>{item.type}</ThemeText>
{userInformation.usertype === 'teacher' && (
<ThemeText style={{ marginRight: 5 }}>{item.class}</ThemeText>
)}
{userInformation.usertype === 'pupil' && (
<ThemeText style={{ marginRight: 5 }}>{item.teacher}</ThemeText>
)}
</View>
<View style={{ flexDirection: 'row', alignItems: 'center', marginBottom: 5 }}>
<ThemeText style={{ marginRight: 5 }}>{item.room}</ThemeText>
<ThemeText style={{ marginRight: 5 }}>{`${item.hourFrom}-${item.hourUntil}`}</ThemeText>
<ThemeText>{`${item.timeFrom}-${item.timeUntil}`}</ThemeText>
</View>
</View>
)}
getItemLayout={(data, index) => (
getItemLayout={(data, index) => (
{ length: 70, offset: 70 * index, index }
)}
/>
@@ -154,7 +164,7 @@ const Calendar = () => {
data={groupedAppointmentsArray}
keyExtractor={(item) => format(item.date, 'yyyy-MM-dd')}
renderItem={({ item }) => (
<View style={{ marginTop: 5, borderBottomWidth: 1, borderColor: '#ccc', }}>
<View style={{ marginTop: 5, borderBottomWidth: 1, borderColor: '#ccc' }}>
<ThemeText style={{ fontSize: 18, marginBottom: 10, marginLeft: 20 }}>{format(item.date, 'dd.MM.yyyy')}</ThemeText>
{item.appointments.map((appointment, index) => (
<View key={index} style={{ flexDirection: 'row', alignItems: 'center', marginLeft: 5, marginBottom: 10 }}>