- Implemented `send_subscription_confirmation` function to send a confirmation email upon subscription. - Added a default HTML template for the confirmation email in settings. - Updated the newsletter management page to handle subscription and unsubscription actions. - Created new templates for embedding contact and newsletter forms. - Added styles for the new templates and unified CSS styles across the application. - Updated tests to reflect changes in the newsletter management API endpoints.
120 lines
3.5 KiB
HTML
120 lines
3.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Admin Dashboard</title>
|
|
<link rel="stylesheet" href="/static/css/styles.css" />
|
|
<style>
|
|
body {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Admin Dashboard</h1>
|
|
|
|
<div class="stats">
|
|
<div class="stat-card">
|
|
<h3 id="contact-count">--</h3>
|
|
<p>Contact Submissions</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newsletter-count">--</h3>
|
|
<p>Newsletter Subscribers</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="settings-count">--</h3>
|
|
<p>App Settings</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="dashboard-grid">
|
|
<div class="dashboard-card">
|
|
<h2>Contact Form Submissions</h2>
|
|
<p>
|
|
View and manage contact form submissions from your website visitors.
|
|
</p>
|
|
<a href="/admin/submissions">Manage Submissions</a>
|
|
</div>
|
|
|
|
<div class="dashboard-card">
|
|
<h2>Newsletter Subscribers</h2>
|
|
<p>
|
|
Manage newsletter subscriptions and send newsletters to your
|
|
subscribers.
|
|
</p>
|
|
<a href="/admin/newsletter">Manage Subscribers</a>
|
|
</div>
|
|
|
|
<div class="dashboard-card">
|
|
<h2>Application Settings</h2>
|
|
<p>Configure application settings and environment variables.</p>
|
|
<a href="/admin/settings">Manage Settings</a>
|
|
</div>
|
|
|
|
<div class="dashboard-card">
|
|
<h2>Create Newsletter</h2>
|
|
<p>Create and send newsletters to your subscribers.</p>
|
|
<a href="/admin/newsletter/create">Create Newsletter</a>
|
|
</div>
|
|
|
|
<div class="dashboard-card">
|
|
<h2>Embeddable Forms</h2>
|
|
<p>
|
|
Instructions for embedding contact and newsletter forms on other
|
|
websites.
|
|
</p>
|
|
<a href="/admin/embeds">View Embed Codes</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="logout">
|
|
<a href="/auth/logout">Logout</a>
|
|
</div>
|
|
|
|
<script>
|
|
// Load dashboard statistics
|
|
async function loadStats() {
|
|
try {
|
|
// Load contact submissions count
|
|
const contactResponse = await fetch(
|
|
"/admin/api/contact?page=1&per_page=1"
|
|
);
|
|
if (contactResponse.ok) {
|
|
const contactData = await contactResponse.json();
|
|
document.getElementById("contact-count").textContent =
|
|
contactData.pagination.total;
|
|
}
|
|
|
|
// Load newsletter subscribers count
|
|
const newsletterResponse = await fetch(
|
|
"/admin/api/newsletter?page=1&per_page=1"
|
|
);
|
|
if (newsletterResponse.ok) {
|
|
const newsletterData = await newsletterResponse.json();
|
|
document.getElementById("newsletter-count").textContent =
|
|
newsletterData.pagination.total;
|
|
}
|
|
|
|
// Load settings count
|
|
const settingsResponse = await fetch("/admin/api/settings");
|
|
if (settingsResponse.ok) {
|
|
const settingsData = await settingsResponse.json();
|
|
document.getElementById("settings-count").textContent = Object.keys(
|
|
settingsData.settings
|
|
).length;
|
|
}
|
|
} catch (error) {
|
|
console.error("Failed to load dashboard stats:", error);
|
|
}
|
|
}
|
|
|
|
// Load stats when page loads
|
|
loadStats();
|
|
</script>
|
|
</body>
|
|
</html>
|