test changeChantierStatus
This commit is contained in:
@@ -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 }) => <IconSymbol size={28} name="paperplane.fill" color={color} />,
|
||||
}}
|
||||
>
|
||||
|
||||
</Tabs.Screen>
|
||||
<Tabs.Screen
|
||||
name="ajouterChantier"
|
||||
component={ListMateriel}
|
||||
options={{
|
||||
title: 'Ajouter',
|
||||
tabBarIcon: ({ color }) => (
|
||||
<AntDesign name="plus" size={24} color="black" />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
||||
</Tabs.Navigator>
|
||||
);
|
||||
|
||||
@@ -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<void> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user