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

Homework & Announcements

Create, review and approve homework broadcasts for your school.

New Homework
@if(session('success'))
{{ session('success') }}
@endif {{-- Status Tabs + Unread Toggle --}}
{{-- Status Tabs --}} @php $currentStatus = request('status', 'pending'); $tabs = [ ['label' => 'Pending', 'value' => 'pending'], ['label' => 'Published', 'value' => 'published'], ['label' => 'Rejected', 'value' => 'rejected'], ['label' => 'All', 'value' => 'all'], ]; @endphp @foreach($tabs as $tab) @php $isActive = $currentStatus === $tab['value']; @endphp {{ $tab['label'] }} @endforeach {{-- ✅ UNREAD FILTER TOGGLE (Separated with visual distinction) --}}
{{-- Advanced Filters --}}
@if(request('status'))@endif @if(request('unread'))@endif
Clear
{{-- Desktop Table --}}
@forelse($homeworks as $hw) @empty @endforelse
Status Homework Subject Sender Date Actions
{{ $hw->status }}

{{ $hw->title ?: 'Untitled Broadcast' }} @if(($hw->unread_replies ?? 0) > 0) NEW @endif

{{ $hw->message }} @if($hw->attachment) @endif

{{ $hw->subject_name ?? 'General' }}

{{ $hw->staff_name }}

{{ $hw->designation }}

{{ \Carbon\Carbon::parse($hw->created_at)->format('d M, Y') }}
{{-- ✅ UNREAD COUNT BADGE --}} @if(($hw->unread_replies ?? 0) > 0) {{ $hw->unread_replies }} @endif @if($hw->status == 'pending')
@csrf @method('PATCH')
@csrf @method('PATCH')
@endif
@csrf @method('DELETE')

No broadcasts found.

{{ $homeworks->links() }}
{{-- Cascading Filter Script --}} @endsection