mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Update dashboard to display yearly delivery statistics
Introduce a new API endpoint '/api/stats/yearly' for fetching annual statistics and update the StatsPanel component to use this endpoint, changing the card title to "Statistiques de l'année" and the average delivery time label to "Délai commande → livraison". Replit-Commit-Author: Agent Replit-Commit-Session-Id: cfbfe47c-0c9a-4ebf-8a41-2937407eccff Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/cfbfe47c-0c9a-4ebf-8a41-2937407eccff/9qfOTfC
This commit is contained in:
1 parent
d938db04ff
commit
6ba8919487
4 files changed
+209
-7
No files matched your search
@@ -14,8 +14,8 @@ export default function StatsPanel({ currentDate = new Date() }: StatsPanelProps
|
||||
const year = currentDate.getFullYear();
|
||||
const month = currentDate.getMonth() + 1;
|
||||
|
||||
// Construire l'URL avec les paramètres
|
||||
const statsUrl = `/api/stats/monthly?year=${year}&month=${month}${selectedStoreId ? `&storeId=${selectedStoreId}` : ''}`;
|
||||
// Construire l'URL pour les statistiques annuelles
|
||||
const statsUrl = `/api/stats/yearly?year=${year}${selectedStoreId ? `&storeId=${selectedStoreId}` : ''}`;
|
||||
|
||||
const { data: stats, isLoading } = useQuery({
|
||||
queryKey: [statsUrl, selectedStoreId], // Include selectedStoreId in key to force refetch
|
||||
@@ -25,7 +25,7 @@ export default function StatsPanel({ currentDate = new Date() }: StatsPanelProps
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to fetch stats');
|
||||
throw new Error('Failed to fetch yearly stats');
|
||||
}
|
||||
|
||||
return response.json();
|
||||
@@ -55,7 +55,7 @@ export default function StatsPanel({ currentDate = new Date() }: StatsPanelProps
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="text-lg flex items-center">
|
||||
<TrendingUp className="w-5 h-5 text-accent mr-2" />
|
||||
Statistiques du mois
|
||||
Statistiques de l'année
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
@@ -91,7 +91,7 @@ export default function StatsPanel({ currentDate = new Date() }: StatsPanelProps
|
||||
<div className="mt-3 pt-3 border-t border-gray-200 text-center">
|
||||
<div className="text-sm text-gray-600 flex items-center justify-center">
|
||||
<Clock className="w-4 h-4 mr-1" />
|
||||
Délai moyen:
|
||||
Délai commande → livraison:
|
||||
<span className="font-medium text-gray-900 ml-1">
|
||||
{stats?.averageDeliveryTime?.toFixed(1) || '0'} jours
|
||||
</span>
|
||||
|
||||
Reference in new issue
Block a user