tractatus/public/admin/newsletter-management.html
TheFlow c0bc35f2de fix(newsletter): convert ObjectId to string in DELETE button data attributes
Root cause: MongoDB ObjectId objects were being inserted into data-id
attributes as '[object Object]' instead of their string representation.

Fix: Explicitly call String() on sub._id when creating data attributes.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-24 20:24:54 +13:00

116 lines
5.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Newsletter Management | Tractatus Admin</title>
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.0.1761283486841">
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.0.1761283486841">
<script src="/js/admin/auth-check.js?v=0.1.0.1761283486841"></script>
</head>
<body class="bg-gray-50">
<!-- Navigation -->
<div id="admin-navbar" data-page-title="Newsletter Management" data-page-icon="newsletter"></div>
<script src="/js/components/navbar-admin.js?v=0.1.0.1761283486841"></script>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Statistics Cards -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6 mb-8">
<div class="bg-white rounded-lg shadow p-6">
<div class="text-sm text-gray-500">Total Subscribers</div>
<div class="text-3xl font-bold text-gray-900 mt-2" id="stat-total">-</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="text-sm text-gray-500">Active Subscribers</div>
<div class="text-3xl font-bold text-green-600 mt-2" id="stat-active">-</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="text-sm text-gray-500">Verified</div>
<div class="text-3xl font-bold text-blue-600 mt-2" id="stat-verified">-</div>
</div>
<div class="bg-white rounded-lg shadow p-6">
<div class="text-sm text-gray-500">Last 30 Days</div>
<div class="text-3xl font-bold text-indigo-600 mt-2" id="stat-recent">-</div>
</div>
</div>
<!-- Actions -->
<div class="bg-white rounded-lg shadow p-6 mb-8">
<div class="flex justify-between items-center">
<h2 class="text-lg font-medium text-gray-900">Actions</h2>
<div class="flex gap-3">
<button id="refresh-btn" class="px-4 py-2 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50">
Refresh
</button>
<button id="export-btn" class="px-4 py-2 bg-blue-600 text-white rounded-md text-sm font-medium hover:bg-blue-700">
Export CSV
</button>
</div>
</div>
</div>
<!-- Subscribers List -->
<div class="bg-white rounded-lg shadow">
<div class="px-6 py-4 border-b border-gray-200">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-medium text-gray-900">Subscribers</h3>
<div class="flex gap-2">
<select id="filter-status" class="px-3 py-2 border border-gray-300 rounded-md text-sm">
<option value="active">Active</option>
<option value="all">All</option>
<option value="inactive">Inactive</option>
</select>
<select id="filter-verified" class="px-3 py-2 border border-gray-300 rounded-md text-sm">
<option value="all">All Verification</option>
<option value="verified">Verified</option>
<option value="unverified">Unverified</option>
</select>
</div>
</div>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Email</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Source</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Subscribed</th>
<th class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Actions</th>
</tr>
</thead>
<tbody id="subscribers-table" class="bg-white divide-y divide-gray-200">
<tr>
<td colspan="6" class="px-6 py-8 text-center text-gray-500">Loading subscribers...</td>
</tr>
</tbody>
</table>
</div>
<!-- Pagination -->
<div class="px-6 py-4 border-t border-gray-200 flex justify-between items-center">
<div class="text-sm text-gray-500">
Showing <span id="showing-from">0</span> to <span id="showing-to">0</span> of <span id="total-count">0</span> subscribers
</div>
<div class="flex gap-2">
<button id="prev-page" class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed">
Previous
</button>
<button id="next-page" class="px-3 py-1 border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed">
Next
</button>
</div>
</div>
</div>
</div>
<script src="/js/admin/newsletter-management.js?v=0.1.2.objectid-to-string"></script>
</body>
</html>