@extends('staff.layouts.app') @section('content')
{{-- ══ Header ═ --}}

Homework

Broadcasts & Assignments

{{-- ✅ UNREAD BELL TOGGLE --}} Unread @if($showOnlyUnread)ON@endif
{{-- Flash Messages --}} @if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif {{-- ══ Status Tabs + UNREAD Toggle ══ --}} @php $showOnlyUnread = request()->boolean('unread'); @endphp
@php $currentStatus = request('status'); $tabs = [ ['label' => 'All', 'value' => null], ['label' => 'Pending', 'value' => 'pending'], ['label' => 'Published', 'value' => 'published'], ['label' => 'Rejected', 'value' => 'rejected'], ]; @endphp @foreach($tabs as $tab) @php $isActive = $currentStatus === $tab['value']; @endphp {{ $tab['label'] }} @endforeach
{{-- ══ REVIEWER FILTER BAR (Cascading Class → Section) ══ --}} @if($isReviewer)

Advanced Filters

@if(request('status'))@endif @if(request('unread'))@endif {{-- ROW 1 : CLASS → SECTION + SUBJECT (cascading, inactive until class) --}}
Clear
@endif {{-- ══ Row-wise List ══ --}}
@forelse($homeworks as $hw) @php $isUnread = ($hw->unread_replies ?? 0) > 0 || ($isReviewer && ($hw->is_new ?? 0)); @endphp {{-- ✅ Red Count / NEW Badge --}} @if($isUnread) @if(($hw->unread_replies ?? 0) > 0){{ $hw->unread_replies > 9 ? '9+' : $hw->unread_replies }}@else NEW @endif @endif

{{ $hw->title ?: 'Untitled Broadcast' }} @if($isUnread) New @endif

{{ \Carbon\Carbon::parse($hw->created_at)->format('d M, Y') }}

{{ $hw->message }}

{{ substr($hw->staff_name, 0, 1) }}
{{ $hw->staff_name }} @if($hw->subject_name) • {{ $hw->subject_name }} @endif @if($hw->attachment) @endif
@empty

No broadcasts found

Create a new assignment to get started.

@endforelse
{{ $homeworks->links() }}
{{-- ✅ Cascading Section Filter (only sections of selected class) --}} @if($isReviewer) @endif @endsection