{{-- New-Unity ERP | resources/views/layouts/partials/app-notifications.blade.php | v3.1 | 01/08/2026 --}} {{-- v3.1 — Restaura estructura original SmartAdmin: notification-header, nav-tabs-clean, tab-notification, custom-scroll. --}} {{-- v3.0 — Campana dividida en 3 tabs: Tareas (actividades pendientes), Alertas (notificaciones sistema), Mensajes (placeholder). --}} {{-- v2.0 — Sistema de notificaciones real: campana dinámica, mark-as-read por item y global. --}} {{-- v1.0 — Contenido estático de demostración (SmartAdmin template). --}} @php // ── Tareas del equipo (sin filtro por usuario — visibilidad global) ─── $tasksPending = auth()->check() ? \App\Modules\Sales\Models\Activity::whereIn('status', ['pending', 'in_progress', 'overdue'])->count() : 0; $pendingTasks = $tasksPending > 0 ? \App\Modules\Sales\Models\Activity::with(['customer', 'opportunity', 'assignedTo']) ->whereIn('status', ['pending', 'in_progress', 'overdue']) ->orderByRaw("CASE WHEN status='overdue' THEN 0 ELSE 1 END") ->orderBy('scheduled_at') ->limit(8) ->get() : collect(); // ── Alertas del sistema (notificaciones) ───────────────────────────── $recentNotifs = auth()->check() ? \App\Modules\Admin\Models\Notification::where('user_id', auth()->id()) ->orderBy('created_at', 'desc') ->limit(10) ->get() : collect(); $dropdownUnread = $recentNotifs->where('is_read', false)->count(); $_notifTypeColors = ['mrp' => 'warning', 'stock' => 'danger', 'sales' => 'success', 'billing' => 'primary', 'system' => 'secondary', 'crm' => 'purple']; $_notifTypeLabels = ['mrp' => 'MRP', 'stock' => 'Stock', 'sales' => 'Ventas', 'billing' => 'Factura', 'system' => 'Sistema', 'crm' => 'CRM']; @endphp {{-- /.dropdown-menu --}}