92 lines
3.6 KiB
HTML
92 lines
3.6 KiB
HTML
{% extends "admin/base.html" %}
|
|
{% block title %}Demo requests{% endblock %}
|
|
{% block content %}
|
|
<header class="page-head">
|
|
<div>
|
|
<h1>Demo requests</h1>
|
|
<p class="muted">Appointments booked from the public page, soonest first.</p>
|
|
</div>
|
|
<a class="btn btn--ghost" href="{{ url_for('admin.dashboard') }}">← Dashboard</a>
|
|
</header>
|
|
|
|
<div class="filters">
|
|
<span class="filters__label">Show</span>
|
|
{% set views = [('', 'Open'), ('new','new'), ('scheduled','scheduled'), ('done','done'), ('cancelled','cancelled')] %}
|
|
{% for val, label in views %}
|
|
<a class="filter-chip {{ 'is-active' if status == val }}"
|
|
href="{{ url_for('admin.demos', status=val) }}">{{ label }}</a>
|
|
{% endfor %}
|
|
{% if new_count %}<span class="filters__sep">·</span><span class="muted">{{ new_count }} new</span>{% endif %}
|
|
</div>
|
|
|
|
{% if requests %}
|
|
<div class="table-wrap">
|
|
<table class="audit-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Requested for</th>
|
|
<th>Contact</th>
|
|
<th>Company</th>
|
|
<th>Message</th>
|
|
<th>Received (UTC)</th>
|
|
<th>Status</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for r in requests %}
|
|
<tr>
|
|
<td class="mono nowrap">{{ r.preferred_date.strftime('%Y-%m-%d') }} {{ r.preferred_time }}</td>
|
|
<td>
|
|
<strong>{{ r.name }}</strong><br>
|
|
<a href="mailto:{{ r.email }}">{{ r.email }}</a>
|
|
{% if r.phone %}<br><span class="mono">{{ r.phone }}</span>{% endif %}
|
|
</td>
|
|
<td>{{ r.company or '—' }}</td>
|
|
<td>{{ r.message or '' }}</td>
|
|
<td class="mono nowrap">{{ r.created_at.strftime('%Y-%m-%d %H:%M') if r.created_at else '—' }}</td>
|
|
<td><span class="badge badge--{{ 'create' if r.status == 'new' else ('update' if r.status == 'scheduled' else 'delete') }}">{{ r.status }}</span></td>
|
|
<td class="nowrap">
|
|
<form method="post" action="{{ url_for('admin.demo_status', req_id=r.id) }}" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<input type="hidden" name="back_status" value="{{ status }}">
|
|
<select name="status" class="mini-select">
|
|
{% for s in statuses %}
|
|
<option value="{{ s }}" {{ 'selected' if r.status == s }}>{{ s }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
<button class="btn btn--ghost btn--sm" type="submit">Set</button>
|
|
</form>
|
|
<form method="post" action="{{ url_for('admin.demo_delete', req_id=r.id) }}" class="inline-form"
|
|
onsubmit="return confirm('Delete the request from {{ r.name }}?');">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
<button class="btn btn--danger btn--sm" type="submit">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% if pagination.pages > 1 %}
|
|
<nav class="pager">
|
|
{% if pagination.has_prev %}
|
|
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.demos', page=pagination.prev_num, status=status) }}">← Previous</a>
|
|
{% else %}
|
|
<span class="btn btn--ghost btn--sm is-disabled">← Previous</span>
|
|
{% endif %}
|
|
<span class="pager__info">Page {{ pagination.page }} of {{ pagination.pages }}</span>
|
|
{% if pagination.has_next %}
|
|
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.demos', page=pagination.next_num, status=status) }}">Next →</a>
|
|
{% else %}
|
|
<span class="btn btn--ghost btn--sm is-disabled">Next →</span>
|
|
{% endif %}
|
|
</nav>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<div class="empty">No demo requests{{ ' with this status' if status }}.</div>
|
|
{% endif %}
|
|
{% endblock %}
|