<?php  if (!defined('DASHBOARD_ROOT')) { http_response_code(403); exit; } $campaigns = Database::fetchAll("SELECT id, campaign_id, name, status, objective, daily_budget, lifetime_budget, total_spend, impressions, clicks, created_at FROM marketing_campaigns ORDER BY created_at DESC LIMIT 50"); $headers = ["Name", "Status", "Objective", "Daily Budget", "Spend", "Impressions", "Clicks", "Created"]; $rows = []; foreach ($campaigns as $c) { $statusCls = $c["status"] === 'ACTIVE' ? "success" : "default"; $rows[] = [ UI::e($c["name"]), UI::badge(UI::e($c["status"] ?? ''), $statusCls), UI::e($c["objective"] ?? ""), "$" . number_format((float)($c["daily_budget"] ?? 0), 2), "$" . number_format((float)($c["total_spend"] ?? 0), 2), number_format((float)($c["impressions"] ?? 0)), number_format((float)($c["clicks"] ?? 0)), $c["created_at"] ]; } echo "<div class=\"campaigns-list\"><h3>Campaigns</h3>" . UI::table($headers, $rows, "tbl-campaigns") . "</div>"; 