@extends('layouts.app')
@section('page_title','Announcements')
@section('page_subtitle','Publish HR notices to users and staff.')
@section('content')
<div class="card"><h3>Create Announcement</h3><form method="POST" action="{{ route('admin.announcements.store') }}">@csrf<div class="form-row"><div class="field"><label>Title</label><input class="input" name="title" required></div><div class="field"><label>Audience</label><select name="audience"><option value="all">All</option><option value="users">Users</option><option value="admins">Admins</option></select></div><div class="field"><label>Status</label><select name="status"><option>published</option><option>draft</option></select></div><div class="field"><label>Publish At</label><input class="input" type="datetime-local" name="published_at"></div></div><div class="field"><label>Body</label><textarea name="body" required></textarea></div><button class="btn">Publish</button></form></div>
<div class="card"><h3>Announcements</h3><table class="table"><tr><th>Title</th><th>Audience</th><th>Status</th><th>Published</th><th>Body</th></tr>@forelse($announcements as $announcement)<tr><td><strong>{{ $announcement->title }}</strong></td><td>{{ ucfirst($announcement->audience) }}</td><td>{{ ucfirst($announcement->status) }}</td><td>{{ $announcement->published_at?->format('d M Y h:i A') }}</td><td>{{ \Illuminate\Support\Str::limit($announcement->body,100) }}</td></tr>@empty<tr><td colspan="5"><div class="empty">No announcements.</div></td></tr>@endforelse</table><div class="pagination">{{ $announcements->links() }}</div></div>
@endsection
