diff --git a/app/(tabs)/gestionnaire_ressource.tsx b/app/(tabs)/gestionnaire_ressource.tsx index ae8c79d..c63d6a5 100644 --- a/app/(tabs)/gestionnaire_ressource.tsx +++ b/app/(tabs)/gestionnaire_ressource.tsx @@ -83,7 +83,7 @@ export default function GestionnaireRessource() { } ListEmptyComponent={ - Aucun résultat trouvé 😕 + Aucun résultat trouvé } /> diff --git a/services/ressourcesService.ts b/services/ressourcesService.ts index fabdd20..4006db4 100644 --- a/services/ressourcesService.ts +++ b/services/ressourcesService.ts @@ -20,7 +20,6 @@ export async function getUsers(): Promise { } } - export async function getRessources(): Promise { try { const colRef = collection(db, "ressources"); @@ -38,7 +37,6 @@ export async function getRessources(): Promise { } } - export async function getChantiers(): Promise { try { const colRef = collection(db, "chantier"); @@ -47,26 +45,12 @@ export async function getChantiers(): Promise { 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), }; }