Make all customer info fields editable from admin request page
This commit is contained in:
parent
da917692f0
commit
0c90b5a298
2 changed files with 40 additions and 8 deletions
17
app.py
17
app.py
|
|
@ -841,6 +841,23 @@ def admin_request(rid):
|
||||||
flash('Customer email updated.', 'success')
|
flash('Customer email updated.', 'success')
|
||||||
return redirect(url_for('admin_request', rid=rid))
|
return redirect(url_for('admin_request', rid=rid))
|
||||||
|
|
||||||
|
elif action == 'update_customer_info':
|
||||||
|
new_email = request.form.get('email', '').strip().lower()
|
||||||
|
if not is_valid_email(new_email):
|
||||||
|
flash('Please enter a valid email address.', 'error')
|
||||||
|
return redirect(url_for('admin_request', rid=rid))
|
||||||
|
update_request(rid,
|
||||||
|
email=new_email,
|
||||||
|
name=request.form.get('name', '').strip(),
|
||||||
|
hobbies=request.form.get('hobbies', '').strip(),
|
||||||
|
notable_facts=request.form.get('notable_facts', '').strip(),
|
||||||
|
style_genre=request.form.get('style_genre', '').strip(),
|
||||||
|
vocal_gender=request.form.get('vocal_gender', '').strip(),
|
||||||
|
extra_requests=request.form.get('extra_requests', '').strip()
|
||||||
|
)
|
||||||
|
flash('Customer info updated.', 'success')
|
||||||
|
return redirect(url_for('admin_request', rid=rid))
|
||||||
|
|
||||||
elif action == 'save_operator_notes':
|
elif action == 'save_operator_notes':
|
||||||
update_request(rid, operator_notes=request.form.get('operator_notes', '').strip())
|
update_request(rid, operator_notes=request.form.get('operator_notes', '').strip())
|
||||||
flash('Operator notes saved.', 'success')
|
flash('Operator notes saved.', 'success')
|
||||||
|
|
|
||||||
|
|
@ -139,23 +139,38 @@
|
||||||
<!-- Customer Info -->
|
<!-- Customer Info -->
|
||||||
<div class="section">
|
<div class="section">
|
||||||
<h2>Customer Info</h2>
|
<h2>Customer Info</h2>
|
||||||
<p class="copy-hint">Operators can correct the customer's email address here.</p>
|
<p class="copy-hint">Operators can correct customer details here. Click Save when done.</p>
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input type="hidden" name="action" value="update_customer_email">
|
<input type="hidden" name="action" value="update_customer_info">
|
||||||
|
|
||||||
<label for="customer_email">Email address</label>
|
<label for="customer_email">Email address</label>
|
||||||
<input type="email" id="customer_email" name="email" value="{{ req.email }}" required>
|
<input type="email" id="customer_email" name="email" value="{{ req.email }}" required>
|
||||||
|
|
||||||
|
<label for="customer_name">Name / persona</label>
|
||||||
|
<input type="text" id="customer_name" name="name" value="{{ req.name }}" required>
|
||||||
|
|
||||||
|
<label for="customer_hobbies">Hobbies & interests</label>
|
||||||
|
<textarea id="customer_hobbies" name="hobbies" rows="3">{{ req.hobbies or '' }}</textarea>
|
||||||
|
|
||||||
|
<label for="customer_notable_facts">Notable things</label>
|
||||||
|
<textarea id="customer_notable_facts" name="notable_facts" rows="3">{{ req.notable_facts or '' }}</textarea>
|
||||||
|
|
||||||
|
<label for="customer_style_genre">Style / genre / mood</label>
|
||||||
|
<input type="text" id="customer_style_genre" name="style_genre" value="{{ req.style_genre or '' }}">
|
||||||
|
|
||||||
|
<label for="customer_vocal_gender">Preferred singer voice / gender</label>
|
||||||
|
<input type="text" id="customer_vocal_gender" name="vocal_gender" value="{{ req.vocal_gender or '' }}">
|
||||||
|
|
||||||
|
<label for="customer_extra_requests">Anything else</label>
|
||||||
|
<textarea id="customer_extra_requests" name="extra_requests" rows="3">{{ req.extra_requests or '' }}</textarea>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<button type="submit" class="secondary">Update Email</button>
|
<button type="submit" class="secondary">Save Customer Info</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p style="margin-top:1rem"><strong>Request #:</strong> {{ req.id }}</p>
|
<p style="margin-top:1rem"><strong>Request #:</strong> {{ req.id }}</p>
|
||||||
<p><strong>Status:</strong> <span class="status-badge">{{ statuses[req.status] }}</span></p>
|
<p><strong>Status:</strong> <span class="status-badge">{{ statuses[req.status] }}</span></p>
|
||||||
<p><strong>Hobbies:</strong><br>{{ req.hobbies or '-' }}</p>
|
|
||||||
<p><strong>Notable facts:</strong><br>{{ req.notable_facts or '-' }}</p>
|
|
||||||
<p><strong>Style / genre:</strong><br>{{ req.style_genre or '-' }}</p>
|
|
||||||
<p><strong>Preferred singer voice / gender:</strong><br>{{ req.vocal_gender or 'No preference' }}</p>
|
|
||||||
<p><strong>Extra requests:</strong><br>{{ req.extra_requests or '-' }}</p>
|
|
||||||
|
|
||||||
{% if req.revision_note %}
|
{% if req.revision_note %}
|
||||||
<div class="revision-note">
|
<div class="revision-note">
|
||||||
|
|
|
||||||
Reference in a new issue