import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'announcements_provider.dart'; import 'attendance_provider.dart'; import 'chat_provider.dart'; import 'it_service_request_provider.dart'; import 'leave_provider.dart'; import 'notifications_provider.dart'; import 'pass_slip_provider.dart'; import 'profile_provider.dart'; import 'tasks_provider.dart'; import 'tickets_provider.dart'; import 'user_offices_provider.dart'; /// Total count of items waiting to sync across all modules. /// Used by the offline banner and reconnect overlay for dynamic messaging. final pendingSyncCountProvider = Provider((ref) { // Tasks final tasks = ref.watch(offlinePendingTasksProvider).length; final taskUpdates = ref.watch(offlinePendingTaskUpdatesProvider).length; final messages = ref.watch(offlinePendingMessagesProvider) .values .fold(0, (sum, list) => sum + list.length); final assignments = ref.watch(offlinePendingAssignmentsProvider).length; final activityLogs = ref.watch(offlinePendingActivityLogItemsProvider).length; // Leave final leaves = ref.watch(offlinePendingLeavesProvider).length; final leaveUpdates = ref.watch(offlinePendingLeaveUpdatesProvider).length; // Pass slips final passSlips = ref.watch(offlinePendingPassSlipsProvider).length; final passSlipUpdates = ref.watch(offlinePendingPassSlipUpdatesProvider).length; // Announcements final announcements = ref.watch(offlinePendingAnnouncementsProvider).length; final announcementUpdates = ref.watch(offlinePendingAnnouncementUpdatesProvider).length; final announcementComments = ref.watch(offlinePendingAnnouncementCommentsProvider).length; // IT Service Requests final itRequests = ref.watch(offlinePendingItServiceRequestsProvider).length; final itRequestUpdates = ref.watch(offlinePendingItServiceRequestUpdatesProvider).length; final isrActions = ref.watch(offlinePendingIsrActionsProvider).length; // Attendance final checkIns = ref.watch(offlinePendingCheckInsProvider).length; final attendanceUpdates = ref.watch(offlinePendingAttendanceUpdatesProvider).length; // Notifications final notifReads = ref.watch(offlinePendingNotificationReadsProvider).length; final notifBatchReads = ref.watch(offlinePendingBatchNotificationReadsProvider).length; // Profile final profileUpdates = ref.watch(offlinePendingProfileUpdatesProvider).length; // Tickets final tickets = ref.watch(offlinePendingTicketsProvider).length; final ticketUpdates = ref.watch(offlinePendingTicketUpdatesProvider).length; // Offices final offices = ref.watch(offlinePendingOfficesProvider).length; // User offices final officeOps = ref.watch(offlinePendingUserOfficeOpsProvider).length; // Chat final chatMessages = ref.watch(offlinePendingChatMessagesProvider) .values .fold(0, (sum, list) => sum + list.length); return tasks + taskUpdates + messages + assignments + activityLogs + leaves + leaveUpdates + passSlips + passSlipUpdates + announcements + announcementUpdates + announcementComments + itRequests + itRequestUpdates + isrActions + checkIns + attendanceUpdates + notifReads + notifBatchReads + profileUpdates + tickets + ticketUpdates + offices + officeOps + chatMessages; });