{{-- HEADER SECTION --}}

{{ __('Create and manage school announcements') }}

{{-- FLASH MESSAGES --}} @if(session('success'))
{{ session('success') }}
@endif {{-- ANNOUNCEMENTS LIST --}}
@forelse($announcements as $announcement)

{{ $announcement->title }}

{{ __('Target') }}: @foreach($announcement->targets as $target) {{ $target->role }} @endforeach @if($announcement->published_at) {{ $announcement->published_at->format('M d, Y h:i A') }} @endif
@if($announcement->is_sticky) {{ __('Sticky') }} @endif @if($announcement->published_at) {{ __('Published') }} @else {{ __('Draft') }} @endif

{{ $announcement->content }}

{{-- EDIT BUTTON --}} {{-- DELETE BUTTON --}}
@csrf @method('DELETE')
{{-- PUBLISH BUTTON --}} @if(!$announcement->published_at)
@csrf @method('PATCH')
@endif
@empty
📢

{{ __('No announcements yet') }}

{{ __('Create announcements to broadcast important messages to your school community.') }}

@endforelse
{{-- ========================================== --}} {{-- CREATE MODAL --}} {{-- ========================================== --}}
@csrf {{-- SERVER VALIDATION ERRORS DISPLAY --}} @if ($errors->any())
{{ __('Please check the errors below:') }}
    @foreach ($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif

{{-- ========================================== --}} {{-- EDIT MODAL --}} {{-- ========================================== --}}
@csrf @method('PUT')

{{-- ALPINE JS CONTROLLER --}}