Fix display issues and adjust year range for publicities

Correctly display publicities by fixing an issue that prevented data from rendering, and expand the selectable year range to include years from 2020 onwards.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 0ec86cdf-a5be-4b0e-84a3-07b926f5cc80
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/0ec86cdf-a5be-4b0e-84a3-07b926f5cc80/bg09zFa
This commit is contained in:
michaelschal committed 2025-08-21 11:25:56 +00:00
1 parent 19c41f11c3
commit 6cf7631bdf
3 files changed
+5 -3

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

+4 -2
View File
@@ -34,9 +34,11 @@ export default function Publicities() {
// Seuls les admins peuvent modifier/supprimer
const canModify = user?.role === 'admin';
// Generate year options (current year ± 5 years)
// Generate year options (2020 to current year + 5 years)
const currentYear = new Date().getFullYear();
const yearOptions = Array.from({ length: 11 }, (_, i) => currentYear - 5 + i);
const startYear = 2020;
const endYear = currentYear + 5;
const yearOptions = Array.from({ length: endYear - startYear + 1 }, (_, i) => startYear + i);
const { data: publicities = [], isLoading } = useQuery({
queryKey: ['/api/publicities', selectedYear, selectedStoreId],
+1 -1
View File
@@ -2243,7 +2243,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
res.json(publicities);
} catch (error) {
console.error(`❌ ERROR fetching publicities for year ${year}:`, error);
console.error("❌ ERROR fetching publicities:", error);
res.status(500).json({ message: "Failed to fetch publicities", error: (error as Error).message });
}
});