<?php if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } function renderOrderHistory(int $orderId): string { $events = Database::fetchAll("SELECT id,category,action,admin_id,meta,created_at FROM events WHERE target_type=\"order\" AND target_id=:oid ORDER BY created_at DESC LIMIT 50",[":oid"=>$orderId]); $html = "<div class=\"order-history\"><h3>Order History</h3>"; foreach($events as $e) { $html .= "<div class=\"history-entry\"><span>".UI::e($e["action"])."</span><span>".UI::e($e["created_at"])."</span></div>"; } $html .= "</div>"; return $html; } 