Add status badges for uploaded files and sent emails on admin request page
This commit is contained in:
parent
30732c0b64
commit
7ef8779eb7
2 changed files with 43 additions and 3 deletions
8
app.py
8
app.py
|
|
@ -191,6 +191,12 @@ def admin_request(rid):
|
|||
if not req:
|
||||
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':
|
||||
action = request.form.get('action')
|
||||
|
||||
|
|
@ -255,7 +261,7 @@ def admin_request(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 ----------------
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,10 @@ button.success{background:#10b981}
|
|||
.info-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem}
|
||||
.info-grid div{background:#111827;padding:.6rem;border-radius:.5rem}
|
||||
.approved-box{font-size:1.2rem;font-weight:bold;color:#fbbf24}
|
||||
.copy-hint{font-size:.85rem;color:#9ca3af;margin-top:.3rem}
|
||||
pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-space:pre-wrap}
|
||||
.status-badge{display:inline-block;padding:.25rem .6rem;border-radius:9999px;font-size:.8rem;font-weight:600;background:#374151;color:#f3f4f6;margin-right:.3rem}
|
||||
.status-badge.ok{background:#10b981;color:#000}
|
||||
.status-badge.missing{background:#ef4444;color:#000}
|
||||
.status-badge.sent{background:#60a5fa;color:#000}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -85,6 +87,22 @@ pre{background:#111827;padding:.8rem;border-radius:.5rem;overflow:auto;white-spa
|
|||
|
||||
<div class="section">
|
||||
<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">
|
||||
<input type="hidden" name="action" value="upload_songs">
|
||||
<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">
|
||||
<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>
|
||||
<form method="POST">
|
||||
<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>
|
||||
{% endif %}
|
||||
</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">
|
||||
<input type="hidden" name="action" value="mark_paid_deliver">
|
||||
<label for="square_payment_ref">Square Payment Reference</label>
|
||||
|
|
|
|||
Reference in a new issue