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

{{ $homework->title ?: 'Untitled Broadcast' }}

{{ $homework->status }}

{{ \Carbon\Carbon::parse($homework->created_at)->format('d M, Y h:i A') }} • {{ $homework->staff_name }} ({{ $homework->designation }})

@if($homework->status == 'pending')
@csrf @method('PATCH')
@csrf @method('PATCH')
@endif
{{-- Main Content --}}

{{ $homework->subject_name ?? 'General Subject' }}

{{ $homework->message }}
@if($homework->attachment) Download Attachment @endif
{{-- Targeted Audience --}}

Targeted Audience

@forelse($targets as $t) @if($t->student_name) {{ $t->student_name }} @else {{ $t->class_name }} {{ $t->section_name ? '- '.$t->section_name : '' }} @endif @empty

No specific targets

@endforelse
{{-- ✅ PROFESSIONAL DESKTOP CHAT VIEW --}}
{{-- Chat Header --}}

Conversation Thread {{ $replies->count() }} Messages

{{-- Chat Messages Container --}}
@forelse($replies as $reply) @php $isAdmin = !empty($reply->staff_id); $isStudent = !empty($reply->student_id); @endphp
{{-- Avatar --}}
@if($isAdmin) @else {{ substr($reply->student_name ?? 'S', 0, 1) }} @endif
{{-- Message Bubble --}}
{{-- Sender Name --}}

{{ $isAdmin ? 'School Admin' : $reply->student_name }}

{{-- Message --}}

{{ $reply->message }}

{{-- Attachment --}} @if($reply->attachment) View Attachment @endif
{{-- Timestamp --}}

{{ \Carbon\Carbon::parse($reply->created_at)->format('d M, h:i A') }}

@empty

No messages yet. Start the conversation below.

@endforelse
{{-- Reply Form --}}
@csrf
@endsection