@extends('layouts.app') @section('content')
@include('partials.header') @include('partials.sidebar')

Emergency Messages

{{-- Alert container for dynamic messages --}}
@if (session('success'))
{{ session('success') }}
@endif @if ($errors->any())
@foreach ($errors->all() as $error) {{ $error }}
@endforeach
@endif {{-- Statistics Cards (will be updated via AJAX) --}}
Active

{{ $statistics['active'] ?? 0 }}

Active Messages
Inactive

{{ $statistics['inactive'] ?? 0 }}

Inactive Messages
Expiring

{{ $statistics['expiring'] ?? 0 }}

Auto-Expire Messages
Total

{{ $statistics['total'] ?? 0 }}

All Messages
New Emergency Message @if (($statistics['expired'] ?? 0) > 0) @endif
@if (isset($messages) && $messages->count() > 0)
Showing {{ $messages->count() }} of {{ $messages->total() }} emergency messages
@foreach ($messages as $message) @php $isExpired = $message->hasExpired(); @endphp @endforeach
Subject Status Expiry Sent Date Activate Actions
{{ \Str::limit($message->subject, 40) }} @if ($message->is_active && !$isExpired) @endif @if ($isExpired && $message->is_active) @endif @if ($message->is_active) @if ($isExpired) Inactive (Expired) @else Active @endif @else Inactive @endif @if ($message->expires) 24h
{{ $message->expiry_status }} @else Never @endif
{{ $message->sent_date ? $message->sent_date->format('M d, Y H:i') : 'N/A' }}
{{ $message->sent_date ? $message->sent_date->diffForHumans() : '' }}
@if ($isExpired)
is_active ? 'checked' : '' }} disabled>
@else
is_active ? 'checked' : '' }} onchange="updateEmergencyMessageStatus({{ $message->id }}, this.checked)">
@endif
@else

No Emergency Messages Found

@if (request()->hasAny(['status', 'search', 'date_from', 'date_to', 'sender', 'subject', 'expiry_status']))

No emergency messages match your current filter criteria.

Clear Filters @else

You haven't created any emergency messages yet.

Create First Emergency Message @endif
@endif
{{-- MODALS --}} @endsection