chore: build
This commit is contained in:
@@ -18,6 +18,7 @@ import { useAuth } from "../../auth/AuthContext";
|
||||
import {
|
||||
getAllCommands,
|
||||
getAllClients,
|
||||
getAllUsers,
|
||||
getAvailableDeliveryPersons,
|
||||
getCommandCountByStatus,
|
||||
getAdminTelegramStatus,
|
||||
@@ -46,15 +47,22 @@ export default function DashboardScreen() {
|
||||
|
||||
const loadStats = useCallback(async () => {
|
||||
try {
|
||||
const [allCmd, pending, enRoute, completed, clients, livreurs] =
|
||||
const [allCmd, pending, enRoute, completed, userCounts, livreurs] =
|
||||
await Promise.all([
|
||||
getAllCommands().then((r) => r.count),
|
||||
getCommandCountByStatus("pending"),
|
||||
getCommandCountByStatus("en_route"),
|
||||
getCommandCountByStatus("approved"),
|
||||
getAllClients(0, 1)
|
||||
.then((r) => r.total)
|
||||
.catch(() => 0),
|
||||
// Totaux globaux (toute la base) : on ne charge qu'1 user,
|
||||
// seuls les compteurs nous intéressent.
|
||||
getAllUsers(0, 1)
|
||||
.then(async (r) => ({
|
||||
all: r.counts?.all ?? r.total,
|
||||
client:
|
||||
r.counts?.client ??
|
||||
(await getAllClients(0, 1)).total,
|
||||
}))
|
||||
.catch(() => ({ all: 0, client: 0 })),
|
||||
getAvailableDeliveryPersons()
|
||||
.then((r) => r.count)
|
||||
.catch(() => 0),
|
||||
@@ -85,9 +93,15 @@ export default function DashboardScreen() {
|
||||
icon: "checkmark-circle-outline",
|
||||
color: colors.success,
|
||||
},
|
||||
{
|
||||
label: "Utilisateurs",
|
||||
value: userCounts.all,
|
||||
icon: "person-outline",
|
||||
color: colors.accent,
|
||||
},
|
||||
{
|
||||
label: "Clients",
|
||||
value: clients,
|
||||
value: userCounts.client,
|
||||
icon: "people-outline",
|
||||
color: colors.accentLight,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user