Filter calendar ads to show only those with store participation

Modify the calendar grid component to ensure that only advertisements with active store participations are displayed, particularly when no specific store is selected or as a default filtering condition.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/ByygiiM
This commit is contained in:
michaelschal committed 2025-08-11 22:03:17 +00:00
1 parent fb76893fe2
commit ffd99d49b8
1 file changed
+12 -3
+12 -3
View File
@@ -198,9 +198,13 @@ export default function CalendarGrid({
return false;
}
// If no store is selected and user has no assigned groups, show all publicities
// If no store is selected and user has no assigned groups, show only publicities with participations
if (!selectedStoreId && (!userGroups || userGroups.length === 0)) {
return true;
const hasParticipations = pub.participations && pub.participations.length > 0;
if (hasParticipations) {
console.log('📋 Publicity has participations (no store selected):', { pubNumber: pub.pubNumber, participationCount: pub.participations.length });
}
return hasParticipations;
}
// If a specific store is selected, check if that store participates
@@ -223,7 +227,12 @@ export default function CalendarGrid({
return matches;
}
return true;
// Default case: only show publicities with participations
const hasParticipations = pub.participations && pub.participations.length > 0;
if (hasParticipations) {
console.log('📋 Publicity has participations (default case):', { pubNumber: pub.pubNumber, participationCount: pub.participations.length });
}
return hasParticipations;
});
};