189 lines
5.0 KiB
HTML
189 lines
5.0 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>
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 20px;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
}
|
|
h1 {
|
|
color: #333;
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
}
|
|
.dashboard-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
|
gap: 20px;
|
|
margin-bottom: 40px;
|
|
}
|
|
.dashboard-card {
|
|
border: 1px solid #ddd;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
background-color: #f9f9f9;
|
|
transition: box-shadow 0.3s ease;
|
|
}
|
|
.dashboard-card:hover {
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
}
|
|
.dashboard-card h2 {
|
|
color: #555;
|
|
margin-top: 0;
|
|
margin-bottom: 15px;
|
|
}
|
|
.dashboard-card p {
|
|
color: #666;
|
|
margin-bottom: 15px;
|
|
}
|
|
.dashboard-card a {
|
|
display: inline-block;
|
|
background-color: #007bff;
|
|
color: white;
|
|
padding: 8px 16px;
|
|
text-decoration: none;
|
|
border-radius: 4px;
|
|
transition: background-color 0.3s ease;
|
|
}
|
|
.dashboard-card a:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
.logout {
|
|
text-align: center;
|
|
margin-top: 40px;
|
|
}
|
|
.logout a {
|
|
color: #dc3545;
|
|
text-decoration: none;
|
|
}
|
|
.logout a:hover {
|
|
text-decoration: underline;
|
|
}
|
|
.stats {
|
|
display: flex;
|
|
justify-content: space-around;
|
|
margin-bottom: 30px;
|
|
flex-wrap: wrap;
|
|
}
|
|
.stat-card {
|
|
background-color: #e9ecef;
|
|
padding: 15px;
|
|
border-radius: 8px;
|
|
text-align: center;
|
|
min-width: 150px;
|
|
margin: 5px;
|
|
}
|
|
.stat-card h3 {
|
|
margin: 0;
|
|
color: #495057;
|
|
font-size: 2em;
|
|
}
|
|
.stat-card p {
|
|
margin: 5px 0 0 0;
|
|
color: #6c757d;
|
|
font-size: 0.9em;
|
|
}
|
|
</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>
|
|
|
|
<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>
|