correction addChantier

This commit is contained in:
Rochas
2025-12-11 21:38:20 +01:00
parent b0c6829585
commit ef916b2f9b
2 changed files with 36 additions and 27 deletions

View File

@@ -76,7 +76,7 @@ export default function TabLayout() {
options={{ options={{
title: 'Ajouter', title: 'Ajouter',
tabBarIcon: ({ color }) => ( tabBarIcon: ({ color }) => (
<AntDesign name="plus" size={24} color="black" /> <AntDesign name="plus" size={24} color={color} />
), ),
}} }}
/> />

View File

@@ -3,7 +3,7 @@ import SelectChantier from '@/components/selectChantier';
import SetStatus from '@/components/setStatus'; import SetStatus from '@/components/setStatus';
import { ThemedView } from '@/components/theme/themed-view'; import { ThemedView } from '@/components/theme/themed-view';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { StyleSheet, ScrollView, Button, TextInput, Text } from 'react-native'; import { StyleSheet, ScrollView, Button, TextInput, Text, View } from 'react-native';
import { useChantier } from '../ContextChantier'; import { useChantier } from '../ContextChantier';
import { useRessources } from '../ContextRessource'; import { useRessources } from '../ContextRessource';
import { useUser } from '../ContextUser'; import { useUser } from '../ContextUser';
@@ -12,6 +12,8 @@ import { Chantier, Ressources } from '@/class/class';
import { ThemedText } from '@/components/theme/themed-text'; import { ThemedText } from '@/components/theme/themed-text';
import { ThemedButton } from '@/components/theme/themed-button'; import { ThemedButton } from '@/components/theme/themed-button';
import { ThemedTextInput } from '@/components/theme/themed-textinput'; import { ThemedTextInput } from '@/components/theme/themed-textinput';
import Constants from 'expo-constants'; //pour connaître la taille de la barre menu de l'OS en haut
export default function AddChantier() { export default function AddChantier() {
const { chantier, setChantier } = useChantier(); const { chantier, setChantier } = useChantier();
@@ -87,41 +89,48 @@ export default function AddChantier() {
} }
} }
return ( return (
<ScrollView style= {styles.container}> <ThemedView lvl={3} style={styles.back}>
<ThemedView style = {styles.header}> <View style={styles.container}>
<View style={{width:"100%", position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View>
<ScrollView>
<View style = {styles.header}>
<ThemedText style = {styles.text}>Ajouter un nouveau chantier </ThemedText> <ThemedText style = {styles.text}>Ajouter un nouveau chantier </ThemedText>
<ThemedTextInput lvl = {0} style = {styles.input} placeholder='Nom du chantier' value = {nom} onChangeText={setNom}/> <ThemedTextInput lvl = {1} style = {styles.input} placeholder='Nom du chantier' value = {nom} onChangeText={setNom}/>
<ThemedTextInput lvl = {0} style = {styles.input} placeholder='Adresse du chantier' value = {adresse} onChangeText={setAdresse} /> <ThemedTextInput lvl = {1} style = {styles.input} placeholder='Adresse du chantier' value = {adresse} onChangeText={setAdresse} />
<ThemedTextInput lvl = {0} style = {styles.input} placeholder='durée estimée (en jours)' value = {duree} onChangeText={setDuree} /> <ThemedTextInput lvl = {1} style = {styles.input} placeholder='durée estimée (en jours)' value = {duree} onChangeText={setDuree} />
<ThemedTextInput lvl = {0} style = {styles.input} placeholder='chef de chantier' value= {chefChantier} onChangeText={setChefChantier}/> <ThemedTextInput lvl = {1} style = {styles.input} placeholder='chef de chantier' value= {chefChantier} onChangeText={setChefChantier}/>
<ThemedText style={{ fontWeight: "bold", marginTop: 15 }}>Équipe</ThemedText> <ThemedText style={{ fontWeight: "bold", marginTop: 15 }}>Équipe</ThemedText>
<SelectChantier
/>
<Text style={{ fontWeight: "bold", marginTop: 15 }}>Ressources</Text> <Text style={{ fontWeight: "bold", marginTop: 15 }}>Ressources</Text>
<SelectChantier
/>
<ThemedButton <ThemedButton
lvl={1} lvl={1}
shadow={true} shadow={true}
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }} style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
onPress={() => handleAddChantier()} onPress={() => handleAddChantier()}
> >
</ThemedButton> </ThemedButton>
</ThemedView> </View>
</ScrollView> </ScrollView>
</View>
</ThemedView>
); );
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
back:{
height:"100%",
width:"100%",
},
container: { container: {
flex: 1, flex: 1,
marginTop: 60, marginTop: Constants.statusBarHeight, //pour la barre menu du haut
}, },
header: { header: {
marginTop:60,
marginBottom: 20, marginBottom: 20,
alignItems: "center", alignItems: "center",
paddingHorizontal: 20, paddingHorizontal: 20,