diff --git a/api/tasks/team/index.php b/api/tasks/team/index.php new file mode 100644 index 0000000..e314b7b --- /dev/null +++ b/api/tasks/team/index.php @@ -0,0 +1,450 @@ + 0, 'Active' => 0, 'Paused' => 0, 'Done' => 0, 'Cancelled' => 0]; + $error = $e->getMessage(); +} + +function statusBadge(string $status): string { + $colors = [ + 'active' => '#22c55e', + 'paused' => '#f59e0b', + 'done' => '#6b7280', + 'cancelled' => '#ef4444', + ]; + $icons = [ + 'active' => '●', + 'paused' => '⏸', + 'done' => '✓', + 'cancelled' => '✕', + ]; + $color = $colors[$status] ?? '#6b7280'; + $icon = $icons[$status] ?? ''; + return "$icon " . htmlspecialchars($status) . ""; +} + +function timeAgo(string $datetime): string { + if (empty($datetime)) return '—'; + $ts = strtotime($datetime); + $diff = time() - $ts; + if ($diff < 60) return 'just now'; + if ($diff < 3600) return floor($diff / 60) . 'm ago'; + if ($diff < 86400) return floor($diff / 3600) . 'h ago'; + if ($diff < 604800) return floor($diff / 86400) . 'd ago'; + return date('M j', $ts); +} +?> + + +
+ + +Payfrit bot task tracker — real-time view of all team activity
+No tasks found
+ Tasks will appear here when bots register work via the API. +| # | +Bot | +Task | +Status | +Assigned By | +Channel | +Started | +Completed | +
|---|---|---|---|---|---|---|---|
| = (int)$t['ID'] ?> | ++ + = strtoupper(substr($t['BotName'], 0, 1)) ?> + @= htmlspecialchars($t['BotName']) ?> + + | +
+ = htmlspecialchars($t['Title']) ?>
+
+ = htmlspecialchars($t['Notes']) ?>
+
+ |
+ = statusBadge($t['Status']) ?> | += !empty($t['AssignedBy']) ? '@' . htmlspecialchars($t['AssignedBy']) : '—' ?> | += !empty($t['Channel']) ? '#' . htmlspecialchars($t['Channel']) . '' : '—' ?> | += timeAgo($t['StartedOn'] ?? '') ?> | += timeAgo($t['CompletedOn'] ?? '') ?> | +