57 lines
2.7 KiB
HTML
57 lines
2.7 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
<div class="page-head">
|
|
<div><h1>Change requests</h1><p class="muted">People can volunteer for an open assignment or accept a request sent directly to them.</p></div>
|
|
</div>
|
|
|
|
<div class="stack gap-lg">
|
|
{% for swap in swaps %}
|
|
<article class="panel">
|
|
<div class="row between wrap gap">
|
|
<div>
|
|
<div class="eyebrow">{{ swap.assignment.date.strftime('%A, %d %B %Y') }}</div>
|
|
<h2>{{ swap.assignment.schedule.name }}</h2>
|
|
<p><strong>{{ swap.requester.name }}</strong> requested a change{% if swap.target_user %} with <strong>{{ swap.target_user.name }}</strong>{% else %} and opened it to anyone{% endif %}.</p>
|
|
{% if swap.message %}<p class="quote">{{ swap.message }}</p>{% endif %}
|
|
{% if swap.accepted_by %}<p>Accepted by <strong>{{ swap.accepted_by.name }}</strong>.</p>{% endif %}
|
|
</div>
|
|
<span class="status status-{{ swap.status }}">{{ swap.status.replace('_', ' ') }}</span>
|
|
</div>
|
|
|
|
<div class="actions">
|
|
{% if swap.status == 'open' and swap.requester_id != current_user.id and (swap.target_user_id is none or swap.target_user_id == current_user.id) %}
|
|
<form method="post" action="/swaps/{{ swap.id }}/accept">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button class="primary" type="submit">Accept assignment</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if swap.status == 'open' and swap.target_user_id == current_user.id %}
|
|
<form method="post" action="/swaps/{{ swap.id }}/reject">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button class="secondary" type="submit">Decline</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if swap.requester_id == current_user.id and swap.status in ['open', 'pending_approval'] %}
|
|
<form method="post" action="/swaps/{{ swap.id }}/cancel">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button class="secondary" type="submit">Cancel request</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if current_user.is_admin and swap.status == 'pending_approval' %}
|
|
<form method="post" action="/swaps/{{ swap.id }}/approve">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button class="primary" type="submit">Approve</button>
|
|
</form>
|
|
<form method="post" action="/swaps/{{ swap.id }}/admin-reject">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<button class="danger" type="submit">Reject</button>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</article>
|
|
{% else %}
|
|
<div class="empty">No change requests yet.</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endblock %}
|