addChantier

This commit is contained in:
Rochas
2025-12-11 23:22:45 +01:00
parent 46c6707d14
commit 8ba664c2ad
2 changed files with 35 additions and 16 deletions

View File

@@ -15,14 +15,18 @@ 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
//Uniquement accessible par le RESPONSSABLE du chantier
//Pour créer ou modifier un chantier
export default function AddChantier() {
const { chantier, setChantier } = useChantier();
const { user, setUser } = useUser();
const { ressources, setRessources } = useRessources();
const [editMode,setEditMode] = useState(false);
const [loading, setLoading] = useState(false);
const [nom, setNom] = useState('');
const [objet, setObjet] = useState('');
const [date, setDate] = useState('');
const [chefChantier, setChefChantier] = useState('');
const [adresse, setAdresse] = useState('');
const [duree, setDuree] = useState('');
@@ -34,10 +38,10 @@ export default function AddChantier() {
setLoading(true);
}
const renderInut = (name : string, preFill : string, value : string) => {
const renderInut = (name : string, preFill : string, value : string, setValue : ((text:string) => void)) => {
return (
<View>
<ThemedText>{name}</ThemedText>
<View style = {styles.inputLine}>
<ThemedText style = {styles.inputName}>{name}:</ThemedText>
<ThemedTextInput lvl = {1} style = {styles.input} placeholder={preFill} value = {value} onChangeText={setAdresse} />
</View>
);
@@ -47,27 +51,34 @@ export default function AddChantier() {
return (
<ThemedView lvl={3} style={styles.back}>
<View style={styles.container}>
{editMode &&
<View style={{width:"100%", position: 'absolute'}}>
<SelectChantier></SelectChantier>
</View>
}
<ScrollView>
<View style = {styles.header}>
<ThemedText style = {styles.text}>Ajouter un nouveau chantier </ThemedText>
<ThemedTextInput lvl = {1} style = {styles.input} placeholder='Adresse du chantier' value = {adresse} onChangeText={setAdresse} />
<ThemedTextInput lvl = {1} style = {styles.input} placeholder='Date de Dep' value = {duree} onChangeText={setDuree} />
<ThemedTextInput lvl = {1} style = {styles.input} placeholder='06 01 02 03 04' value = {contact} onChangeText={setContact} />
<ThemedTextInput lvl = {1} style = {styles.input} placeholder='chef de chantier' value= {chefChantier} onChangeText={setChefChantier}/>
<ThemedText style = {styles.text}>Ajouter un équipier</ThemedText>
<ThemedText style = {styles.text}>Ajouter une ressources</ThemedText>
<ThemedText style = {styles.text}>
{editMode? "Edition d'un chantier"
:"Ajouter un nouveau chantier"}
</ThemedText>
{renderInut("Objet","Renovation",objet,setObjet)}
{renderInut("Date de départ","TOTO : JOUR + Demi journé",date,setDate)}
{renderInut("Estimation de la durée (1/2 Journée)","14",duree,setDuree)}
{renderInut("Adresse","1 Rue de la Coutellerie, Paris",adresse,setAdresse)}
{renderInut("Contact client","07 01 02 03 04 05",contact,setContact)}
{renderInut("Vehicule","TODO pas un input bien sûre",adresse,setAdresse)}
{renderInut("Chef de chantier","TODO pas un input non plus",chefChantier,setChefChantier)}
<ThemedButton
lvl={1}
shadow={true}
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
onPress={() => handleAddChantier()}
>
<ThemedText>+</ThemedText>
</ThemedButton>
</View>
@@ -88,7 +99,6 @@ const styles = StyleSheet.create({
},
header: {
marginTop:60,
marginBottom: 20,
alignItems: "center",
paddingHorizontal: 20,
},
@@ -102,6 +112,15 @@ const styles = StyleSheet.create({
borderRadius: 10,
backgroundColor: "transparent",
},
inputLine:{
width: "100%",
//flexDirection: 'row',
paddingVertical: 5,
//alignItems: "center",
},
inputName: {
fontSize: 16,
},
input: {
width: "100%",
borderRadius: 10,

View File

@@ -43,13 +43,13 @@ const styles = StyleSheet.create({
container: {
flex: 1,
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
paddingTop : 60,
},
header: {
flex: 1,
width:"100%"
},
summary:{
marginTop:60,
padding:10,
},
anomaly:{