base_object = $base_object; $this->layout_object = $layout_object; $this->revocation = new Revocation($base_object); } public function run() { // Action: als bearbeitet markieren if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'mark_processed' && !empty($_POST['id']) ) { $this->revocation->mark_processed( (int)$_POST['id'], (string)($_POST['note'] ?? '') ); // PRG header('Location: /index.php?admin_modul=admin_revocation_list&done=1'); exit; } $filter_status = isset($_GET['status']) ? (string)$_GET['status'] : ''; $rows = $this->revocation->list_all($filter_status ?: null, 500); return $this->render($rows, $filter_status, !empty($_GET['done'])); } private function render($rows, $filter, $just_done) { $h = function($s) { return htmlspecialchars((string)$s, ENT_QUOTES, 'UTF-8'); }; $html = '
'; $html .= '

Widerrufsliste

'; $html .= '

Elektronische Widerrufe nach EU-RL 2026/2673. ' . 'Alle B2C-Bestellungen seit Aktivierung des Features.

'; if ($just_done) { $html .= '
Als bearbeitet markiert.
'; } // Filter $html .= '
' . '' . '
'; if (empty($rows)) { $html .= '

Keine Einträge gefunden.

'; return $html; } $html .= '' . '' . '' . '' . '' . '' . '' . '' . '' . '' . ''; foreach ($rows as $r) { $badge_color = [ 'pending' => '#999', 'submitted' => '#c00', 'processed' => '#2a7', 'expired' => '#888', 'revoked_by_admin'=> '#555', ][$r->status] ?? '#555'; $html .= '' . '' . '' . '' . '' . '' . '' . '' . ''; } $html .= '
IDBestellnr.Kunde (E-Mail)StatusBestelldatumWiderruf amOwner-MailAktion
'.(int)$r->id.''.$h($r->order_number ?: '#'.$r->order_id).''.$h($r->customer_email).'' . $h($r->status).''.$h($r->order_date).''.$h($r->submitted_at ?? '–').''.$h($r->owner_notified_at ? '✓' : '–').''; if ($r->status === 'submitted') { $html .= '
' . '' . '' . '' . '
'; } elseif ($r->status === 'processed') { $html .= 'abgeschlossen'; } else { $html .= '–'; } $html .= '
'; return $html; } }