feat: implement exchange creation
Add Exchange model, API endpoint, and form validation for creating new gift exchanges. - Create ExchangeForm with timezone validation - Add admin routes for creating and viewing exchanges - Generate unique 12-char slug for each exchange - Validate registration/exchange dates - Display exchanges in dashboard - All tests passing with 92% coverage Story: 2.1
This commit is contained in:
@@ -12,8 +12,56 @@
|
||||
</form>
|
||||
</header>
|
||||
|
||||
<p>Welcome to the Sneaky Klaus admin dashboard!</p>
|
||||
<div class="dashboard-summary">
|
||||
<div class="grid">
|
||||
<div>
|
||||
<h3>Draft</h3>
|
||||
<p><strong>{{ draft_count }}</strong></p>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Active</h3>
|
||||
<p><strong>{{ active_count }}</strong></p>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Completed</h3>
|
||||
<p><strong>{{ completed_count }}</strong></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>This is a placeholder for the admin dashboard. More features coming soon.</p>
|
||||
<div style="margin: 2rem 0;">
|
||||
<a href="{{ url_for('admin.create_exchange') }}" role="button">Create New Exchange</a>
|
||||
</div>
|
||||
|
||||
<h2>All Exchanges</h2>
|
||||
|
||||
{% if exchanges %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>State</th>
|
||||
<th>Participants</th>
|
||||
<th>Exchange Date</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for exchange in exchanges %}
|
||||
<tr>
|
||||
<td>{{ exchange.name }}</td>
|
||||
<td><mark>{{ exchange.state }}</mark></td>
|
||||
<td>0 / {{ exchange.max_participants }}</td>
|
||||
<td>{{ exchange.exchange_date.strftime('%Y-%m-%d') }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('admin.view_exchange', exchange_id=exchange.id) }}">View</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>No exchanges yet. <a href="{{ url_for('admin.create_exchange') }}">Create your first exchange</a>!</p>
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user