diff --git a/app/(tabs)/gestion_ouvrier.tsx b/app/(tabs)/gestion_ouvrier.tsx index 582f246..f496147 100644 --- a/app/(tabs)/gestion_ouvrier.tsx +++ b/app/(tabs)/gestion_ouvrier.tsx @@ -4,10 +4,11 @@ import { ThemedView } from "@/components/themed-view"; import Constants from "expo-constants"; //pour connaître la taille de la barre menu de l'OS en haut import { useLocalSearchParams, useRouter } from "expo-router"; import React, { useMemo, useState } from "react"; -import { FlatList, Image, StyleSheet, Text } from "react-native"; +import { FlatList, Image, StyleSheet, Text, View } from "react-native"; import rawConcerts from "../../data/concerts.json"; import { useChantier } from "../ContextChantier"; +import SelectChantier from "@/components/selectChantier"; type Concert = { group: string; @@ -56,36 +57,45 @@ export default function GestionOuvrier() { }; return ( - - index.toString()} - contentContainerStyle={{ paddingBottom: 40 }} - ListHeaderComponent={ - + + + + + - - - - - } - ListEmptyComponent={ - Aucun résultat n'a été trouvé - } - /> + index.toString()} + contentContainerStyle={{ paddingBottom: 40 }} + ListHeaderComponent={ + + + + + + } + ListEmptyComponent={ + Aucun résultat n'a été trouvé + } + /> + ); } const styles = StyleSheet.create({ + back:{ + height:"100%", + width:"100%", + }, container: { flex: 1, marginTop: Constants.statusBarHeight, //pour la barre menu du haut @@ -93,7 +103,7 @@ const styles = StyleSheet.create({ }, header: { marginTop: 60, - marginBottom: 20, + marginBottom: 10, alignItems: "center", paddingHorizontal: 20, }, diff --git a/app/(tabs)/gestionnaire_ressource.tsx b/app/(tabs)/gestionnaire_ressource.tsx index a4b7e7b..1f3c301 100644 --- a/app/(tabs)/gestionnaire_ressource.tsx +++ b/app/(tabs)/gestionnaire_ressource.tsx @@ -1,12 +1,15 @@ import { ThemedText } from "@/components/themed-text"; import { ThemedTextInput } from "@/components/themed-textinput"; import { ThemedView } from "@/components/themed-view"; +import Constants from "expo-constants"; //pour connaître la taille de la barre menu de l'OS en haut + import { ThemedButton } from "@/components/themed-button"; import { useLocalSearchParams, useRouter } from "expo-router"; import React, { useEffect, useState } from "react"; -import { FlatList, Image, StyleSheet, Text } from "react-native"; +import { FlatList, Image, StyleSheet, Text, View } from "react-native"; import { Ressources } from "../../class/class"; import { getRessources } from "../../services/ressourcesService"; +import SelectChantier from "@/components/selectChantier"; export default function GestionnaireRessource() { const { nom, prenom } = useLocalSearchParams(); @@ -50,87 +53,98 @@ export default function GestionnaireRessource() { ); }; + + return ( - - {/* Overlay menu filtre */} - {showFilterMenu && ( - - - Filtrer par type - {["tout", "Outil", "Machine"].map((t) => ( + + + + + + + + + {/* Overlay menu filtre */} + {showFilterMenu && ( + + + Filtrer par type + {["tout", "Outil", "Machine"].map((t) => ( + { + setFilterType(t); + setShowFilterMenu(false); + }} + > + {t} + + ))} + + {/* Bouton "Fermer" remplacé */} { - setFilterType(t); - setShowFilterMenu(false); - }} + style={{ padding: 10, borderRadius: 8 }} + onPress={() => setShowFilterMenu(false)} > - {t} + Fermer - ))} - - {/* Bouton "Fermer" remplacé */} - setShowFilterMenu(false)} - > - Fermer - - - - )} - - index.toString()} - contentContainerStyle={{ paddingBottom: 40 }} - ListHeaderComponent={ - - - Bonjour {prenom} {nom} - - - {/* Bouton filtre en haut à droite */} - setShowFilterMenu(true)} - > - {`Filtre: ${filterType}`} - - - - - } - ListEmptyComponent={ - Aucun résultat trouvé - } - /> + )} + + index.toString()} + contentContainerStyle={{ paddingBottom: 40 }} + ListHeaderComponent={ + + + + + + {/* Bouton filtre en haut à droite */} + setShowFilterMenu(true)} + > + {`Filtre: ${filterType}`} + + + } + ListEmptyComponent={ + Aucun résultat trouvé + } + /> + ); } const styles = StyleSheet.create({ + back:{ + height:"100%", + width:"100%", + }, container: { flex: 1, - marginTop: 60, + marginTop: Constants.statusBarHeight, }, header: { + marginTop: 60, marginBottom: 20, alignItems: "center", paddingHorizontal: 20, @@ -191,7 +205,6 @@ const styles = StyleSheet.create({ width: "80%", borderRadius: 12, padding: 20, - backgroundColor: "#fff", }, filterTitle: { fontSize: 18, diff --git a/app/(tabs)/templateSreen.tsx b/app/(tabs)/templateSreen.tsx new file mode 100644 index 0000000..d553d87 --- /dev/null +++ b/app/(tabs)/templateSreen.tsx @@ -0,0 +1,31 @@ +import { ThemedView } from "@/components/themed-view"; +import Constants from "expo-constants"; //pour connaître la taille de la barre menu de l'OS en haut +import React from "react"; +import {StyleSheet, View } from "react-native"; + +import { useChantier } from "../ContextChantier"; + + +export default function TemplateScreen() { + const { chantier, setChantier } = useChantier(); + + + return ( + + + + + + ); +} + +const styles = StyleSheet.create({ + back:{ + height:"100%", + width:"100%", + }, + container: { + flex: 1, + marginTop: Constants.statusBarHeight, //pour la barre menu du haut + }, +}); diff --git a/components/selectChantier.tsx b/components/selectChantier.tsx index 5a4f96b..806c99c 100644 --- a/components/selectChantier.tsx +++ b/components/selectChantier.tsx @@ -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([]); 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() { - {chantier.chef != null ? "true" : "false"} Adresse: {chantier.adresse} Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name} État: {chantier.etat} @@ -107,14 +111,16 @@ export default function SelectChantier() { + - - + + {isLoaded? {chantiers.map((chantier, index) => renderChantier(chantier, index) )} - + : } + + )} diff --git a/components/setStatus.tsx b/components/setStatus.tsx index 902e43e..94acd19 100644 --- a/components/setStatus.tsx +++ b/components/setStatus.tsx @@ -70,7 +70,7 @@ export default function SetStatus() { - Changer l'était du chantier en {tempStatus} ? + Changer l'état du chantier en {tempStatus} ? onConfirm()}> Confirmer