Files
sneakyklaus/src/templates/participant/dashboard.html
Phil Skentelbery c2b3641d74 feat: implement reminder preferences and withdrawal (Stories 6.3, 6.2)
Implement Phase 3 participant self-management features:

Story 6.3 - Reminder Preferences:
- Add ReminderPreferenceForm to participant forms
- Add update_preferences route for preference updates
- Update dashboard template with reminder preference toggle
- Participants can enable/disable reminder emails at any time

Story 6.2 - Withdrawal from Exchange:
- Add can_withdraw utility function for state validation
- Create WithdrawalService to handle withdrawal process
- Add WithdrawForm with explicit confirmation requirement
- Add withdraw route with GET (confirmation) and POST (process)
- Add withdrawal confirmation email template
- Update dashboard to show withdraw link when allowed
- Withdrawal only allowed before registration closes
- Session cleared after withdrawal, user redirected to registration

All acceptance criteria met for both stories.
Test coverage: 90.02% (156 tests passing)
Linting and type checking: passed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-22 21:18:18 -07:00

100 lines
2.9 KiB
HTML

{% extends "layouts/base.html" %}
{% block title %}{{ exchange.name }} - Participant Dashboard{% endblock %}
{% block content %}
<article>
<header>
<h1>{{ exchange.name }}</h1>
<p>Welcome, {{ participant.name }}!</p>
</header>
<section>
<h2>Exchange Details</h2>
<dl>
<dt>Budget</dt>
<dd>{{ exchange.budget }}</dd>
<dt>Gift Exchange Date</dt>
<dd>{{ exchange.exchange_date.strftime('%Y-%m-%d') }}</dd>
<dt>Registration Deadline</dt>
<dd>{{ exchange.registration_close_date.strftime('%Y-%m-%d') }}</dd>
</dl>
</section>
<section>
<h2>Your Information</h2>
<dl>
<dt>Name</dt>
<dd>{{ participant.name }}</dd>
<dt>Email</dt>
<dd>{{ participant.email }}</dd>
{% if participant.gift_ideas %}
<dt>Gift Ideas</dt>
<dd>{{ participant.gift_ideas }}</dd>
{% endif %}
</dl>
{% if can_edit_profile %}
<a href="{{ url_for('participant.profile_edit') }}">Edit Profile</a>
{% endif %}
</section>
<section>
<h2>Participants ({{ participant_count }})</h2>
{% if participants %}
<ul>
{% for p in participants %}
<li>
{{ p.name }}
{% if p.id == participant.id %}
<span class="badge">You</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p>No other participants yet. Share the registration link!</p>
{% endif %}
</section>
<section>
<h2>Email Reminders</h2>
<form method="POST" action="{{ url_for('participant.update_preferences') }}">
{{ reminder_form.hidden_tag() }}
<div>
{{ reminder_form.reminder_enabled() }}
{{ reminder_form.reminder_enabled.label }}
</div>
{% if reminder_form.reminder_enabled.description %}
<small>{{ reminder_form.reminder_enabled.description }}</small>
{% endif %}
<button type="submit">Update Preferences</button>
</form>
</section>
{% if can_withdraw %}
<section>
<h2>Withdraw from Exchange</h2>
<p>
If you can no longer participate, you can withdraw from this exchange.
This cannot be undone.
</p>
<a href="{{ url_for('participant.withdraw') }}" role="button" class="secondary">
Withdraw from Exchange
</a>
</section>
{% endif %}
<section>
<form method="POST" action="{{ url_for('participant.logout') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button type="submit">Logout</button>
</form>
</section>
</article>
{% endblock %}