@extends('layouts.dashboard') @section('content') @php /** * Contact-form enquiries: read, answer, remove. * * @var array $messages enquiry rows for this page * @var int $unread unanswered-or-unopened count across the whole list * @var array $pager pagination metadata * @var array $replied ids that already have an answer on record * @var bool $canSend whether outbound mail is configured */ $replied = $replied ?? []; $canSend = $canSend ?? false; @endphp @php /* .qm-d2: the dashboard density standard (app.css ยง35) */ @endphp

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

@if ($unread > 0){{ t_raw('notif.unread_count', [':count' => (int) $unread]) }}@endif
@if ($messages && !$canSend)

{{ t_raw('admin.messages.mail_off_hint') }} {{ t_raw('admin.messages.mail_off_link') }}

@endif @if ($messages)
@php /* Subject cell also carries the free-text message body, and Received renders via fmt_datetime(), which Date.parse() can't read - both th's carry no data-sort. */ @endphp @foreach ($messages as $m) @php $mid = (int) $m['id']; $hasReply = isset($replied[$mid]); @endphp @endforeach
{{ t_raw('admin.messages.col_from') }}{{ t_raw('admin.messages.col_subject') }}{{ t_raw('admin.messages.col_received') }}{{ t_raw('common.actions') }}
{!! brandmark_html(null, (string) ($m['name'] ?? t_raw('admin.messages.fallback_sender_name')), 'md', 'qm-brandmark--round') !!}
{{ $m['name'] }} @if (!empty($m['email'])){{ $m['email'] }}@endif
@if (!empty($m['subject']))
{{ $m['subject'] }}
@endif
{{ $m['message'] }}
@if ($hasReply){{ t_raw('admin.messages.badge_answered') }}@endif
{!! fmt_datetime($m['created_at']) !!} @partial('row-actions', ['actions' => [ [ 'label' => t_raw('admin.messages.action_reply'), 'icon' => 'fa-reply', 'primary' => true, 'disabled' => !$canSend || empty($m['email']), 'attrs' => [ 'data-bs-toggle' => 'modal', 'data-bs-target' => '#messageReplyModal', 'data-reply-open' => '1', 'data-id' => (string) $mid, 'data-name' => (string) ($m['name'] ?? ''), 'data-email' => (string) ($m['email'] ?? ''), 'data-subject' => (string) ($m['subject'] ?? ''), 'data-message' => (string) $m['message'], ], ], (int) $m['is_read'] === 0 ? [ 'label' => t_raw('admin.messages.action_mark_read'), 'icon' => 'fa-envelope-open', 'form' => ['action' => '/admin/messages/read', 'fields' => ['id' => $mid]], ] : null, [ 'label' => t_raw('common.delete'), 'icon' => 'fa-trash-alt', 'danger' => true, 'form' => ['action' => '/admin/messages/delete', 'fields' => ['id' => $mid], 'confirm' => t_raw('admin.messages.confirm_delete')], ], ]])
@partial('table-toolbar', ['pager' => $pager, 'base' => '/admin/messages']) @else

{{ t_raw('admin.messages.empty') }}

@endif
@if ($messages && $canSend) @php // Reply composer. The enquiry it answers is shown above the box, and repeated at the // foot of the sent email, so the sender never has to guess what is being answered. @endphp @endif
@php /* /.qm-d2 */ @endphp @endsection