@extends('layouts.app') @section('title', 'Notices & Announcements') @section('breadcrumbs') @endsection @section('content')
{{-- Page Header --}}

Notices & Announcements

Stay informed with company news and updates

@if(in_array(auth()->user()->role, ['company_admin', 'company_user'])) Post Notice @endif
{{-- Type Tabs --}}
All ({{ $typeCounts['all'] }}) General ({{ $typeCounts['general'] }}) Policy ({{ $typeCounts['policy'] }}) Events ({{ $typeCounts['event'] }}) Urgent ({{ $typeCounts['urgent'] }}) {{-- Separator --}} {{-- Show Expired Toggle --}} @if($expiredCount > 0) Expired ({{ $expiredCount }}) @endif
{{-- Notices List --}} @if($notices->isEmpty())

{{ $showExpired ? 'No expired notices' : 'No notices yet' }}

{{ $showExpired ? 'There are no expired notices to display.' : 'Be the first to share something with the team.' }}

@if(!$showExpired && in_array(auth()->user()->role, ['company_admin', 'company_user'])) Post First Notice @endif
@else
@foreach($notices as $notice)
{{-- Left: Content --}}
@if($notice->is_pinned) Pinned @endif {{ $notice->type_label }} @if($notice->is_expired) Expired @endif

{{ $notice->title }}

{{ $notice->content_preview }}

{{-- Posted by --}} @php $initial = strtoupper(substr($notice->postedBy->name ?? 'U', 0, 1)); $gradients = [ 'A' => 'from-primary-600 to-accent-500', 'B' => 'from-primary-600 to-accent-500', 'C' => 'from-primary-600 to-accent-500', 'D' => 'from-primary-600 to-accent-500', 'E' => 'from-success-500 to-success-600', 'F' => 'from-success-500 to-success-600', 'G' => 'from-success-500 to-success-600', 'H' => 'from-success-500 to-success-600', 'I' => 'from-violet-500 to-pink-500', 'J' => 'from-violet-500 to-pink-500', 'K' => 'from-violet-500 to-pink-500', 'L' => 'from-violet-500 to-pink-500', 'M' => 'from-warning-500 to-danger-500', 'N' => 'from-warning-500 to-danger-500', 'O' => 'from-warning-500 to-danger-500', 'P' => 'from-warning-500 to-danger-500', 'Q' => 'from-accent-500 to-indigo-500', 'R' => 'from-accent-500 to-indigo-500', 'S' => 'from-accent-500 to-indigo-500', 'T' => 'from-accent-500 to-indigo-500', 'U' => 'from-pink-500 to-violet-500', 'V' => 'from-pink-500 to-violet-500', 'W' => 'from-pink-500 to-violet-500', 'X' => 'from-pink-500 to-violet-500', 'Y' => 'from-pink-500 to-violet-500', 'Z' => 'from-pink-500 to-violet-500', ]; $gradient = $gradients[$initial] ?? 'from-primary-600 to-accent-500'; @endphp {{ $initial }} {{ $notice->postedBy->name ?? 'Unknown' }} · {{-- Published date --}} {{ $notice->published_at->format('d M Y, h:i A') }} @if($notice->expires_at) · {{ $notice->is_expired ? 'Expired' : 'Expires' }} {{ $notice->expires_at->format('d M Y') }} @endif
{{-- Right: Actions --}} @if(auth()->user()->role === 'company_admin' || (auth()->user()->role === 'company_user' && $notice->posted_by === auth()->id()))
@if(auth()->user()->role === 'company_admin')
@csrf
@endif
@endif
@endforeach
{{-- Pagination --}}
{{ $notices->appends(request()->query())->links() }}
@endif {{-- Delete Confirmation Modal --}}
@endsection