49 lines
2.4 KiB
HTML
49 lines
2.4 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Edit {{ ev.kind.label }}{% endblock %}
|
|
{% block content %}
|
|
<p><a href="/log?before={{ f.local(ev.started_at).date().isoformat() }}" class="small">← Back to the log</a></p>
|
|
|
|
<section class="card">
|
|
<h1><span class="emoji" aria-hidden="true">{{ ev.kind.emoji }}</span> {{ ev.kind.label }}</h1>
|
|
<p class="muted small">
|
|
{% if ev.source == 'device' %}From the Mamadachi (button {{ ev.button }}){% else %}Added on the website{% endif %}
|
|
· recorded {{ f.when(ev.created_at) }}
|
|
{% if ev.clock_corrected %}<br>⏱ The device's clock was off when this was uploaded, so its time was corrected.{% endif %}
|
|
{% if ev.deleted_at %}<br><strong>Deleted {{ f.when(ev.deleted_at) }}.</strong>{% endif %}
|
|
</p>
|
|
|
|
<form method="post" action="/events/{{ ev.id }}" class="form-grid" data-kind-form>
|
|
<label>Type
|
|
<select name="kind">
|
|
{% for k in kinds %}
|
|
<option value="{{ k.slug }}" data-duration="{{ 1 if k.is_duration else 0 }}" {% if k.slug == ev.kind_slug %}selected{% endif %}>{{ k.emoji }} {{ k.label }}{% if not k.active %} (hidden){% endif %}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</label>
|
|
<label>Start
|
|
<input type="datetime-local" name="started_at" value="{{ f.input_value(ev.started_at) }}" required>
|
|
</label>
|
|
<label data-end-field {% if not ev.kind.is_duration %}hidden{% endif %}><span>End <span class="muted">(empty = still going)</span></span>
|
|
<input type="datetime-local" name="ended_at" value="{{ f.input_value(ev.ended_at) }}">
|
|
</label>
|
|
<label class="span-2">Note
|
|
<input type="text" name="note" maxlength="2000" value="{{ ev.note or '' }}">
|
|
</label>
|
|
<div class="span-2 actions">
|
|
<button class="btn">Save</button>
|
|
</div>
|
|
</form>
|
|
</section>
|
|
|
|
<div class="actions">
|
|
{% if ev.is_open %}
|
|
<form method="post" action="/events/{{ ev.id }}/end"><input type="hidden" name="next" value="/events/{{ ev.id }}"><button class="btn btn-ghost">End now</button></form>
|
|
{% endif %}
|
|
{% if ev.deleted_at %}
|
|
<form method="post" action="/events/{{ ev.id }}/restore"><button class="btn btn-ghost">Restore</button></form>
|
|
{% else %}
|
|
<form method="post" action="/events/{{ ev.id }}/delete" data-confirm="Delete this {{ ev.kind.label | lower }}? You can undo it right after."><button class="btn btn-danger">Delete</button></form>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|