- Neue Seite /admin/mailings/<id> mit Status je Empfänger (views/admin_mailing_detail.php, mailing_recipient_log()). - Das Formular schickt Häppchen per fetch, bis alle Empfänger durch sind – eine Antwort pro Häppchen, damit kein Request in die Zeitgrenze des Hosters läuft; ohne JavaScript bleibt es beim klassischen POST.
74 lines
2.9 KiB
PHP
74 lines
2.9 KiB
PHP
<?php
|
||
/** @var array<string, mixed> $mailing */
|
||
/** @var list<array{email: string, status: string, sent_at: ?string, error: string}> $log */
|
||
/** @var array{sent: int, pending: int, failed: int} $counts */
|
||
|
||
$statusLabels = [
|
||
'sent' => ['Gesendet', 'pill--green'],
|
||
'pending' => ['Offen', 'pill--blue'],
|
||
'failed' => ['Fehlgeschlagen', 'pill--red'],
|
||
];
|
||
$total = count($log);
|
||
?>
|
||
<div class="page-head page-head--compact">
|
||
<div>
|
||
<p class="eyebrow">Verwaltung</p>
|
||
<h1>Protokoll zur Rundmail</h1>
|
||
<p class="page-head__lede">
|
||
„<?= e(mailing_render((string) $mailing['subject'])) ?>“ –
|
||
angelegt am <?= e(date('d.m.Y H:i', strtotime((string) $mailing['created_at']))) ?>,
|
||
<?= $total ?> Empfänger.
|
||
</p>
|
||
</div>
|
||
<div class="page-head__actions">
|
||
<a class="btn" href="<?= e(url('/admin/mailings')) ?>">Zurück zur Übersicht</a>
|
||
</div>
|
||
</div>
|
||
|
||
<section class="panel">
|
||
<div class="panel__head">
|
||
<div>
|
||
<h2>Stand</h2>
|
||
<p><?= (int) $counts['sent'] ?> gesendet · <?= (int) $counts['failed'] ?> fehlgeschlagen ·
|
||
<?= (int) $counts['pending'] ?> offen<?= $counts['pending'] === 0 ? ' · fertig' : '' ?>.</p>
|
||
</div>
|
||
</div>
|
||
|
||
<?php if (!$log): ?>
|
||
<p class="muted">Für diese Rundmail sind keine Empfänger gespeichert.</p>
|
||
<?php else: ?>
|
||
<div class="table-wrap">
|
||
<table class="data-table">
|
||
<thead>
|
||
<tr>
|
||
<th scope="col">Empfänger</th>
|
||
<th scope="col">Status</th>
|
||
<th scope="col">Gesendet am</th>
|
||
<th scope="col">Hinweis</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<?php foreach ($log as $row): ?>
|
||
<?php
|
||
$status = (string) $row['status'];
|
||
[$label, $pill] = $statusLabels[$status] ?? [$status, 'pill--grey'];
|
||
?>
|
||
<tr>
|
||
<td><?= e((string) $row['email']) ?></td>
|
||
<td><span class="pill <?= e($pill) ?>"><?= e($label) ?></span></td>
|
||
<td><?= $row['sent_at'] !== null
|
||
? e(date('d.m.Y H:i', strtotime((string) $row['sent_at'])))
|
||
: '–' ?></td>
|
||
<td><?= trim((string) ($row['error'] ?? '')) !== ''
|
||
? e((string) $row['error'])
|
||
: '<span class="muted">–</span>' ?></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<?php if ($total >= 1000): ?>
|
||
<p class="muted small">Angezeigt werden die ersten 1000 Einträge – fehlgeschlagene und offene zuerst.</p>
|
||
<?php endif; ?>
|
||
<?php endif; ?>
|
||
</section>
|