Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ad91270c9e | ||
|
|
ee3f5012f7 | ||
|
|
8ba664c2ad | ||
|
|
46c6707d14 | ||
|
|
b874fdfabf | ||
|
|
ff6aafb24c | ||
|
|
d87d92adfe | ||
|
|
78152b84ae | ||
|
|
4eef83e83c | ||
|
|
ef916b2f9b | ||
|
|
b0c6829585 | ||
|
|
7092d09ba8 | ||
|
|
7c71fece6d | ||
|
|
bc566c4f7f | ||
|
|
02547dca84 | ||
|
|
6446c3f975 | ||
|
|
72dafa13c9 | ||
|
|
7c06871e45 | ||
|
|
2be434e2cf |
@@ -13,9 +13,7 @@ Lien du git : gitlab2.istic.univ-rennes1.fr/trochas/mmm-projet
|
|||||||
|
|
||||||
Différentes commandes a effectuer pour lancer le projet:
|
Différentes commandes a effectuer pour lancer le projet:
|
||||||
|
|
||||||
npm install firebase
|
npx expo install react-native-maps@1.9.0
|
||||||
npm install react-native-maps
|
npm install react-native-maps @react-navigation/native @react-navigation/bottom-tabs react-native-safe-area-context react-native-screens firebase
|
||||||
npx expo install react-native-maps
|
|
||||||
npm install react-native-maps @react-navigation/native @react-navigation/bottom-tabs react-native-safe-area-context react-native-screens
|
|
||||||
|
|
||||||
npx expo start
|
npx expo start
|
||||||
@@ -3,16 +3,19 @@ import { } from 'expo-router';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
|
||||||
import { HapticTab } from '@/components/haptic-tab';
|
import { HapticTab } from '@/components/expoExempleComponents/haptic-tab';
|
||||||
import { IconSymbol } from '@/components/ui/icon-symbol';
|
import { IconSymbol } from '@/components/ui/icon-symbol';
|
||||||
import { Colors } from '@/constants/theme';
|
import { Colors } from '@/constants/theme';
|
||||||
import { useColorScheme } from '@/hooks/use-color-scheme';
|
import { useColorScheme } from '@/hooks/use-color-scheme';
|
||||||
import BonjourScreen from './bonjourFL';
|
import GestionOuvrier from './gestion_ouvrier';
|
||||||
import ListMateriel from './gestionnaire_ressource';
|
import ListMateriel from './gestionnaire_ressource';
|
||||||
import Home from './home';
|
import Home from './home';
|
||||||
import MapScreen from './mapScreen';
|
import MapScreen from './mapScreen';
|
||||||
|
import AddChantier from './addChantier';
|
||||||
import AntDesign from '@expo/vector-icons/AntDesign';
|
import AntDesign from '@expo/vector-icons/AntDesign';
|
||||||
|
import { UserProvider } from '../ContextUser';
|
||||||
|
import { ChantierProvider } from '../ContextChantier';
|
||||||
|
import { RessourcesProvider } from '../ContextRessource';
|
||||||
|
|
||||||
const Tabs = createBottomTabNavigator();
|
const Tabs = createBottomTabNavigator();
|
||||||
|
|
||||||
@@ -26,7 +29,7 @@ export default function TabLayout() {
|
|||||||
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
|
tabBarActiveTintColor: Colors[colorScheme ?? 'light'].tint,
|
||||||
headerShown: false,
|
headerShown: false,
|
||||||
tabBarButton: HapticTab,
|
tabBarButton: HapticTab,
|
||||||
}}>
|
}}>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="home"
|
name="home"
|
||||||
component={Home}
|
component={Home}
|
||||||
@@ -36,7 +39,7 @@ export default function TabLayout() {
|
|||||||
<IconSymbol size={28} name="house.fill" color={color} />
|
<IconSymbol size={28} name="house.fill" color={color} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="gestionnaire_ressource"
|
name="gestionnaire_ressource"
|
||||||
component={ListMateriel}
|
component={ListMateriel}
|
||||||
@@ -48,8 +51,8 @@ export default function TabLayout() {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="bonjourFL"
|
name="GestionOuvrier"
|
||||||
component={BonjourScreen}
|
component={GestionOuvrier}
|
||||||
options={{
|
options={{
|
||||||
title: 'Bonjour',
|
title: 'Bonjour',
|
||||||
tabBarIcon: ({ color }) => <IconSymbol size={28} name="person.fill" color={color} />,
|
tabBarIcon: ({ color }) => <IconSymbol size={28} name="person.fill" color={color} />,
|
||||||
@@ -65,16 +68,16 @@ export default function TabLayout() {
|
|||||||
>
|
>
|
||||||
</Tabs.Screen>
|
</Tabs.Screen>
|
||||||
<Tabs.Screen
|
<Tabs.Screen
|
||||||
name="ajouterChantier"
|
name="addChantier"
|
||||||
component={ListMateriel}
|
component={AddChantier}
|
||||||
options={{
|
options={{
|
||||||
title: 'Ajouter',
|
title: 'Ajouter',
|
||||||
tabBarIcon: ({ color }) => (
|
tabBarIcon: ({ color }) => (
|
||||||
<AntDesign name="plus" size={24} color="black" />
|
<AntDesign name="plus" size={24} color={color} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</Tabs.Navigator>
|
</Tabs.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
178
app/(tabs)/addChantier.tsx
Normal file
178
app/(tabs)/addChantier.tsx
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
import ChantierSummary from '@/components/chantierSummary';
|
||||||
|
import SelectChantier from '@/components/selectChantier';
|
||||||
|
import SetStatus from '@/components/setStatus';
|
||||||
|
|
||||||
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { StyleSheet, ScrollView, Button, TextInput, Text, View } from 'react-native';
|
||||||
|
import { useChantier } from '../ContextChantier';
|
||||||
|
import { useRessources } from '../ContextRessource';
|
||||||
|
import { useUser } from '../ContextUser';
|
||||||
|
import { getRessources, getUsers, addChantier } from '@/services/ressourcesService';
|
||||||
|
import { Chantier, Ressources } from '@/class/class';
|
||||||
|
import { ThemedText } from '@/components/theme/themed-text';
|
||||||
|
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 [objet, setObjet] = useState('');
|
||||||
|
const [date, setDate] = useState('');
|
||||||
|
const [chefChantier, setChefChantier] = useState('');
|
||||||
|
const [adresse, setAdresse] = useState('');
|
||||||
|
const [duree, setDuree] = useState('');
|
||||||
|
const [contact, setContact] = useState('');
|
||||||
|
const [userSelect, setUserSelect] = useState<string[]>([]);
|
||||||
|
const [ressourcesSelect, setRessourcesSelect] = useState<string[]>([]);
|
||||||
|
|
||||||
|
async function handleAddChantier() {
|
||||||
|
setLoading(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderInut = (name : string, preFill : string, value : string, setValue : ((text:string) => void)) => {
|
||||||
|
return (
|
||||||
|
<View style = {styles.inputLine}>
|
||||||
|
<ThemedText style = {styles.inputName}>{name}:</ThemedText>
|
||||||
|
<ThemedTextInput lvl = {1} style = {styles.input} placeholder={preFill} value = {value} onChangeText={setAdresse} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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}>
|
||||||
|
{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>
|
||||||
|
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
</ThemedView>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
back:{
|
||||||
|
height:"100%",
|
||||||
|
width:"100%",
|
||||||
|
},
|
||||||
|
container: {
|
||||||
|
flex: 1,
|
||||||
|
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
||||||
|
},
|
||||||
|
header: {
|
||||||
|
marginTop:60,
|
||||||
|
alignItems: "center",
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
fontSize: 22,
|
||||||
|
fontWeight: "bold",
|
||||||
|
marginBottom: 10,
|
||||||
|
},
|
||||||
|
inputBack: {
|
||||||
|
width: "100%",
|
||||||
|
borderRadius: 10,
|
||||||
|
backgroundColor: "transparent",
|
||||||
|
},
|
||||||
|
inputLine:{
|
||||||
|
width: "100%",
|
||||||
|
//flexDirection: 'row',
|
||||||
|
paddingVertical: 5,
|
||||||
|
//alignItems: "center",
|
||||||
|
},
|
||||||
|
inputName: {
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
input: {
|
||||||
|
width: "100%",
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
|
card: {
|
||||||
|
flexDirection: "row",
|
||||||
|
marginHorizontal: 20,
|
||||||
|
marginBottom: 15,
|
||||||
|
borderRadius: 10,
|
||||||
|
padding: 10,
|
||||||
|
},
|
||||||
|
image: {
|
||||||
|
width: 80,
|
||||||
|
height: 80,
|
||||||
|
borderRadius: 8,
|
||||||
|
marginRight: 10,
|
||||||
|
},
|
||||||
|
info: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: "center",
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
padding: 20,
|
||||||
|
},
|
||||||
|
empty: {
|
||||||
|
textAlign: "center",
|
||||||
|
marginTop: 30,
|
||||||
|
color: "#888",
|
||||||
|
},
|
||||||
|
filterMenuOverlay: {
|
||||||
|
position: "absolute",
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
bottom: 0,
|
||||||
|
backgroundColor: "rgba(0,0,0,0.4)",
|
||||||
|
justifyContent: "center",
|
||||||
|
alignItems: "center",
|
||||||
|
zIndex: 999,
|
||||||
|
},
|
||||||
|
filterMenu: {
|
||||||
|
width: "80%",
|
||||||
|
borderRadius: 12,
|
||||||
|
padding: 20,
|
||||||
|
backgroundColor: "#fff",
|
||||||
|
},
|
||||||
|
filterTitle: {
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: "bold",
|
||||||
|
marginBottom: 20,
|
||||||
|
textAlign: "center",
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
import ChantierSummary from '@/components/chantierSummary';
|
|
||||||
import SelectChantier from '@/components/selectChantier';
|
|
||||||
import SetStatus from '@/components/setStatus';
|
|
||||||
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';
|
|
||||||
import { useRessources } from '../ContextRessource';
|
|
||||||
|
|
||||||
export default function ajouterChantier() {
|
|
||||||
const { chantier, setChantier } = useChantier();
|
|
||||||
//const { artisant, setArtisant } = useArtisant();
|
|
||||||
const { ressources, setRessources } = useRessources();
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import { Image } from 'expo-image';
|
import { Image } from 'expo-image';
|
||||||
import { Platform, StyleSheet } from 'react-native';
|
import { Platform, StyleSheet } from 'react-native';
|
||||||
|
|
||||||
import { ExternalLink } from '@/components/external-link';
|
import { ExternalLink } from '@/components/expoExempleComponents/external-link';
|
||||||
import ParallaxScrollView from '@/components/parallax-scroll-view';
|
import ParallaxScrollView from '@/components/expoExempleComponents/parallax-scroll-view';
|
||||||
import SelectChantier from '@/components/selectChantier';
|
import SelectChantier from '@/components/selectChantier';
|
||||||
import { ThemedText } from '@/components/themed-text';
|
import { ThemedText } from '@/components/theme/themed-text';
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
import { Collapsible } from '@/components/ui/collapsible';
|
import { Collapsible } from '@/components/ui/collapsible';
|
||||||
import { IconSymbol } from '@/components/ui/icon-symbol';
|
import { IconSymbol } from '@/components/ui/icon-symbol';
|
||||||
import { Fonts } from '@/constants/theme';
|
import { Fonts } from '@/constants/theme';
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import SelectChantier from "@/components/selectChantier";
|
import { ThemedText } from "@/components/theme/themed-text";
|
||||||
import { ThemedText } from "@/components/themed-text";
|
import { ThemedTextInput } from "@/components/theme/themed-textinput";
|
||||||
import { ThemedTextInput } from "@/components/themed-textinput";
|
import { ThemedView } from "@/components/theme/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 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;
|
||||||
@@ -21,7 +21,7 @@ type Concert = {
|
|||||||
favorite: boolean;
|
favorite: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function BonjourScreen() {
|
export default function GestionOuvrier() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const { nom, prenom } = useLocalSearchParams(); // Recup data ecran precedent
|
const { nom, prenom } = useLocalSearchParams(); // Recup data ecran precedent
|
||||||
const [search, setSearch] = useState("");
|
const [search, setSearch] = useState("");
|
||||||
@@ -57,48 +57,45 @@ export default function BonjourScreen() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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}>
|
|
||||||
<ThemedText style={styles.text}>
|
|
||||||
Bonjour {prenom} {nom} {chantier && chantier.chef.name}
|
|
||||||
</ThemedText>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<ThemedView
|
<FlatList
|
||||||
style={{
|
data={filteredData}
|
||||||
width: "100%",
|
renderItem={renderItem}
|
||||||
position: "absolute",
|
keyExtractor={(_, index) => index.toString()}
|
||||||
backgroundColor: "transparent",
|
contentContainerStyle={{ paddingBottom: 40 }}
|
||||||
}}
|
ListHeaderComponent={
|
||||||
>
|
<View style={styles.header}>
|
||||||
<SelectChantier></SelectChantier>
|
<ThemedView style={styles.inputBack} shadow={true}>
|
||||||
</ThemedView>
|
<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
|
||||||
@@ -106,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/theme/themed-text";
|
||||||
import { ThemedTextInput } from "@/components/themed-textinput";
|
import { ThemedTextInput } from "@/components/theme/themed-textinput";
|
||||||
import { ThemedView } from "@/components/themed-view";
|
import { ThemedView } from "@/components/theme/themed-view";
|
||||||
import { ThemedButton } from "@/components/themed-button";
|
import Constants from "expo-constants"; //pour connaître la taille de la barre menu de l'OS en haut
|
||||||
|
|
||||||
|
import { ThemedButton } from "@/components/theme/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,
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import ChantierSummary from '@/components/chantierSummary';
|
import ChantierSummary from '@/components/chantierSummary';
|
||||||
import SelectChantier from '@/components/selectChantier';
|
import SelectChantier from '@/components/selectChantier';
|
||||||
import SetStatus from '@/components/setStatus';
|
import SetStatus from '@/components/setStatus';
|
||||||
import { ThemedView, } from '@/components/themed-view';
|
import { ThemedView, } from '@/components/theme/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 React from 'react';
|
import React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View,Text } from 'react-native';
|
||||||
import { useChantier } from '../ContextChantier';
|
import { useChantier } from '../ContextChantier';
|
||||||
|
import Anomaly from '@/components/anomaly';
|
||||||
|
|
||||||
import { useUser } from '../ContextUser';
|
import { useUser } from '../ContextUser';
|
||||||
|
|
||||||
|
|
||||||
@@ -14,21 +16,20 @@ export default function Home() {
|
|||||||
const { chantier, setChantier } = useChantier();
|
const { chantier, setChantier } = useChantier();
|
||||||
const { role } = useUser();
|
const { role } = useUser();
|
||||||
|
|
||||||
console.log("User", role);
|
console.log("ROLE USER", role)
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<ThemedView lvl={3} style={styles.back}>
|
<ThemedView lvl={3} style={styles.back}>
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<ChantierSummary style={styles.summary} data={{ chantier }} />
|
|
||||||
<View style={{width:"100%", position: 'absolute'}}>
|
<View style={{width:"100%", position: 'absolute'}}>
|
||||||
<SelectChantier></SelectChantier>
|
<SelectChantier></SelectChantier>
|
||||||
</View>
|
</View>
|
||||||
{role === "chef" && (
|
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
|
||||||
<View style={{width:"100%", position: 'absolute',marginLeft:"50%"}}>
|
<SetStatus></SetStatus>
|
||||||
<SetStatus></SetStatus>
|
</View>
|
||||||
</View>
|
<ChantierSummary style={styles.summary} data={{ chantier }} />
|
||||||
)}
|
<Anomaly style={styles.anomaly} data={{chantier}}/>
|
||||||
{role === "resp"}
|
{role === "chef"}
|
||||||
|
|
||||||
</View>
|
</View>
|
||||||
</ThemedView>
|
</ThemedView>
|
||||||
@@ -43,13 +44,16 @@ const styles = StyleSheet.create({
|
|||||||
container: {
|
container: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
marginTop: Constants.statusBarHeight, //pour la barre menu du haut
|
||||||
|
paddingTop : 60,
|
||||||
},
|
},
|
||||||
header: {
|
header: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
width:"100%"
|
width:"100%"
|
||||||
},
|
},
|
||||||
summary:{
|
summary:{
|
||||||
marginTop:60,
|
padding:10,
|
||||||
|
},
|
||||||
|
anomaly:{
|
||||||
padding:10,
|
padding:10,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Image } from 'expo-image';
|
import { Image } from 'expo-image';
|
||||||
import { Platform, StyleSheet } from 'react-native';
|
import { Platform, StyleSheet } from 'react-native';
|
||||||
|
|
||||||
import { HelloWave } from '@/components/hello-wave';
|
import { HelloWave } from '@/components/expoExempleComponents/hello-wave';
|
||||||
import ParallaxScrollView from '@/components/parallax-scroll-view';
|
import ParallaxScrollView from '@/components/expoExempleComponents/parallax-scroll-view';
|
||||||
import { ThemedText } from '@/components/themed-text';
|
import { ThemedText } from '@/components/theme/themed-text';
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
import { Link } from 'expo-router';
|
import { Link } from 'expo-router';
|
||||||
|
|
||||||
export default function HomeScreen() {
|
export default function HomeScreen() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// MapScreen.tsx
|
// MapScreen.tsx
|
||||||
import { ThemedMapView } from '@/components/themed-mapview';
|
import { ThemedMapView } from '@/components/theme/themed-mapview';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { StyleSheet, View, Dimensions, Image, Text } from 'react-native';
|
import { StyleSheet, View, Dimensions, Image, Text } from 'react-native';
|
||||||
import MapView, { Marker, Callout, CalloutSubview, PROVIDER_DEFAULT } from 'react-native-maps';
|
import MapView, { Marker, Callout, CalloutSubview, PROVIDER_DEFAULT } from 'react-native-maps';
|
||||||
|
|||||||
31
app/(tabs)/templateSreen.tsx
Normal file
31
app/(tabs)/templateSreen.tsx
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
import { ThemedView } from "@/components/theme/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
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -14,10 +14,9 @@ import { auth, db } from "../firebase_config";
|
|||||||
|
|
||||||
import { Platform, UIManager } from 'react-native';
|
import { Platform, UIManager } from 'react-native';
|
||||||
import { ChantierProvider } from "./ContextChantier";
|
import { ChantierProvider } from "./ContextChantier";
|
||||||
import { useUser } from "./ContextUser";
|
import { UserProvider } from "./ContextUser";
|
||||||
import { RessourcesProvider } from "./ContextRessource";
|
import { RessourcesProvider } from "./ContextRessource";
|
||||||
import LoginScreen from "./login/login";
|
import { useUser } from "./ContextUser";
|
||||||
|
|
||||||
|
|
||||||
export const unstable_settings = {
|
export const unstable_settings = {
|
||||||
anchor: "(tabs)",
|
anchor: "(tabs)",
|
||||||
@@ -26,63 +25,54 @@ export const unstable_settings = {
|
|||||||
export default function RootLayout() {
|
export default function RootLayout() {
|
||||||
const colorScheme = useColorScheme();
|
const colorScheme = useColorScheme();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const [loading, setLoading] = useState(true);
|
const { setUser, setRole } = useUser();
|
||||||
const { setUser, setRole, user } = useUser();
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const unsubscribe = onAuthStateChanged(auth, async (currentUser) => {
|
const unsubscribe = onAuthStateChanged(auth, async (currentUser) => {
|
||||||
if (!currentUser) {
|
if (!currentUser) {
|
||||||
console.log("No user logged in");
|
|
||||||
setUser(null);
|
setUser(null);
|
||||||
setRole(null);
|
setRole(null);
|
||||||
setLoading(false);
|
router.replace("/login/login");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setUser(currentUser);
|
|
||||||
|
|
||||||
const userDocRef = doc(db, "user", currentUser.uid);
|
const userDocRef = doc(db, "user", currentUser.uid);
|
||||||
const userDoc = await getDoc(userDocRef);
|
const userDoc = await getDoc(userDocRef);
|
||||||
console.log("User doc data:", userDoc.data());
|
|
||||||
if (!userDoc.exists()) {
|
if (!userDoc.exists()) {
|
||||||
|
router.replace("/login/login");
|
||||||
setUser(null);
|
setUser(null);
|
||||||
setLoading(false);
|
setRole(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setRole(userDoc.data().role);
|
|
||||||
setUser(currentUser);
|
|
||||||
setLoading(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
return unsubscribe;
|
const { role } = userDoc.data();
|
||||||
|
console.log("ROLE APP",role)
|
||||||
|
setUser(currentUser);
|
||||||
|
setRole(role);
|
||||||
|
router.replace("/(tabs)/home");
|
||||||
|
});
|
||||||
|
return unsubscribe;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return null; // ou un SplashScreen
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<UserProvider>
|
||||||
<ChantierProvider>
|
<ChantierProvider>
|
||||||
<RessourcesProvider>
|
<RessourcesProvider>
|
||||||
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
|
<RootLayout></RootLayout>
|
||||||
|
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
|
||||||
{user ? (
|
|
||||||
<Stack>
|
<Stack>
|
||||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||||
<Stack.Screen name="selectChantier" options={{ headerShown: false }} />
|
<Stack.Screen name="selectChantier" options={{ headerShown: false }}/>
|
||||||
<Stack.Screen
|
<Stack.Screen
|
||||||
name="modal"
|
name="modal"
|
||||||
options={{ presentation: "modal", title: "Modal" }}
|
options={{ presentation: "modal", title: "Modal" }}
|
||||||
/>
|
/>
|
||||||
|
<Stack.Screen name="login" options={{ headerShown: false }} />
|
||||||
</Stack>
|
</Stack>
|
||||||
) : (
|
<StatusBar style="auto" />
|
||||||
<LoginScreen />
|
</ThemeProvider>
|
||||||
)}
|
|
||||||
|
|
||||||
<StatusBar style="auto" />
|
|
||||||
</ThemeProvider>
|
|
||||||
</RessourcesProvider>
|
</RessourcesProvider>
|
||||||
</ChantierProvider>
|
</ChantierProvider>
|
||||||
|
</UserProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
import { Slot } from "expo-router";
|
|
||||||
import { UserProvider } from "./ContextUser";
|
|
||||||
|
|
||||||
export default function Layout() {
|
|
||||||
return (
|
|
||||||
<UserProvider>
|
|
||||||
<Slot />
|
|
||||||
</UserProvider>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { ThemedText } from "@/components/themed-text";
|
import { ThemedText } from "@/components/theme/themed-text";
|
||||||
import { ThemedTextInput } from "@/components/themed-textinput";
|
import { ThemedTextInput } from "@/components/theme/themed-textinput";
|
||||||
import { ThemedView } from "@/components/themed-view";
|
import { ThemedView } from "@/components/theme/themed-view";
|
||||||
import { router } from "expo-router";
|
import { router } from "expo-router";
|
||||||
import {
|
import {
|
||||||
signInWithEmailAndPassword
|
signInWithEmailAndPassword
|
||||||
@@ -8,14 +8,12 @@ import {
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Button, StyleSheet, View } from "react-native";
|
import { Button, StyleSheet, View } from "react-native";
|
||||||
import { auth } from "../../firebase_config";
|
import { auth } from "../../firebase_config";
|
||||||
import { useUser } from "../ContextUser";
|
|
||||||
|
|
||||||
const DEFAULT_ROLE = "resp";
|
const DEFAULT_ROLE = "resp";
|
||||||
|
|
||||||
const LoginScreen: React.FC = () => {
|
const LoginScreen: React.FC = () => {
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
const [password, setPassword] = useState<string>("");
|
const [password, setPassword] = useState<string>("");
|
||||||
const { setUser, setRole } = useUser();
|
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -37,7 +35,7 @@ const LoginScreen: React.FC = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ThemedView lvl={1} style={styles.container}>
|
<ThemedView lvl={1} style={styles.container}>
|
||||||
<ThemedText style={styles.title}>Se connecter / S'incrire</ThemedText>
|
<ThemedText style={styles.title}>Se connecter</ThemedText>
|
||||||
<ThemedTextInput
|
<ThemedTextInput
|
||||||
lvl = {2}
|
lvl = {2}
|
||||||
border = {5}
|
border = {5}
|
||||||
@@ -83,4 +81,4 @@ const styles = StyleSheet.create({
|
|||||||
padding: 10,
|
padding: 10,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import { Link } from 'expo-router';
|
import { Link } from 'expo-router';
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
|
|
||||||
import { ThemedText } from '@/components/themed-text';
|
import { ThemedText } from '@/components/theme/themed-text';
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
|
|
||||||
export default function ModalScreen() {
|
export default function ModalScreen() {
|
||||||
return (
|
return (
|
||||||
|
|||||||
58
components/anomaly.tsx
Normal file
58
components/anomaly.tsx
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
import { Chantier } from '@/class/class';
|
||||||
|
import { ThemedView, } from '@/components/theme/themed-view';
|
||||||
|
import React from 'react';
|
||||||
|
import { Image, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
||||||
|
import { ThemedText } from './theme/themed-text';
|
||||||
|
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
data: {
|
||||||
|
chantier:Chantier|null;
|
||||||
|
}
|
||||||
|
style?: StyleProp<ViewStyle>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function Anomaly({data,style , ...otherProps }: Props) {
|
||||||
|
|
||||||
|
return(
|
||||||
|
<View style={style}>
|
||||||
|
{data.chantier ? (
|
||||||
|
<ThemedView lvl={4} style={styles.anomaliesContainer}>
|
||||||
|
<ThemedText style={styles.anomaliesTitle}>Anomalies</ThemedText>
|
||||||
|
{data.chantier.anomalies.length > 0 ? (
|
||||||
|
data.chantier.anomalies.map((anomaly, index) => (
|
||||||
|
<ThemedView key={index} lvl={2} style={styles.anomalyItem}>
|
||||||
|
<ThemedText>• {anomaly}</ThemedText>
|
||||||
|
</ThemedView>
|
||||||
|
))
|
||||||
|
) : (
|
||||||
|
<ThemedText style={styles.noAnomaly}>Aucune anomalie</ThemedText>
|
||||||
|
) }
|
||||||
|
</ThemedView>
|
||||||
|
): null}
|
||||||
|
</View>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const styles = StyleSheet.create({
|
||||||
|
//Anomalies styles
|
||||||
|
anomaliesContainer: {
|
||||||
|
padding: 5,
|
||||||
|
borderRadius: 10,
|
||||||
|
height: 150,
|
||||||
|
},
|
||||||
|
anomaliesTitle: {
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: "bold",
|
||||||
|
marginBottom: 8,
|
||||||
|
},
|
||||||
|
anomalyItem: {
|
||||||
|
padding: 8,
|
||||||
|
marginBottom: 5,
|
||||||
|
borderRadius: 8,
|
||||||
|
},
|
||||||
|
noAnomaly: {
|
||||||
|
fontStyle: "italic",
|
||||||
|
opacity: 0.7,
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import { Chantier } from '@/class/class';
|
import { Chantier } from '@/class/class';
|
||||||
import { ThemedView, } from '@/components/themed-view';
|
import { ThemedView, } from '@/components/theme/themed-view';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Image, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
import { Image, StyleProp, StyleSheet, View, ViewStyle } from 'react-native';
|
||||||
import { ThemedText } from './themed-text';
|
import { ThemedText } from './theme/themed-text';
|
||||||
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
data: {
|
data: {
|
||||||
@@ -13,10 +12,8 @@ type Props = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default function ChantierSummary({data,style , ...otherProps }: Props) {
|
export default function ChantierSummary({data,style , ...otherProps }: Props) {
|
||||||
|
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<View style={style}>
|
<View style={style}>
|
||||||
{data.chantier ? (
|
{data.chantier ? (
|
||||||
<ThemedView lvl={4} style={styles.chantier}>
|
<ThemedView lvl={4} style={styles.chantier}>
|
||||||
<View>
|
<View>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import Animated, {
|
|||||||
useScrollOffset,
|
useScrollOffset,
|
||||||
} from 'react-native-reanimated';
|
} from 'react-native-reanimated';
|
||||||
|
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
import { useColorScheme } from '@/hooks/use-color-scheme';
|
import { useColorScheme } from '@/hooks/use-color-scheme';
|
||||||
import { useThemeColor } from '@/hooks/use-theme-color';
|
import { useThemeColor } from '@/hooks/use-theme-color';
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@ export default function ParallaxScrollView({
|
|||||||
headerImage,
|
headerImage,
|
||||||
headerBackgroundColor,
|
headerBackgroundColor,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const backgroundColor = useThemeColor({}, 'background');
|
const backgroundColor = useThemeColor({}, 'background3');
|
||||||
const colorScheme = useColorScheme() ?? 'light';
|
const colorScheme = useColorScheme() ?? 'light';
|
||||||
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
const scrollRef = useAnimatedRef<Animated.ScrollView>();
|
||||||
const scrollOffset = useScrollOffset(scrollRef);
|
const scrollOffset = useScrollOffset(scrollRef);
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
import { useChantier } from "@/app/ContextChantier";
|
import { useChantier } from "@/app/ContextChantier";
|
||||||
import { Chantier } from "@/class/class";
|
import { Chantier } from "@/class/class";
|
||||||
import { getChantiers } from "@/services/ressourcesService";
|
import { getChantiers } from "@/services/ressourcesService";
|
||||||
|
import { useRouter } from "expo-router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
ActivityIndicator,
|
||||||
Dimensions,
|
Dimensions,
|
||||||
Image,
|
Image,
|
||||||
Pressable,
|
Pressable,
|
||||||
@@ -13,10 +15,10 @@ import {
|
|||||||
import Animated, {
|
import Animated, {
|
||||||
LinearTransition
|
LinearTransition
|
||||||
} from "react-native-reanimated";
|
} from "react-native-reanimated";
|
||||||
import { ThemedButton } from "./themed-button";
|
import { ThemedButton } from "@/components/theme/themed-button";
|
||||||
import { ThemedText } from "./themed-text";
|
import { ThemedText } from "@/components/theme/themed-text";
|
||||||
import { ThemedTextInput } from "./themed-textinput";
|
import { ThemedTextInput } from "@/components/theme/themed-textinput";
|
||||||
import { ThemedView } from "./themed-view";
|
import { ThemedView } from "@/components/theme/themed-view";
|
||||||
|
|
||||||
const screenHeight = Dimensions.get("window").height;
|
const screenHeight = Dimensions.get("window").height;
|
||||||
const { width, height } = Dimensions.get("window");
|
const { width, height } = Dimensions.get("window");
|
||||||
@@ -33,8 +35,11 @@ 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 AnimatedThemedView = Animated.createAnimatedComponent(ThemedView);
|
const AnimatedThemedView = Animated.createAnimatedComponent(ThemedView);
|
||||||
const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText);
|
const AnimatedThemedText = Animated.createAnimatedComponent(ThemedText);
|
||||||
const AnimatedThemedButton = Animated.createAnimatedComponent(ThemedButton);
|
const AnimatedThemedButton = Animated.createAnimatedComponent(ThemedButton);
|
||||||
@@ -42,15 +47,18 @@ 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPressAddChantier(){
|
function onPressAddChantier(){
|
||||||
|
router.push("/(tabs)/addChantier")
|
||||||
|
setIsOpen(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -75,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>
|
||||||
@@ -104,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>
|
||||||
@@ -214,5 +223,8 @@ const styles = StyleSheet.create({
|
|||||||
buttonAdd:{
|
buttonAdd:{
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
|
height: 30,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center',
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { changeChantierStatus } from "@/services/ressourcesService";
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Dimensions, LayoutAnimation, Modal, Pressable, StyleSheet, View } from 'react-native';
|
import { Dimensions, LayoutAnimation, Modal, Pressable, StyleSheet, View } from 'react-native';
|
||||||
import Animated, { LinearTransition } from 'react-native-reanimated';
|
import Animated, { LinearTransition } from 'react-native-reanimated';
|
||||||
import { ThemedButton } from './themed-button';
|
import { ThemedButton } from './theme/themed-button';
|
||||||
import { ThemedText } from './themed-text';
|
import { ThemedText } from './theme/themed-text';
|
||||||
import { ThemedView } from "./themed-view";
|
import { ThemedView } from "./theme/themed-view";
|
||||||
|
|
||||||
const { width, height } = Dimensions.get("window");
|
const { width, height } = Dimensions.get("window");
|
||||||
|
|
||||||
@@ -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>
|
||||||
@@ -162,6 +162,7 @@ const styles = StyleSheet.create({
|
|||||||
borderRadius: 15,
|
borderRadius: 15,
|
||||||
padding: 10,
|
padding: 10,
|
||||||
height:40,
|
height:40,
|
||||||
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
centeredText:{
|
centeredText:{
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
@@ -188,6 +189,7 @@ const styles = StyleSheet.create({
|
|||||||
padding: 10,
|
padding: 10,
|
||||||
height:60,
|
height:60,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
justifyContent: 'center',
|
||||||
},
|
},
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { PropsWithChildren, useState } from 'react';
|
import { PropsWithChildren, useState } from 'react';
|
||||||
import { StyleSheet, TouchableOpacity } from 'react-native';
|
import { StyleSheet, TouchableOpacity } from 'react-native';
|
||||||
|
|
||||||
import { ThemedText } from '@/components/themed-text';
|
import { ThemedText } from '@/components/theme/themed-text';
|
||||||
import { ThemedView } from '@/components/themed-view';
|
import { ThemedView } from '@/components/theme/themed-view';
|
||||||
import { IconSymbol } from '@/components/ui/icon-symbol';
|
import { IconSymbol } from '@/components/ui/icon-symbol';
|
||||||
import { Colors } from '@/constants/theme';
|
import { Colors } from '@/constants/theme';
|
||||||
import { useColorScheme } from '@/hooks/use-color-scheme';
|
import { useColorScheme } from '@/hooks/use-color-scheme';
|
||||||
|
|||||||
73
package-lock.json
generated
73
package-lock.json
generated
@@ -9,9 +9,9 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^15.0.2",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-navigation/bottom-tabs": "^7.8.2",
|
"@react-navigation/bottom-tabs": "^7.8.12",
|
||||||
"@react-navigation/elements": "^2.6.3",
|
"@react-navigation/elements": "^2.6.3",
|
||||||
"@react-navigation/native": "^7.1.19",
|
"@react-navigation/native": "^7.1.25",
|
||||||
"expo": "~54.0.13",
|
"expo": "~54.0.13",
|
||||||
"expo-constants": "~18.0.9",
|
"expo-constants": "~18.0.9",
|
||||||
"expo-font": "~14.0.9",
|
"expo-font": "~14.0.9",
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"react-native": "0.81.4",
|
"react-native": "0.81.4",
|
||||||
"react-native-gesture-handler": "~2.28.0",
|
"react-native-gesture-handler": "~2.28.0",
|
||||||
"react-native-maps": "1.20.1",
|
"react-native-maps": "1.9.0",
|
||||||
"react-native-reanimated": "~4.1.1",
|
"react-native-reanimated": "~4.1.1",
|
||||||
"react-native-safe-area-context": "~5.6.0",
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
"react-native-screens": "~4.16.0",
|
"react-native-screens": "~4.16.0",
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "~19.1.0",
|
"@types/react": "~19.1.0",
|
||||||
|
"baseline-browser-mapping": "^2.9.6",
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~10.0.0",
|
"eslint-config-expo": "~10.0.0",
|
||||||
"typescript": "~5.9.2"
|
"typescript": "~5.9.2"
|
||||||
@@ -2326,6 +2327,7 @@
|
|||||||
"version": "0.14.6",
|
"version": "0.14.6",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.14.6.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.14.6.tgz",
|
||||||
"integrity": "sha512-4uyt8BOrBsSq6i4yiOV/gG6BnnrvTeyymlNcaN/dKvyU1GoolxAafvIvaNP1RCGPlNab3OuE4MKUQuv2lH+PLQ==",
|
"integrity": "sha512-4uyt8BOrBsSq6i4yiOV/gG6BnnrvTeyymlNcaN/dKvyU1GoolxAafvIvaNP1RCGPlNab3OuE4MKUQuv2lH+PLQ==",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@firebase/component": "0.7.0",
|
"@firebase/component": "0.7.0",
|
||||||
"@firebase/logger": "0.5.0",
|
"@firebase/logger": "0.5.0",
|
||||||
@@ -2391,6 +2393,7 @@
|
|||||||
"version": "0.5.6",
|
"version": "0.5.6",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.5.6.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/app-compat/-/app-compat-0.5.6.tgz",
|
||||||
"integrity": "sha512-YYGARbutghQY4zZUWMYia0ib0Y/rb52y72/N0z3vglRHL7ii/AaK9SA7S/dzScVOlCdnbHXz+sc5Dq+r8fwFAg==",
|
"integrity": "sha512-YYGARbutghQY4zZUWMYia0ib0Y/rb52y72/N0z3vglRHL7ii/AaK9SA7S/dzScVOlCdnbHXz+sc5Dq+r8fwFAg==",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@firebase/app": "0.14.6",
|
"@firebase/app": "0.14.6",
|
||||||
"@firebase/component": "0.7.0",
|
"@firebase/component": "0.7.0",
|
||||||
@@ -3806,17 +3809,17 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@react-navigation/bottom-tabs": {
|
"node_modules/@react-navigation/bottom-tabs": {
|
||||||
"version": "7.8.2",
|
"version": "7.8.12",
|
||||||
"resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-7.8.2.tgz",
|
"resolved": "https://registry.npmjs.org/@react-navigation/bottom-tabs/-/bottom-tabs-7.8.12.tgz",
|
||||||
"integrity": "sha512-QOcRZj6hA5QZg8PztlEaNOjbQRq75NKM26yTFXdL81OWM2qgry3tascIhBvLUak35NryG1iqQXzSpgn3I/86+g==",
|
"integrity": "sha512-efVt5ydHK+b4ZtjmN81iduaO5dPCmzhLBFwjCR8pV4x4VzUfJmtUJizLqTXpT3WatHdeon2gDPwhhoelsvu/JA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/elements": "^2.8.1",
|
"@react-navigation/elements": "^2.9.2",
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
"sf-symbols-typescript": "^2.1.0"
|
"sf-symbols-typescript": "^2.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-navigation/native": "^7.1.19",
|
"@react-navigation/native": "^7.1.25",
|
||||||
"react": ">= 18.2.0",
|
"react": ">= 18.2.0",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-safe-area-context": ">= 4.0.0",
|
"react-native-safe-area-context": ">= 4.0.0",
|
||||||
@@ -3824,12 +3827,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-navigation/core": {
|
"node_modules/@react-navigation/core": {
|
||||||
"version": "7.13.0",
|
"version": "7.13.6",
|
||||||
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-7.13.0.tgz",
|
"resolved": "https://registry.npmjs.org/@react-navigation/core/-/core-7.13.6.tgz",
|
||||||
"integrity": "sha512-Fc/SO23HnlGnkou/z8JQUzwEMvhxuUhr4rdPTIZp/c8q1atq3k632Nfh8fEiGtk+MP1wtIvXdN2a5hBIWpLq3g==",
|
"integrity": "sha512-7QG29HAWOR8wYuPkfTN8L2Po+kE1xn3nsi2sS35sGngq8HYZRHfXvxrhrAZYfFnFq2hUtOhcXnSS6vEWU/5rmA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/routers": "^7.5.1",
|
"@react-navigation/routers": "^7.5.2",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
@@ -3843,9 +3846,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-navigation/elements": {
|
"node_modules/@react-navigation/elements": {
|
||||||
"version": "2.8.1",
|
"version": "2.9.2",
|
||||||
"resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-2.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-navigation/elements/-/elements-2.9.2.tgz",
|
||||||
"integrity": "sha512-MLmuS5kPAeAFFOylw89WGjgEFBqGj/KBK6ZrFrAOqLnTqEzk52/SO1olb5GB00k6ZUCDZKJOp1BrLXslxE6TgQ==",
|
"integrity": "sha512-J1GltOAGowNLznEphV/kr4zs0U7mUBO1wVA2CqpkN8ePBsoxrAmsd+T5sEYUCXN9KgTDFvc6IfcDqrGSQngd/g==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
@@ -3854,7 +3857,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@react-native-masked-view/masked-view": ">= 0.2.0",
|
"@react-native-masked-view/masked-view": ">= 0.2.0",
|
||||||
"@react-navigation/native": "^7.1.19",
|
"@react-navigation/native": "^7.1.25",
|
||||||
"react": ">= 18.2.0",
|
"react": ">= 18.2.0",
|
||||||
"react-native": "*",
|
"react-native": "*",
|
||||||
"react-native-safe-area-context": ">= 4.0.0"
|
"react-native-safe-area-context": ">= 4.0.0"
|
||||||
@@ -3866,13 +3869,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-navigation/native": {
|
"node_modules/@react-navigation/native": {
|
||||||
"version": "7.1.19",
|
"version": "7.1.25",
|
||||||
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-7.1.19.tgz",
|
"resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-7.1.25.tgz",
|
||||||
"integrity": "sha512-fM7q8di4Q8sp2WUhiUWOe7bEDRyRhbzsKQOd5N2k+lHeCx3UncsRYuw4Q/KN0EovM3wWKqMMmhy/YWuEO04kgw==",
|
"integrity": "sha512-zQeWK9txDePWbYfqTs0C6jeRdJTm/7VhQtW/1IbJNDi9/rFIRzZule8bdQPAnf8QWUsNujRmi1J9OG/hhfbalg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peer": true,
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-navigation/core": "^7.13.0",
|
"@react-navigation/core": "^7.13.6",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
@@ -3901,9 +3904,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@react-navigation/routers": {
|
"node_modules/@react-navigation/routers": {
|
||||||
"version": "7.5.1",
|
"version": "7.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-7.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/@react-navigation/routers/-/routers-7.5.2.tgz",
|
||||||
"integrity": "sha512-pxipMW/iEBSUrjxz2cDD7fNwkqR4xoi0E/PcfTQGCcdJwLoaxzab5kSadBLj1MTJyT0YRrOXL9umHpXtp+Dv4w==",
|
"integrity": "sha512-kymreY5aeTz843E+iPAukrsOtc7nabAH6novtAPREmmGu77dQpfxPB2ZWpKb5nRErIRowp1kYRoN2Ckl+S6JYw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11"
|
"nanoid": "^3.3.11"
|
||||||
@@ -5286,9 +5289,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/baseline-browser-mapping": {
|
"node_modules/baseline-browser-mapping": {
|
||||||
"version": "2.8.15",
|
"version": "2.9.6",
|
||||||
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.8.15.tgz",
|
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.6.tgz",
|
||||||
"integrity": "sha512-qsJ8/X+UypqxHXN75M7dF88jNK37dLBRW7LeUzCPz+TNs37G8cfWy9nWzS+LS//g600zrt2le9KuXt0rWfDz5Q==",
|
"integrity": "sha512-v9BVVpOTLB59C9E7aSnmIF8h7qRsFpx+A2nugVMTszEOMcfjlZMsXRm4LF23I3Z9AJxc8ANpIvzbzONoX9VJlg==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"baseline-browser-mapping": "dist/cli.js"
|
"baseline-browser-mapping": "dist/cli.js"
|
||||||
@@ -7909,6 +7912,7 @@
|
|||||||
"version": "12.6.0",
|
"version": "12.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/firebase/-/firebase-12.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/firebase/-/firebase-12.6.0.tgz",
|
||||||
"integrity": "sha512-8ZD1Gcv916Qp8/nsFH2+QMIrfX/76ti6cJwxQUENLXXnKlOX/IJZaU2Y3bdYf5r1mbownrQKfnWtrt+MVgdwLA==",
|
"integrity": "sha512-8ZD1Gcv916Qp8/nsFH2+QMIrfX/76ti6cJwxQUENLXXnKlOX/IJZaU2Y3bdYf5r1mbownrQKfnWtrt+MVgdwLA==",
|
||||||
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@firebase/ai": "2.6.0",
|
"@firebase/ai": "2.6.0",
|
||||||
"@firebase/analytics": "0.10.19",
|
"@firebase/analytics": "0.10.19",
|
||||||
@@ -11397,9 +11401,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-is": {
|
"node_modules/react-is": {
|
||||||
"version": "19.2.0",
|
"version": "19.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.1.tgz",
|
||||||
"integrity": "sha512-x3Ax3kNSMIIkyVYhWPyO09bu0uttcAIoecO/um/rKGQ4EltYWVYtyiGkS/3xMynrbVQdS69Jhlv8FXUEZehlzA==",
|
"integrity": "sha512-L7BnWgRbMwzMAubQcS7sXdPdNLmKlucPlopgAzx7FtYbksWZgEWiuYM5x9T6UqS2Ne0rsgQTq5kY2SGqpzUkYA==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/react-native": {
|
"node_modules/react-native": {
|
||||||
@@ -11487,15 +11491,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/react-native-maps": {
|
"node_modules/react-native-maps": {
|
||||||
"version": "1.20.1",
|
"version": "1.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-1.20.1.tgz",
|
"resolved": "https://registry.npmjs.org/react-native-maps/-/react-native-maps-1.9.0.tgz",
|
||||||
"integrity": "sha512-NZI3B5Z6kxAb8gzb2Wxzu/+P2SlFIg1waHGIpQmazDSCRkNoHNY4g96g+xS0QPSaG/9xRBbDNnd2f2/OW6t6LQ==",
|
"integrity": "sha512-ZTMjwEP//M4e+3DA9vzL1tcEZpfHGw5FnejuEpauO8HK5542Der2Ux9mZEXZa5I5q3+B0wJKUzvUPRZxeImUHg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/geojson": "^7946.0.13"
|
"@types/geojson": "^7946.0.10"
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=18"
|
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": ">= 17.0.1",
|
"react": ">= 17.0.1",
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^15.0.2",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-navigation/bottom-tabs": "^7.8.2",
|
"@react-navigation/bottom-tabs": "^7.8.12",
|
||||||
"@react-navigation/elements": "^2.6.3",
|
"@react-navigation/elements": "^2.6.3",
|
||||||
"@react-navigation/native": "^7.1.19",
|
"@react-navigation/native": "^7.1.25",
|
||||||
"expo": "~54.0.13",
|
"expo": "~54.0.13",
|
||||||
"expo-constants": "~18.0.9",
|
"expo-constants": "~18.0.9",
|
||||||
"expo-font": "~14.0.9",
|
"expo-font": "~14.0.9",
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
"react-dom": "19.1.0",
|
"react-dom": "19.1.0",
|
||||||
"react-native": "0.81.4",
|
"react-native": "0.81.4",
|
||||||
"react-native-gesture-handler": "~2.28.0",
|
"react-native-gesture-handler": "~2.28.0",
|
||||||
"react-native-maps": "1.20.1",
|
"react-native-maps": "1.9.0",
|
||||||
"react-native-reanimated": "~4.1.1",
|
"react-native-reanimated": "~4.1.1",
|
||||||
"react-native-safe-area-context": "~5.6.0",
|
"react-native-safe-area-context": "~5.6.0",
|
||||||
"react-native-screens": "~4.16.0",
|
"react-native-screens": "~4.16.0",
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/react": "~19.1.0",
|
"@types/react": "~19.1.0",
|
||||||
|
"baseline-browser-mapping": "^2.9.6",
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~10.0.0",
|
"eslint-config-expo": "~10.0.0",
|
||||||
"typescript": "~5.9.2"
|
"typescript": "~5.9.2"
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { addDoc, collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "
|
|||||||
import { Chantier, Reservation, Ressources, User } from "../class/class";
|
import { Chantier, Reservation, Ressources, User } from "../class/class";
|
||||||
import { db } from "../firebase_config";
|
import { db } from "../firebase_config";
|
||||||
|
|
||||||
|
///////////////////////////////////USER/////////////////////////////////////
|
||||||
export async function getUsers(): Promise<User[]> {
|
export async function getUsers(): Promise<User[]> {
|
||||||
try {
|
try {
|
||||||
const colRef = collection(db, "user");
|
const colRef = collection(db, "user");
|
||||||
@@ -18,7 +19,7 @@ export async function getUsers(): Promise<User[]> {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
///////////////////////////////////RESSOURCE////////////////////////////////
|
||||||
export async function getRessources(): Promise<Ressources[]> {
|
export async function getRessources(): Promise<Ressources[]> {
|
||||||
try {
|
try {
|
||||||
const colRef = collection(db, "ressources");
|
const colRef = collection(db, "ressources");
|
||||||
@@ -35,7 +36,7 @@ export async function getRessources(): Promise<Ressources[]> {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
///////////////////////////////////CHANTIER/////////////////////////////////
|
||||||
export async function getChantiers(): Promise<Chantier[]> {
|
export async function getChantiers(): Promise<Chantier[]> {
|
||||||
const snap = await getDocs(collection(db, "chantier"));
|
const snap = await getDocs(collection(db, "chantier"));
|
||||||
const chantiers: Chantier[] = [];
|
const chantiers: Chantier[] = [];
|
||||||
@@ -72,16 +73,7 @@ export async function getChantiers(): Promise<Chantier[]> {
|
|||||||
return chantiers;
|
return chantiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertReservation(res: any): Reservation {
|
//CHANGE CHANTIER STATUS
|
||||||
return {
|
|
||||||
id: res.id,
|
|
||||||
dateChantier:
|
|
||||||
res.dateChantier instanceof Timestamp ? res.dateChantier.toDate() : new Date(res.dateChantier),
|
|
||||||
dateFin:
|
|
||||||
res.dateFin instanceof Timestamp ? res.dateFin.toDate() : new Date(res.dateFin),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function changeChantierStatus(chantierId: string, newStatus: string): Promise<void> {
|
export async function changeChantierStatus(chantierId: string, newStatus: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const chantierRef = doc(db, "chantier", chantierId);
|
const chantierRef = doc(db, "chantier", chantierId);
|
||||||
@@ -92,6 +84,7 @@ export async function changeChantierStatus(chantierId: string, newStatus: string
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ADD CHANTIER
|
||||||
export async function addChantier(chantierData: Omit<Chantier, 'id'>): Promise<string | null> {
|
export async function addChantier(chantierData: Omit<Chantier, 'id'>): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
const colRef = collection(db, "chantier");
|
const colRef = collection(db, "chantier");
|
||||||
@@ -102,4 +95,57 @@ export async function addChantier(chantierData: Omit<Chantier, 'id'>): Promise<s
|
|||||||
console.error("Error adding:", err);
|
console.error("Error adding:", err);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CHANGE CHANTIER ANOMALIE STATUS
|
||||||
|
export async function changeAnomalieStatus(chantierId: string, anomalie_String: string, newStatus: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const chantierRef = doc(db, "chantier", chantierId);
|
||||||
|
const chantierSnap = await getDoc(chantierRef);
|
||||||
|
if (chantierSnap.exists()) {
|
||||||
|
const chantierData = chantierSnap.data();
|
||||||
|
const anomalies = chantierData.anomalies || [];
|
||||||
|
const updatedAnomalies = anomalies.map((anomalie: any) => {
|
||||||
|
if (anomalie.description === anomalie_String) {
|
||||||
|
return { ...anomalie, status: newStatus };
|
||||||
|
}
|
||||||
|
return anomalie;
|
||||||
|
});
|
||||||
|
await updateDoc(chantierRef, { anomalies: updatedAnomalies });
|
||||||
|
console.log(`Anomalie status updated to ${newStatus}`);
|
||||||
|
} else {
|
||||||
|
console.error("Chantier not found");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//CHANGE CHANTIER ANOMALIE STATUS
|
||||||
|
export async function deleteAnomalie(chantierId: string, anomalie_String: string): Promise<void> {
|
||||||
|
try {
|
||||||
|
const chantierRef = doc(db, "chantier", chantierId);
|
||||||
|
const chantierSnap = await getDoc(chantierRef);
|
||||||
|
if (chantierSnap.exists()) {
|
||||||
|
const chantierData = chantierSnap.data();
|
||||||
|
const anomalies = chantierData.anomalies || [];
|
||||||
|
const updatedAnomalies = anomalies.filter((anomalie: any) => anomalie.description !== anomalie_String);
|
||||||
|
await updateDoc(chantierRef, { anomalies: updatedAnomalies });
|
||||||
|
console.log(`Anomalie deleted`);
|
||||||
|
} else {
|
||||||
|
console.error("Chantier not found");
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertReservation(res: any): Reservation {
|
||||||
|
return {
|
||||||
|
id: res.id,
|
||||||
|
dateChantier:
|
||||||
|
res.dateChantier instanceof Timestamp ? res.dateChantier.toDate() : new Date(res.dateChantier),
|
||||||
|
dateFin:
|
||||||
|
res.dateFin instanceof Timestamp ? res.dateFin.toDate() : new Date(res.dateFin),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user