@extends('layouts.dashboard') @section('content') @php /** * Email delivery log — every transactional message the platform sent, and every one it * could not. A record of outbound mail, not a mailbox: the product sends over SMTP and * never receives, so there is nothing inbound to list. * * @var array $rows the current page, newest first * @var array $counts ['sent'=>int,'pending'=>int,'failed'=>int] across the whole log * @var int $total rows matching the active filter * @var array $pagination paginate() metadata * @var string $status active status filter ('' = all) * @var string $q active search term * @var bool $configured whether SMTP is set up at all */ $statusPill = [ 'sent' => 'qm-pill-green', 'pending' => 'qm-pill-amber', 'failed' => 'qm-pill-red', ]; $statusLabel = [ 'sent' => t_raw('admin.email_log.status_sent'), 'pending' => t_raw('admin.email_log.status_pending'), 'failed' => t_raw('admin.email_log.status_failed'), ]; $hasFilters = $status !== '' || $q !== ''; @endphp @php /* .qm-d2: the dashboard density standard (app.css §35) */ @endphp
@partial('kpi-card', ['label' => t_raw('admin.email_log.kpi_sent'), 'value' => number_format($counts['sent']), 'icon' => 'fa-paper-plane', 'accent' => 'green']) @partial('kpi-card', ['label' => t_raw('admin.email_log.kpi_pending'), 'value' => number_format($counts['pending']), 'icon' => 'fa-clock', 'accent' => 'amber']) @partial('kpi-card', ['label' => t_raw('admin.email_log.kpi_failed'), 'value' => number_format($counts['failed']), 'icon' => 'fa-exclamation-triangle', 'accent' => 'rose']) @php $elDelivered = (int) $counts['sent']; $elAttempted = $elDelivered + (int) $counts['failed']; @endphp @partial('kpi-card', ['label' => t_raw('admin.email_log.kpi_delivery_rate'), 'value' => $elAttempted > 0 ? number_format($elDelivered / $elAttempted * 100, 1) . '%' : '—', 'icon' => 'fa-percentage', 'accent' => 'blue']) @partial('kpi-card', ['label' => t_raw('admin.email_log.kpi_total'), 'value' => number_format($elDelivered + (int) $counts['pending'] + (int) $counts['failed']), 'icon' => 'fa-envelope', 'accent' => 'violet'])

{{ t_raw('admin.email_log.list_heading') }}

@if (!$configured) @php // SMTP-off guidance now rides as a tooltip on a primary-colour info marker // beside the title, rather than an always-on hint line under the header. @endphp @endif @if ($total > 0){{ t_raw('admin.email_log.total_pill', [':count' => number_format($total)]) }}@endif
@partial('filter-collapse')
@if ($rows) @foreach ($rows as $r) @php $st = (string) $r['status']; $rid = (int) $r['id']; @endphp @endforeach @else @partial('table-empty', ['colspan' => 6, 'icon' => 'fa-paper-plane', 'msg' => $hasFilters ? t_raw('admin.email_log.empty_search') : t_raw('admin.email_log.empty')]) @endif
{{ t_raw('admin.email_log.caption') }}
{{ t_raw('admin.email_log.col_recipient') }} {{ t_raw('admin.email_log.col_subject') }} {{ t_raw('common.status') }} {{ t_raw('admin.email_log.col_attempts') }} {{ t_raw('admin.email_log.col_when') }} {{ t_raw('common.actions') }}
{{ $r['to_email'] }} {!! or_dash($r['template_key']) !!}
{{ $r['subject'] }} {{ $statusLabel[$st] ?? $st }} @if ($st !== 'sent' && !empty($r['last_error'])) {{ $r['last_error'] }} @endif {{ (int) $r['attempts'] }} {!! fmt_datetime($r['sent_at'] ?: $r['created_at']) !!} @partial('row-actions', ['actions' => [ ['label' => t_raw('common.view'), 'icon' => 'fa-eye', 'href' => '/admin/email-log/' . $rid], ['label' => t_raw('admin.email_log.action_resend'), 'icon' => 'fa-redo', 'form' => ['action' => '/admin/email-log/resend', 'fields' => ['id' => $rid]]], ]])
@partial('table-toolbar', ['pager' => $pagination, 'base' => '/admin/email-log'])
@if ($counts['sent'] > 0)

{{ t_raw('admin.email_log.housekeeping_title') }}

@csrf
@endif
@php /* /.qm-d2 */ @endphp @endsection