From ced2d15e05f8367d304e07d719af1499c4b4845a Mon Sep 17 00:00:00 2001 From: tuanvu Date: Thu, 11 Dec 2025 11:07:15 +0100 Subject: [PATCH] test changeChantierStatus --- app/(tabs)/_layout.tsx | 13 ++++++++++++- services/ressourcesService.ts | 12 +++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/(tabs)/_layout.tsx b/app/(tabs)/_layout.tsx index 9ffb2a0..3c818bf 100644 --- a/app/(tabs)/_layout.tsx +++ b/app/(tabs)/_layout.tsx @@ -12,6 +12,8 @@ import ListMateriel from './gestionnaire_ressource'; import Home from './home'; import MapScreen from './mapScreen'; +import AntDesign from '@expo/vector-icons/AntDesign'; + const Tabs = createBottomTabNavigator(); export default function TabLayout() { @@ -61,8 +63,17 @@ export default function TabLayout() { tabBarIcon: ({ color }) => , }} > - + ( + + ), + }} + /> ); diff --git a/services/ressourcesService.ts b/services/ressourcesService.ts index fdf4c7a..8b8dd3c 100644 --- a/services/ressourcesService.ts +++ b/services/ressourcesService.ts @@ -1,4 +1,4 @@ -import { collection, getDoc, getDocs, Timestamp } from "firebase/firestore"; +import { collection, doc, getDoc, getDocs, Timestamp, updateDoc } from "firebase/firestore"; import { Chantier, Reservation, Ressources, User } from "../class/class"; import { db } from "../firebase_config"; @@ -80,3 +80,13 @@ function convertReservation(res: any): Reservation { res.dateFin instanceof Timestamp ? res.dateFin.toDate() : new Date(res.dateFin), }; } + +export async function changeChantierStatus(chantierId: string, newStatus: string): Promise { + try { + const chantierRef = doc(db, "chantier", chantierId); + await updateDoc(chantierRef, { status: newStatus }); + console.log(`Chantier ${chantierId} status updated to ${newStatus}`); + } catch (err) { + console.error("Error", err); + } +} \ No newline at end of file