test chantier.chef
This commit is contained in:
@@ -83,7 +83,7 @@ export default function GestionnaireRessource() {
|
||||
</ThemedView>
|
||||
}
|
||||
ListEmptyComponent={
|
||||
<ThemedText style={styles.empty}>Aucun résultat trouvé 😕</ThemedText>
|
||||
<ThemedText style={styles.empty}>Aucun résultat trouvé</ThemedText>
|
||||
}
|
||||
/>
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ export async function getUsers(): Promise<User[]> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getRessources(): Promise<Ressources[]> {
|
||||
try {
|
||||
const colRef = collection(db, "ressources");
|
||||
@@ -38,7 +37,6 @@ export async function getRessources(): Promise<Ressources[]> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getChantiers(): Promise<Chantier[]> {
|
||||
try {
|
||||
const colRef = collection(db, "chantier");
|
||||
@@ -47,26 +45,12 @@ export async function getChantiers(): Promise<Chantier[]> {
|
||||
const data = doc.data() as any;
|
||||
return {
|
||||
...data,
|
||||
chef: {
|
||||
...data.chef,
|
||||
allocation: data.chef?.allocation?.map(convertReservation) || [],
|
||||
},
|
||||
equipe:
|
||||
data.equipe?.map((u: any) => ({
|
||||
...u,
|
||||
allocation: u.allocation?.map(convertReservation) || [],
|
||||
})) || [],
|
||||
materiel:
|
||||
data.materiel?.map((m: any) => ({
|
||||
...m,
|
||||
allocation: m.allocation?.map(convertReservation) || [],
|
||||
})) || [],
|
||||
vehicules:
|
||||
data.vehicules?.map((v: any) => ({
|
||||
...v,
|
||||
allocation: v.allocation?.map(convertReservation) || [],
|
||||
})) || [],
|
||||
anomalies: data.anomalies || [],
|
||||
dateDep: data.dateDep.toDate(),
|
||||
chef: { ...data.chef },
|
||||
equipe: data.equipe ?? [],
|
||||
materiel: data.materiel ?? [],
|
||||
vehicules: data.vehicules ?? [],
|
||||
anomalies: data.anomalies ?? []
|
||||
} as Chantier;
|
||||
});
|
||||
} catch (err) {
|
||||
@@ -79,12 +63,8 @@ function convertReservation(res: any): Reservation {
|
||||
return {
|
||||
id: res.id,
|
||||
dateChantier:
|
||||
res.dateChantier instanceof Timestamp
|
||||
? res.dateChantier.toDate()
|
||||
: new Date(res.dateChantier),
|
||||
res.dateChantier instanceof Timestamp ? res.dateChantier.toDate() : new Date(res.dateChantier),
|
||||
dateFin:
|
||||
res.dateFin instanceof Timestamp
|
||||
? res.dateFin.toDate()
|
||||
: new Date(res.dateFin),
|
||||
res.dateFin instanceof Timestamp ? res.dateFin.toDate() : new Date(res.dateFin),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user