140 lines
3.4 KiB
Cheetah
140 lines
3.4 KiB
Cheetah
{{define "admin.tmpl"}}
|
|
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin - Decor By Hannahs</title>
|
|
<link rel="stylesheet" href="/static/css/styles.css">
|
|
<script>
|
|
(function() {
|
|
const savedTheme = localStorage.getItem('theme') || 'light';
|
|
document.documentElement.setAttribute('data-theme', savedTheme);
|
|
})();
|
|
</script>
|
|
<script src="/static/js/alpine.js" defer></script>
|
|
<script src="/static/htmx/htmx.min.js" defer></script>
|
|
<script src="/static/js/drawer.js" defer></script>
|
|
<style>
|
|
.admin-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
margin-top: 1rem;
|
|
}
|
|
.admin-table th,
|
|
.admin-table td {
|
|
padding: 0.75rem;
|
|
text-align: left;
|
|
border-bottom: 1px solid hsl(var(--border));
|
|
}
|
|
.admin-table th {
|
|
background: hsl(var(--muted) / 0.3);
|
|
font-weight: 600;
|
|
}
|
|
.admin-table tr:hover {
|
|
background: hsl(var(--muted) / 0.1);
|
|
}
|
|
.status-select {
|
|
padding: 0.25rem 0.5rem;
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 4px;
|
|
background: white;
|
|
}
|
|
.update-btn {
|
|
padding: 0.25rem 0.75rem;
|
|
background: hsl(var(--primary));
|
|
color: white;
|
|
border: none;
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
font-size: 0.875rem;
|
|
}
|
|
.update-btn:hover {
|
|
opacity: 0.9;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
{{template "header" .}}
|
|
|
|
<main>
|
|
<div style="max-width: 1400px; margin: 0 auto;">
|
|
<div style="margin-bottom: 2rem;">
|
|
<h1 style="font-size: 2.5rem; font-weight: 700; margin-bottom: 0.5rem;">Admin Dashboard</h1>
|
|
<p style="color: hsl(var(--muted-foreground)); font-size: 1.125rem;">Manage bookings and orders</p>
|
|
</div>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3 class="card-title">All Bookings</h3>
|
|
<p class="card-description">View and update booking statuses</p>
|
|
</div>
|
|
<div class="card-content">
|
|
{{if .Bookings}}
|
|
<div style="overflow-x: auto;">
|
|
<table class="admin-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Customer</th>
|
|
<th>Service</th>
|
|
<th>Event Type</th>
|
|
<th>Event Date</th>
|
|
<th>Address</th>
|
|
<th>Status</th>
|
|
<th>Created</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Bookings}}
|
|
<tr>
|
|
<td>{{.ID}}</td>
|
|
<td>{{.UserEmail}}</td>
|
|
<td>{{.ServiceOption}}</td>
|
|
<td>{{.EventType}}</td>
|
|
<td>{{.EventDate}}</td>
|
|
<td style="max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">{{.Address}}</td>
|
|
<td>
|
|
<span class="status-badge status-{{.Status}}">{{.Status}}</span>
|
|
</td>
|
|
<td>{{.CreatedAt}}</td>
|
|
<td>
|
|
<form method="POST" action="/admin/update-booking" style="display: flex; gap: 0.5rem; align-items: center;">
|
|
<input type="hidden" name="booking_id" value="{{.ID}}">
|
|
<select name="status" class="status-select">
|
|
<option value="pending" {{if eq .Status "pending"}}selected{{end}}>Pending</option>
|
|
<option value="confirmed" {{if eq .Status "confirmed"}}selected{{end}}>Confirmed</option>
|
|
<option value="completed" {{if eq .Status "completed"}}selected{{end}}>Completed</option>
|
|
<option value="cancelled" {{if eq .Status "cancelled"}}selected{{end}}>Cancelled</option>
|
|
</select>
|
|
<button type="submit" class="update-btn">Update</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{{if .Notes}}
|
|
<tr>
|
|
<td colspan="9" style="background: hsl(var(--muted) / 0.2); font-size: 0.875rem;">
|
|
<strong>Notes:</strong> {{.Notes}}
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{{else}}
|
|
<p style="color: hsl(var(--muted-foreground));">No bookings yet.</p>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
{{template "footer"}}
|
|
{{template "theme-script"}}
|
|
</body>
|
|
</html>
|
|
{{end}}
|