96 lines
5.5 KiB
HTML
96 lines
5.5 KiB
HTML
{% extends "base.html" %}
|
|
{% block content %}
|
|
{% set schedule = card.schedule %}
|
|
<div class="page-head">
|
|
<div>
|
|
<p class="eyebrow"><a href="/admin/schedules">Schedules</a></p>
|
|
<h1>{{ schedule.name }}</h1>
|
|
<p class="muted">{{ card.kind_label }}{% if schedule.label_time %} · {{ schedule.label_time }}{% endif %}</p>
|
|
</div>
|
|
<form method="post" action="/admin/schedules/{{ schedule.id }}/settings" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<label class="check"><input type="checkbox" name="requires_manager_approval" {% if schedule.requires_manager_approval %}checked{% endif %}> Manager approval</label>
|
|
<label class="check"><input type="checkbox" name="is_active" {% if schedule.is_active %}checked{% endif %}> Active</label>
|
|
<button class="secondary" type="submit">Save</button>
|
|
</form>
|
|
</div>
|
|
<div class="stack gap-lg">
|
|
{% if card.kind == 'rotation' %}
|
|
<section class="panel">
|
|
<div class="row between wrap gap">
|
|
<div><h3>{{ month_name }} {{ year }}</h3><p class="muted">Prefilled from the rotation order below. Changing a date never rewrites other dates.</p></div>
|
|
<div class="month-nav">
|
|
<a class="button secondary" href="/admin/schedules/{{ schedule.id }}?year={{ prev[0] }}&month={{ prev[1] }}">← Previous</a>
|
|
<a class="button secondary" href="/admin/schedules/{{ schedule.id }}?year={{ nxt[0] }}&month={{ nxt[1] }}">Next →</a>
|
|
</div>
|
|
</div>
|
|
<form method="post" action="/admin/schedules/{{ schedule.id }}/assignments">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<input type="hidden" name="year" value="{{ year }}"><input type="hidden" name="month" value="{{ month }}">
|
|
<div class="table-wrap"><table><thead><tr><th>Date</th><th>Person</th><th>Source</th></tr></thead><tbody>
|
|
{% for assignment in assignments %}
|
|
<tr><td>{{ assignment.date.strftime('%a %d %b') }}</td><td><select name="assignment_{{ assignment.id }}"><option value="">Unassigned</option>{% for person in users %}<option value="{{ person.id }}" {% if assignment.user_id == person.id %}selected{% endif %}>{{ person.name }}</option>{% endfor %}</select></td><td><span class="badge">{{ assignment.source }}</span></td></tr>
|
|
{% endfor %}
|
|
</tbody></table></div>
|
|
<div class="sticky-actions"><button class="primary" type="submit">Save {{ month_name }}</button></div>
|
|
</form>
|
|
</section>
|
|
<section class="panel">
|
|
<h3>Next dates</h3>
|
|
<p class="date-list">{{ card.dates | join(' · ') }}</p>
|
|
</section>
|
|
<section class="panel">
|
|
<h3>Rotation order</h3>
|
|
<p class="muted">Independent rotation, filled in order. Reordering never rewrites assignments that already exist.</p>
|
|
<ol class="rotation-list">
|
|
{% for member in schedule.rotation_members %}
|
|
<li>
|
|
<span>{{ member.user.name }}</span>
|
|
<div class="actions compact">
|
|
<form method="post" action="/admin/rotation/{{ member.id }}/move"><input type="hidden" name="csrf_token" value="{{ csrf_token }}"><input type="hidden" name="direction" value="up"><button class="secondary small" type="submit">↑</button></form>
|
|
<form method="post" action="/admin/rotation/{{ member.id }}/move"><input type="hidden" name="csrf_token" value="{{ csrf_token }}"><input type="hidden" name="direction" value="down"><button class="secondary small" type="submit">↓</button></form>
|
|
<form method="post" action="/admin/rotation/{{ member.id }}/remove"><input type="hidden" name="csrf_token" value="{{ csrf_token }}"><button class="danger small" type="submit">Remove</button></form>
|
|
</div>
|
|
</li>
|
|
{% else %}<li class="muted">No members yet.</li>{% endfor %}
|
|
</ol>
|
|
<form method="post" action="/admin/schedules/{{ schedule.id }}/rotation" class="inline-form">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<select name="user_id" required><option value="">Add person…</option>{% for person in users %}<option value="{{ person.id }}">{{ person.name }}</option>{% endfor %}</select>
|
|
<button class="primary" type="submit">Add to rotation</button>
|
|
</form>
|
|
</section>
|
|
{% else %}
|
|
<section class="panel">
|
|
<h3>Repeating every month</h3>
|
|
<p class="muted">One person for each day of the month, the same every month. Days 29 to 31 only apply to months that have them. Saving fills the nights that nobody has been given yet; nights already assigned keep their person.</p>
|
|
<form method="post" action="/admin/schedules/{{ schedule.id }}/pattern">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
|
|
<div class="pattern-grid">
|
|
{% for day in pattern_days %}
|
|
<label class="pattern-day"><span>{{ day }}</span>
|
|
<select name="day_{{ day }}">
|
|
<option value="">—</option>
|
|
{% for person in users %}<option value="{{ person.id }}" {% if pattern.get(day) == person.id %}selected{% endif %}>{{ person.name }}</option>{% endfor %}
|
|
</select>
|
|
</label>
|
|
{% endfor %}
|
|
</div>
|
|
<div class="sticky-actions"><button class="primary" type="submit">Save pattern</button></div>
|
|
</form>
|
|
</section>
|
|
{% endif %}
|
|
{% if cards | length > 1 %}
|
|
<section class="panel">
|
|
<h3>Other schedules</h3>
|
|
<ul class="link-list">
|
|
{% for other in cards %}
|
|
{% if other.schedule.id != schedule.id %}
|
|
<li><a href="/admin/schedules/{{ other.schedule.id }}">{{ other.schedule.name }}</a> <span class="muted">{{ other.kind_label }}</span></li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</ul>
|
|
</section>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %} |