@extends('layouts.template.main') @section('content')
Tất cả thông báo {{ $allNotifs->whereNull('read_at')->count() }}
@if ($allNotifs->whereNull('read_at')->count() > 0) Đánh dấu đã đọc @endif
@forelse ($allNotifs as $notification) @php $notifData = is_string($notification->data) ? json_decode($notification->data, true) : (array) $notification->data; $notifUrl = $notifData['url'] ?? ($notifData['link'] ?? '#'); $notifMsg = $notifData['message'] ?? ''; $taskTitle = $notifData['task_title'] ?? null; $actorName = $notifData['actor_name'] ?? null; $notifType = $notification->type ?? ''; $isUnread = is_null($notification->read_at); // Thiết lập icon, màu nền và tiêu đề theo loại thông báo $icon = 'bell'; $bgClass = 'bg-secondary text-white'; $typeBadge = 'bg-secondary-soft text-secondary'; $typeName = 'Thông báo'; switch ($notifType) { case 'kanban_assignee_added': $icon = 'user-plus'; $bgClass = 'bg-primary text-white'; $typeBadge = 'bg-primary-soft text-primary'; $typeName = 'Giao việc'; break; case 'kanban_assignee_removed': $icon = 'user-x'; $bgClass = 'bg-warning text-white'; $typeBadge = 'bg-warning-soft text-warning'; $typeName = 'Gỡ người phụ trách'; break; case 'kanban_task_deleted': $icon = 'trash-2'; $bgClass = 'bg-danger text-white'; $typeBadge = 'bg-danger-soft text-danger'; $typeName = 'Xóa task'; break; case 'kanban_task_status_changed': $icon = 'check-circle'; $bgClass = 'bg-success text-white'; $typeBadge = 'bg-success-soft text-success'; $typeName = 'Trạng thái'; break; case 'kanban_task_moved': $icon = 'move'; $bgClass = 'bg-info text-white'; $typeBadge = 'bg-info-soft text-info'; $typeName = 'Di chuyển'; break; } @endphp
{{ $typeName }} @if ($taskTitle) {{ $taskTitle }} @endif {{ $notification->created_at->diffForHumans() }} ({{ $notification->created_at->format('H:i, d/m/Y') }})
{{ $notifMsg }}
@if ($isUnread) Mới @endif
@empty
Không có thông báo nào

Khi có hoạt động hoặc công việc mới được phân công, thông báo sẽ hiển thị tại đây.

@endforelse
@endsection