mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-13 18:28:38 +02:00
Improve reconciliation display and fix statistics calculations
Update reconciliation logic to use cache invalidation and refetch for immediate UI updates, and correct statistical calculations by using `deliveredDate` for monthly delivery metrics. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/csL8uKw
This commit is contained in:
1 parent
cc37f4cceb
commit
7fcd550147
4 files changed
+33
-19
No files matched your search
@@ -187,8 +187,8 @@ export default function BLReconciliation() {
|
||||
});
|
||||
};
|
||||
|
||||
// Récupérer les livraisons validées avec BL
|
||||
const { data: deliveriesWithBL = [], isLoading } = useQuery({
|
||||
// Récupérer les livraisons validées avec BL - CACHE INVALIDÉ après modifications
|
||||
const { data: deliveriesWithBL = [], isLoading, refetch } = useQuery({
|
||||
queryKey: ['/api/deliveries/bl', selectedStoreId],
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams({});
|
||||
@@ -214,7 +214,8 @@ export default function BLReconciliation() {
|
||||
|
||||
return filtered.sort((a: any, b: any) => new Date(b.deliveredDate || b.updatedAt).getTime() - new Date(a.deliveredDate || a.updatedAt).getTime());
|
||||
},
|
||||
enabled: !!user
|
||||
enabled: !!user,
|
||||
staleTime: 0 // Éviter la mise en cache pour toujours avoir les dernières données BL
|
||||
});
|
||||
|
||||
// VÉRIFICATION AUTOMATIQUE AU CHARGEMENT avec système de cache
|
||||
@@ -267,7 +268,9 @@ export default function BLReconciliation() {
|
||||
description: "Données de rapprochement mises à jour",
|
||||
});
|
||||
|
||||
// Invalidation cache + refetch forcé pour mise à jour immédiate
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] });
|
||||
refetch();
|
||||
handleCloseModal();
|
||||
} catch (error) {
|
||||
toast({
|
||||
@@ -397,7 +400,10 @@ export default function BLReconciliation() {
|
||||
description: "Rapprochement validé avec succès",
|
||||
});
|
||||
|
||||
// Invalidation cache + refetch forcé pour mise à jour immédiate
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/deliveries'] });
|
||||
refetch(); // Force recharge immédiate des données BL
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: "Erreur",
|
||||
@@ -432,7 +438,9 @@ export default function BLReconciliation() {
|
||||
description: "Rapprochement dévalidé avec succès",
|
||||
});
|
||||
|
||||
// Invalidation cache + refetch forcé pour mise à jour immédiate
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/deliveries/bl'] });
|
||||
refetch();
|
||||
} catch (error) {
|
||||
toast({
|
||||
title: "Erreur",
|
||||
|
||||
Reference in new issue
Block a user