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