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 { 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 (
|
||||
<ThemedView lvl={3} style={styles.container}>
|
||||
<FlatList
|
||||
data={filteredData}
|
||||
renderItem={renderItem}
|
||||
keyExtractor={(_, index) => index.toString()}
|
||||
contentContainerStyle={{ paddingBottom: 40 }}
|
||||
ListHeaderComponent={
|
||||
<ThemedView opacity="00" style={styles.header}>
|
||||
<ThemedView lvl={3} style={styles.back}>
|
||||
<View style={styles.container}>
|
||||
<View style={{width:"100%", position: 'absolute'}}>
|
||||
<SelectChantier></SelectChantier>
|
||||
</View>
|
||||
|
||||
<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>
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
},
|
||||
|
||||
@@ -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 (
|
||||
<ThemedView lvl={3} style={styles.container}>
|
||||
{/* Overlay menu filtre */}
|
||||
{showFilterMenu && (
|
||||
<ThemedView lvl={2} style={styles.filterMenuOverlay}>
|
||||
<ThemedView lvl={1} style={styles.filterMenu}>
|
||||
<Text style={styles.filterTitle}>Filtrer par type</Text>
|
||||
{["tout", "Outil", "Machine"].map((t) => (
|
||||
<ThemedView lvl={3} style={styles.back}>
|
||||
<View style={styles.container}>
|
||||
|
||||
<View style={{width:"100%", position: 'absolute'}}>
|
||||
<SelectChantier></SelectChantier>
|
||||
</View>
|
||||
|
||||
|
||||
{/* 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
|
||||
key={t}
|
||||
lvl={1}
|
||||
shadow={true}
|
||||
style={{ padding: 10, borderRadius: 8, marginBottom: 10 }}
|
||||
onPress={() => {
|
||||
setFilterType(t);
|
||||
setShowFilterMenu(false);
|
||||
}}
|
||||
style={{ padding: 10, borderRadius: 8 }}
|
||||
onPress={() => setShowFilterMenu(false)}
|
||||
>
|
||||
<ThemedText style={{ textAlign: "center" }}>{t}</ThemedText>
|
||||
<ThemedText style={{ textAlign: "center" }}>Fermer</ThemedText>
|
||||
</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>
|
||||
}
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
|
||||
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
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user