clean gestionnaire_ressource et ouvrier, ajout de select Chantier + templateScreen
This commit is contained in:
@@ -4,6 +4,7 @@ import { getChantiers } from "@/services/ressourcesService";
|
||||
import { useRouter } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
import {
|
||||
ActivityIndicator,
|
||||
Dimensions,
|
||||
Image,
|
||||
Pressable,
|
||||
@@ -34,8 +35,10 @@ export default function SelectChantier() {
|
||||
const { chantier, setChantier } = useChantier();
|
||||
const [search, setSearch] = useState("");
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const [isLoaded, setIsLoaded] = useState(false);
|
||||
const [chantiers, setChantiers] = useState<Chantier[]>([]);
|
||||
const router = useRouter();
|
||||
|
||||
|
||||
const AnimatedThemedView = Animated.createAnimatedComponent(ThemedView);
|
||||
const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText);
|
||||
@@ -44,9 +47,11 @@ export default function SelectChantier() {
|
||||
Animated.createAnimatedComponent(ThemedTextInput);
|
||||
|
||||
async function onPressOpen(){
|
||||
setIsLoaded(false);
|
||||
setIsOpen(!isOpen);
|
||||
if(!isOpen){
|
||||
const updatedChantiers = await getChantiers();
|
||||
setIsLoaded(true);
|
||||
setChantiers(updatedChantiers)
|
||||
}
|
||||
}
|
||||
@@ -78,7 +83,6 @@ export default function SelectChantier() {
|
||||
<Image source={{ uri:"https://cdn.discordapp.com/attachments/1425108443571945644/1427207643180826757/raw.png?ex=69392bb2&is=6937da32&hm=dcc09e76d3dca89d2418947b46efbd38673b9dc559027724b2e51d493b173bc9&" /*chantier.urlImg*/ }} style={styles.image} />
|
||||
</View>
|
||||
<View>
|
||||
<ThemedText>{chantier.chef != null ? "true" : "false"}</ThemedText>
|
||||
<ThemedText>Adresse: {chantier.adresse}</ThemedText>
|
||||
<ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText>
|
||||
<ThemedText>État: {chantier.etat}</ThemedText>
|
||||
@@ -107,14 +111,16 @@ export default function SelectChantier() {
|
||||
+
|
||||
</ThemedText>
|
||||
</ThemedButton>
|
||||
|
||||
<ThemedView lvl={2} style={styles.list}>
|
||||
<View style={styles.list}>
|
||||
{isLoaded?
|
||||
<ScrollView contentContainerStyle={styles.chantiersList}>
|
||||
{chantiers.map((chantier, index) =>
|
||||
renderChantier(chantier, index)
|
||||
)}
|
||||
</ScrollView>
|
||||
</ThemedView>
|
||||
: <ActivityIndicator style={{height:"100%"}} color="#808080" size="large" />}
|
||||
</View>
|
||||
|
||||
</View>
|
||||
)}
|
||||
</AnimatedThemedView>
|
||||
|
||||
@@ -70,7 +70,7 @@ export default function SetStatus() {
|
||||
<Modal transparent={true} >
|
||||
<View style={styles.overlay}>
|
||||
<ThemedView style={styles.overlayView}>
|
||||
<ThemedText style={{fontSize: 25}}>Changer l'était du chantier en {tempStatus} ?</ThemedText>
|
||||
<ThemedText style={{fontSize: 25}}>Changer l'état du chantier en {tempStatus} ?</ThemedText>
|
||||
<View style={styles.overlayView}>
|
||||
<ThemedButton lvl={2} border={5} style={styles.buttonValid} onPress={() => onConfirm()}>
|
||||
<ThemedText style={{fontSize: 25}}>Confirmer</ThemedText>
|
||||
|
||||
Reference in New Issue
Block a user