clean gestionnaire_ressource et ouvrier, ajout de select Chantier + templateScreen
This commit is contained in:
@@ -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 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 { useLocalSearchParams, useRouter } from "expo-router";
|
||||||
import React, { useMemo, useState } from "react";
|
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 rawConcerts from "../../data/concerts.json";
|
||||||
|
|
||||||
import { useChantier } from "../ContextChantier";
|
import { useChantier } from "../ContextChantier";
|
||||||
|
import SelectChantier from "@/components/selectChantier";
|
||||||
|
|
||||||
type Concert = {
|
type Concert = {
|
||||||
group: string;
|
group: string;
|
||||||
@@ -56,36 +57,45 @@ export default function GestionOuvrier() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedView lvl={3} style={styles.container}>
|
<ThemedView lvl={3} style={styles.back}>
|
||||||
<FlatList
|
<View style={styles.container}>
|
||||||
data={filteredData}
|
<View style={{width:"100%", position: 'absolute'}}>
|
||||||
renderItem={renderItem}
|
<SelectChantier></SelectChantier>
|
||||||
keyExtractor={(_, index) => index.toString()}
|
</View>
|
||||||
contentContainerStyle={{ paddingBottom: 40 }}
|
|
||||||
ListHeaderComponent={
|
|
||||||
<ThemedView opacity="00" style={styles.header}>
|
|
||||||
|
|
||||||
<ThemedView style={styles.inputBack} shadow={true}>
|
|
||||||
<ThemedTextInput
|
|
||||||
lvl={0}
|
|
||||||
style={styles.input}
|
|
||||||
placeholder="Rechercher un artisant..."
|
|
||||||
value={search}
|
|
||||||
onChangeText={setSearch}
|
|
||||||
/>
|
|
||||||
</ThemedView>
|
|
||||||
</ThemedView>
|
|
||||||
}
|
|
||||||
ListEmptyComponent={
|
|
||||||
<Text style={styles.empty}>Aucun résultat n'a été trouvé</Text>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
|
<FlatList
|
||||||
|
data={filteredData}
|
||||||
|
renderItem={renderItem}
|
||||||
|
keyExtractor={(_, index) => index.toString()}
|
||||||
|
contentContainerStyle={{ paddingBottom: 40 }}
|
||||||
|
ListHeaderComponent={
|
||||||
|
<View style={styles.header}>
|
||||||
|
<ThemedView style={styles.inputBack} shadow={true}>
|
||||||
|
<ThemedTextInput
|
||||||
|
lvl={0}
|
||||||
|
style={styles.input}
|
||||||
|
placeholder="Rechercher un artisant..."
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
|
/>
|
||||||
|
</ThemedView>
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
ListEmptyComponent={
|
||||||
|
<Text style={styles.empty}>Aucun résultat n'a été trouvé</Text>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
|
back:{
|
||||||
|
height:"100%",
|
||||||
|
width:"100%",
|
||||||
|
},
|
||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
||||||
@@ -93,7 +103,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
marginTop: 60,
|
marginTop: 60,
|
||||||
marginBottom: 20,
|
marginBottom: 10,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
paddingHorizontal: 20,
|
paddingHorizontal: 20,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import { ThemedText } from "@/components/themed-text";
|
import { ThemedText } from "@/components/themed-text";
|
||||||
import { ThemedTextInput } from "@/components/themed-textinput";
|
import { ThemedTextInput } from "@/components/themed-textinput";
|
||||||
import { ThemedView } from "@/components/themed-view";
|
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 { ThemedButton } from "@/components/themed-button";
|
||||||
import { useLocalSearchParams, useRouter } from "expo-router";
|
import { useLocalSearchParams, useRouter } from "expo-router";
|
||||||
import React, { useEffect, useState } from "react";
|
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 { Ressources } from "../../class/class";
|
||||||
import { getRessources } from "../../services/ressourcesService";
|
import { getRessources } from "../../services/ressourcesService";
|
||||||
|
import SelectChantier from "@/components/selectChantier";
|
||||||
|
|
||||||
export default function GestionnaireRessource() {
|
export default function GestionnaireRessource() {
|
||||||
const { nom, prenom } = useLocalSearchParams();
|
const { nom, prenom } = useLocalSearchParams();
|
||||||
@@ -50,87 +53,98 @@ export default function GestionnaireRessource() {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedView lvl={3} style={styles.container}>
|
<ThemedView lvl={3} style={styles.back}>
|
||||||
{/* Overlay menu filtre */}
|
<View style={styles.container}>
|
||||||
{showFilterMenu && (
|
|
||||||
<ThemedView lvl={2} style={styles.filterMenuOverlay}>
|
<View style={{width:"100%", position: 'absolute'}}>
|
||||||
<ThemedView lvl={1} style={styles.filterMenu}>
|
<SelectChantier></SelectChantier>
|
||||||
<Text style={styles.filterTitle}>Filtrer par type</Text>
|
</View>
|
||||||
{["tout", "Outil", "Machine"].map((t) => (
|
|
||||||
|
|
||||||
|
{/* Overlay menu filtre */}
|
||||||
|
{showFilterMenu && (
|
||||||
|
<ThemedView lvl={2} style={styles.filterMenuOverlay}>
|
||||||
|
<ThemedView lvl={5} style={styles.filterMenu}>
|
||||||
|
<ThemedText style={styles.filterTitle}>Filtrer par type</ThemedText>
|
||||||
|
{["tout", "Outil", "Machine"].map((t) => (
|
||||||
|
<ThemedButton
|
||||||
|
key={t}
|
||||||
|
lvl={1}
|
||||||
|
shadow={true}
|
||||||
|
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
|
||||||
|
onPress={() => {
|
||||||
|
setFilterType(t);
|
||||||
|
setShowFilterMenu(false);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<ThemedText style={{ textAlign: "center" }}>{t}</ThemedText>
|
||||||
|
</ThemedButton>
|
||||||
|
))}
|
||||||
|
|
||||||
|
{/* Bouton "Fermer" remplacé */}
|
||||||
<ThemedButton
|
<ThemedButton
|
||||||
key={t}
|
|
||||||
lvl={1}
|
lvl={1}
|
||||||
shadow={true}
|
shadow={true}
|
||||||
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
|
style={{ padding: 10, borderRadius: 8 }}
|
||||||
onPress={() => {
|
onPress={() => setShowFilterMenu(false)}
|
||||||
setFilterType(t);
|
|
||||||
setShowFilterMenu(false);
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<ThemedText style={{ textAlign: "center" }}>{t}</ThemedText>
|
<ThemedText style={{ textAlign: "center" }}>Fermer</ThemedText>
|
||||||
</ThemedButton>
|
</ThemedButton>
|
||||||
))}
|
|
||||||
|
|
||||||
{/* Bouton "Fermer" remplacé */}
|
|
||||||
<ThemedButton
|
|
||||||
lvl={1}
|
|
||||||
shadow={true}
|
|
||||||
style={{ padding: 10, borderRadius: 8 }}
|
|
||||||
onPress={() => setShowFilterMenu(false)}
|
|
||||||
>
|
|
||||||
<ThemedText style={{ textAlign: "center" }}>Fermer</ThemedText>
|
|
||||||
</ThemedButton>
|
|
||||||
</ThemedView>
|
|
||||||
</ThemedView>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<FlatList
|
|
||||||
data={filteredData}
|
|
||||||
renderItem={renderRessource}
|
|
||||||
keyExtractor={(_, index) => index.toString()}
|
|
||||||
contentContainerStyle={{ paddingBottom: 40 }}
|
|
||||||
ListHeaderComponent={
|
|
||||||
<ThemedView opacity="00" style={styles.header}>
|
|
||||||
<ThemedText style={styles.text}>
|
|
||||||
Bonjour {prenom} {nom}
|
|
||||||
</ThemedText>
|
|
||||||
|
|
||||||
{/* Bouton filtre en haut à droite */}
|
|
||||||
<ThemedButton
|
|
||||||
lvl={1}
|
|
||||||
shadow={true}
|
|
||||||
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
|
|
||||||
onPress={() => setShowFilterMenu(true)}
|
|
||||||
>
|
|
||||||
<ThemedText>{`Filtre: ${filterType}`}</ThemedText>
|
|
||||||
</ThemedButton>
|
|
||||||
|
|
||||||
<ThemedView lvl={1} shadow={true} style={styles.inputBack}>
|
|
||||||
<ThemedTextInput
|
|
||||||
lvl={0}
|
|
||||||
style={styles.input}
|
|
||||||
placeholder="Rechercher une ressource..."
|
|
||||||
value={search}
|
|
||||||
onChangeText={setSearch}
|
|
||||||
/>
|
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
}
|
)}
|
||||||
ListEmptyComponent={
|
|
||||||
<ThemedText style={styles.empty}>Aucun résultat trouvé</ThemedText>
|
<FlatList
|
||||||
}
|
data={filteredData}
|
||||||
/>
|
renderItem={renderRessource}
|
||||||
|
keyExtractor={(_, index) => index.toString()}
|
||||||
|
contentContainerStyle={{ paddingBottom: 40 }}
|
||||||
|
ListHeaderComponent={
|
||||||
|
<View style={styles.header}>
|
||||||
|
<ThemedView lvl={1} shadow={true} style={styles.inputBack}>
|
||||||
|
<ThemedTextInput
|
||||||
|
lvl={0}
|
||||||
|
style={styles.input}
|
||||||
|
placeholder="Rechercher une ressource..."
|
||||||
|
value={search}
|
||||||
|
onChangeText={setSearch}
|
||||||
|
/>
|
||||||
|
</ThemedView>
|
||||||
|
|
||||||
|
{/* Bouton filtre en haut à droite */}
|
||||||
|
<ThemedButton
|
||||||
|
lvl={1}
|
||||||
|
shadow={true}
|
||||||
|
style={{ padding: 10, borderRadius: 8, marginTop: 10 }}
|
||||||
|
onPress={() => setShowFilterMenu(true)}
|
||||||
|
>
|
||||||
|
<ThemedText>{`Filtre: ${filterType}`}</ThemedText>
|
||||||
|
</ThemedButton>
|
||||||
|
</View>
|
||||||
|
}
|
||||||
|
ListEmptyComponent={
|
||||||
|
<ThemedText style={styles.empty}>Aucun résultat trouvé</ThemedText>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</View>
|
||||||
</ThemedView>
|
</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,
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
|
marginTop: 60,
|
||||||
marginBottom: 20,
|
marginBottom: 20,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
paddingHorizontal: 20,
|
paddingHorizontal: 20,
|
||||||
@@ -191,7 +205,6 @@ const styles = StyleSheet.create({
|
|||||||
width: "80%",
|
width: "80%",
|
||||||
borderRadius: 12,
|
borderRadius: 12,
|
||||||
padding: 20,
|
padding: 20,
|
||||||
backgroundColor: "#fff",
|
|
||||||
},
|
},
|
||||||
filterTitle: {
|
filterTitle: {
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
|
|||||||
31
app/(tabs)/templateSreen.tsx
Normal file
31
app/(tabs)/templateSreen.tsx
Normal file
@@ -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 (
|
||||||
|
<ThemedView lvl={3} style={styles.back}>
|
||||||
|
<View style={styles.container}>
|
||||||
|
|
||||||
|
</View>
|
||||||
|
</ThemedView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
back:{
|
||||||
|
height:"100%",
|
||||||
|
width:"100%",
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -4,6 +4,7 @@ import { getChantiers } from "@/services/ressourcesService";
|
|||||||
import { useRouter } from "expo-router";
|
import { useRouter } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
Image,
|
Image,
|
||||||
Pressable,
|
Pressable,
|
||||||
@@ -34,8 +35,10 @@ export default function SelectChantier() {
|
|||||||
const { chantier, setChantier } = useChantier();
|
const { chantier, setChantier } = useChantier();
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [isLoaded, setIsLoaded] = useState(false);
|
||||||
const [chantiers, setChantiers] = useState<Chantier[]>([]);
|
const [chantiers, setChantiers] = useState<Chantier[]>([]);
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
||||||
const AnimatedThemedView = Animated.createAnimatedComponent(ThemedView);
|
const AnimatedThemedView = Animated.createAnimatedComponent(ThemedView);
|
||||||
const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText);
|
const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText);
|
||||||
@@ -44,9 +47,11 @@ export default function SelectChantier() {
|
|||||||
Animated.createAnimatedComponent(ThemedTextInput);
|
Animated.createAnimatedComponent(ThemedTextInput);
|
||||||
|
|
||||||
async function onPressOpen(){
|
async function onPressOpen(){
|
||||||
|
setIsLoaded(false);
|
||||||
setIsOpen(!isOpen);
|
setIsOpen(!isOpen);
|
||||||
if(!isOpen){
|
if(!isOpen){
|
||||||
const updatedChantiers = await getChantiers();
|
const updatedChantiers = await getChantiers();
|
||||||
|
setIsLoaded(true);
|
||||||
setChantiers(updatedChantiers)
|
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} />
|
<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>
|
||||||
<View>
|
<View>
|
||||||
<ThemedText>{chantier.chef != null ? "true" : "false"}</ThemedText>
|
|
||||||
<ThemedText>Adresse: {chantier.adresse}</ThemedText>
|
<ThemedText>Adresse: {chantier.adresse}</ThemedText>
|
||||||
<ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText>
|
<ThemedText>Chef de chantier: {chantier.chef.last_name}{" "}{chantier.chef.name}</ThemedText>
|
||||||
<ThemedText>État: {chantier.etat}</ThemedText>
|
<ThemedText>État: {chantier.etat}</ThemedText>
|
||||||
@@ -107,14 +111,16 @@ export default function SelectChantier() {
|
|||||||
+
|
+
|
||||||
</ThemedText>
|
</ThemedText>
|
||||||
</ThemedButton>
|
</ThemedButton>
|
||||||
|
<View style={styles.list}>
|
||||||
<ThemedView lvl={2} style={styles.list}>
|
{isLoaded?
|
||||||
<ScrollView contentContainerStyle={styles.chantiersList}>
|
<ScrollView contentContainerStyle={styles.chantiersList}>
|
||||||
{chantiers.map((chantier, index) =>
|
{chantiers.map((chantier, index) =>
|
||||||
renderChantier(chantier, index)
|
renderChantier(chantier, index)
|
||||||
)}
|
)}
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</ThemedView>
|
: <ActivityIndicator style={{height:"100%"}} color="#808080" size="large" />}
|
||||||
|
</View>
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</AnimatedThemedView>
|
</AnimatedThemedView>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export default function SetStatus() {
|
|||||||
<Modal transparent={true} >
|
<Modal transparent={true} >
|
||||||
<View style={styles.overlay}>
|
<View style={styles.overlay}>
|
||||||
<ThemedView style={styles.overlayView}>
|
<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}>
|
<View style={styles.overlayView}>
|
||||||
<ThemedButton lvl={2} border={5} style={styles.buttonValid} onPress={() => onConfirm()}>
|
<ThemedButton lvl={2} border={5} style={styles.buttonValid} onPress={() => onConfirm()}>
|
||||||
<ThemedText style={{fontSize: 25}}>Confirmer</ThemedText>
|
<ThemedText style={{fontSize: 25}}>Confirmer</ThemedText>
|
||||||
|
|||||||
Reference in New Issue
Block a user