@extends('layouts.app') @section('title', __('messaging::messages.outbox.title')) @section('content')

{{ __('messaging::messages.outbox.title') }}

{{ __('messaging::messages.outbox.subtitle') }}

{{-- Said plainly, before anything else on the page. A clinic that believes its reminders are reaching patients when they are being written to a log file is worse off than one that knows it has none. --}} @if ($liveChannels === [])
{{ __('messaging::messages.outbox.not_live_title') }}

{{ __('messaging::messages.outbox.not_live_text') }}

@endif
@foreach (['sent' => 'green', 'queued' => 'grey', 'failed' => 'red', 'suppressed' => 'amber'] as $key => $tone)
{{ __('messaging::messages.outbox.tally.'.$key) }} {{ number_format($tally[$key]) }}
@endforeach
@if ($messages->isEmpty())

{{ __('messaging::messages.outbox.empty_title') }}

{{ __('messaging::messages.outbox.empty_text') }}

@else
@foreach ($messages as $message) @php($patient = $patients[$message->patient_id] ?? null) @endforeach
{{ __('messaging::messages.outbox.recipient') }} {{ __('messaging::messages.outbox.message') }} {{ __('messaging::messages.outbox.channel') }} {{ __('common.status') }} {{ __('messaging::messages.outbox.when') }}
{{ $patient?->name ?? __('messaging::messages.outbox.no_patient') }} {{-- Enough to confirm the right number, not enough to be a contact list on a shared screen. --}} {{ $message->maskedNumber() }} {{ Str::limit($message->body, 90) }} {{ $message->template_key }} {{ $message->channel->label() }} {{ $message->status->label() }} {{-- The reason a message was not sent is the answer somebody actually came to this screen for. --}} @if ($message->suppression_reason) {{ $message->suppression_reason->label() }} @elseif ($message->error) {{ Str::limit($message->error, 70) }} @endif {{ ($message->sent_at ?? $message->created_at)?->format('d M Y, H:i') }} @if ($message->attempts > 1) {{ trans_choice('messaging::messages.outbox.attempts', $message->attempts, ['count' => $message->attempts]) }} @endif
@if ($messages->hasPages())
{{ $messages->links() }}
@endif @endif
@endsection