Add status badges for uploaded files and sent emails on admin request page

This commit is contained in:
Troll (Hermes Agent) 2026-07-31 21:43:38 +00:00
parent 30732c0b64
commit 7ef8779eb7
2 changed files with 43 additions and 3 deletions

8
app.py
View file

@ -191,6 +191,12 @@ def admin_request(rid):
if not req: if not req:
abort(404) abort(404)
def file_exists(path):
return bool(path and Path(path).exists())
def basename(path):
return Path(path).name if path else ''
if request.method == 'POST': if request.method == 'POST':
action = request.form.get('action') action = request.form.get('action')
@ -255,7 +261,7 @@ def admin_request(rid):
return redirect(url_for('admin_request', rid=rid)) return redirect(url_for('admin_request', rid=rid))
return render_template('admin/request.html', req=req, statuses=STATUS_LABELS) return render_template('admin/request.html', req=req, statuses=STATUS_LABELS, file_exists=file_exists, basename=basename)
# ---------------- init ---------------- # ---------------- init ----------------

View file

@ -23,8 +23,10 @@ button.success{background:#10b981}
.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem} .info-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
.info-grid div{background:#111827;padding:.6rem;border-radius:.5rem} .info-grid div{background:#111827;padding:.6rem;border-radius:.5rem}
.approved-box{font-size:1.2rem;font-weight:bold;color:#fbbf24} .approved-box{font-size:1.2rem;font-weight:bold;color:#fbbf24}
.copy-hint{font-size:.85rem;color:#9ca3af;margin-top:.3rem} .status-badge{display:inline-block;padding:.25rem .6rem;border-radius:9999px;font-size:.8rem;font-weight:600;background:#374151;color:#f3f4f6;margin-right:.3rem}
pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-space:pre-wrap} .status-badge.ok{background:#10b981;color:#000}
.status-badge.missing{background:#ef4444;color:#000}
.status-badge.sent{background:#60a5fa;color:#000}
</style> </style>
</head> </head>
<body> <body>
@ -85,6 +87,22 @@ pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-spa
<div class="section"> <div class="section">
<h2>2. Upload Songs</h2> <h2>2. Upload Songs</h2>
<p>
Version A:
{% if req.song_a_path and file_exists(req.song_a_path) %}
<span class="status-badge ok">✅ Uploaded</span> {{ basename(req.song_a_path) }}
{% else %}
<span class="status-badge missing">❌ Not uploaded</span>
{% endif %}
</p>
<p>
Version B:
{% if req.song_b_path and file_exists(req.song_b_path) %}
<span class="status-badge ok">✅ Uploaded</span> {{ basename(req.song_b_path) }}
{% else %}
<span class="status-badge missing">❌ Not uploaded</span>
{% endif %}
</p>
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
<input type="hidden" name="action" value="upload_songs"> <input type="hidden" name="action" value="upload_songs">
<label for="song_a">Version A MP3</label> <label for="song_a">Version A MP3</label>
@ -98,6 +116,14 @@ pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-spa
<div class="section"> <div class="section">
<h2>3. Notify Customer</h2> <h2>3. Notify Customer</h2>
<p>
Preview email:
{% if req.preview_sent_at %}
<span class="status-badge sent">✅ Sent</span> {{ req.preview_sent_at }}
{% else %}
<span class="status-badge missing">❌ Not sent yet</span>
{% endif %}
</p>
<p>Both songs must be uploaded first.</p> <p>Both songs must be uploaded first.</p>
<form method="POST"> <form method="POST">
<input type="hidden" name="action" value="notify_customer"> <input type="hidden" name="action" value="notify_customer">
@ -114,6 +140,14 @@ pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-spa
<span class="approved-box">{{ req.customer_approved.upper() }}</span> <span class="approved-box">{{ req.customer_approved.upper() }}</span>
{% endif %} {% endif %}
</p> </p>
<p>
Delivery email:
{% if req.delivery_sent_at %}
<span class="status-badge sent">✅ Sent</span> {{ req.delivery_sent_at }}
{% else %}
<span class="status-badge missing">❌ Not sent yet</span>
{% endif %}
</p>
<form method="POST"> <form method="POST">
<input type="hidden" name="action" value="mark_paid_deliver"> <input type="hidden" name="action" value="mark_paid_deliver">
<label for="square_payment_ref">Square Payment Reference</label> <label for="square_payment_ref">Square Payment Reference</label>