Added Email Logging for Emailnotification class

This commit is contained in:
Frank Schubert
2025-08-22 17:49:54 +02:00
parent 866c3b2ae1
commit 3a86160b38
26 changed files with 1636 additions and 46 deletions
@@ -823,6 +823,7 @@
<div id="preorder-detail-<?=$preorder->id?>-emails" class="tab-pane preorder-emails-view">
<?php
$email_logs = EmailLog::search(["object_type" => "preorder", "object_id" => $preorder->id]);
$allPreorderEmails = PreordernotificationLogModel::search(["preorder_id" => $preorder->id]);
$allStatusFlagEmails = PreorderStatusnotificationLog::search(["preorder_id" => $preorder->id]);
?>
@@ -830,6 +831,7 @@
<div class="container-fluid">
<div class="row">
<div class="col-12">
<h5 class="mb-3">
<i class="fas fa-envelope mr-2 text-muted"></i>
E-Mail Benachrichtigungen
@@ -984,8 +986,34 @@
</div>
<?php endif; ?>
<?php if($email_logs): ?>
<h5>Alle ausgehenden Emails <small>(ab 25.08.2025)</small></h5>
<table class="table table-sm table-striped mb-3">
<tr>
<th>Von</th>
<th>An</th>
<th>Betreff</th>
<th>Anhänge</th>
<th>Gesendet</th>
<th></th>
</tr>
<?php foreach($email_logs as $email): ?>
<tr>
<td><?=$email->from?></td>
<td><?=$email->to?></td>
<td><?=htmlentities($email->subject)?></td>
<td><?=(is_array($email->attachments)) ? count($email->attachments) : 0?></td>
<td><?=date("d.m.Y H:i",$email->create)?></td>
<td><i class="fas fa-eye text-primary pointer" onclick="displayEmailLogEmail(<?=$preorder->id?>,<?=$email->id?>); return false;"></i></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<!-- Empty State -->
<?php if (empty($allPreorderEmails) && empty($allStatusFlagEmails)): ?>
<?php if (empty($email_logs) && empty($allPreorderEmails) && empty($allStatusFlagEmails)): ?>
<div class="card border-0">
<div class="card-body text-center py-4">
<div class="mb-3">