This repository has been archived on 2026-09-04. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
theme-song-booth/templates/admin/sales.html
Troll (Hermes Agent) 2b46f7d3dc Guard customer_approved null/None in all templates
Some rows (schema drift, cancelled requests, manual status edits) have
customer_approved = NULL instead of the default 'none'. Templates called
.upper() on it blindly, causing a Jinja2 UndefinedError / 500 when the
customer player or admin pages loaded.

Replace all .upper() calls with (value or 'none').upper() and add truthy
checks before rendering the approved choice in status.html and
dashboard.html.
2026-08-05 03:11:21 +00:00

72 lines
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>Sales Report — Admin</title>
<style>
body{
font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
background:#111827;
color:#f3f4f6;
margin:0;
padding:1rem;
line-height:1.5;
}
.container{max-width:1100px;margin:0 auto;}
h1{color:#60a5fa;margin-top:0;}
a{color:#93c5fd;}
table{
width:100%;
border-collapse:collapse;
background:#1f2937;
border-radius:.5rem;
overflow:hidden;
}
th,td{padding:.7rem;text-align:left;border-bottom:1px solid #374151;}
th{background:#111827;color:#9ca3af;}
tr:hover{background:#2d3748;}
.topbar{float:right;display:flex;gap:.75rem;align-items:center;}
.topbar a{color:#93c5fd;text-decoration:none;}
.empty{padding:1rem;color:#9ca3af;}
</style>
</head>
<body>
<div class="container">
<div class="topbar">
<a href="{{ url_for('admin_dashboard') }}">Dashboard</a>
<a href="{{ url_for('admin_settings') }}">Settings</a>
<a href="{{ url_for('admin_logout') }}" style="color:#f87171">Log out</a>
</div>
<h1>Sales Report</h1>
{% if sales %}
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Picked</th>
<th>Payment Reference</th>
</tr>
</thead>
<tbody>
{% for s in sales %}
<tr>
<td>#{{ s.id }}</td>
<td>{{ s.name }}</td>
<td>{{ s.email }}</td>
<td>{% if s.customer_approved == 'both' %}Both Versions{% else %}Version {{ (s.customer_approved or 'none').upper() }}{% endif %}</td>
<td>{{ s.square_payment_ref or '-' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="empty">No delivered requests yet.</p>
{% endif %}
</div>
</body>
</html>