calathea/templates/components/event.html

37 lines
1.0 KiB
HTML

{% macro li(event) %}
<li>
<div class="event">
<b>{{ event.event_type }}</b>
<p>{{ event.date }}</p>
<p>{{ event.description }}</p>
</div>
</li>
{% endmacro li %}
{% macro list(events) %}
<div id="events">
<ul>
{% for event in events %}
{{ self::li(event=event) }}
{% endfor %}
</ul>
</div>
{% endmacro ul %}
{% macro form(plant_id, target="#events > ul") %}
<form hx-post="/events" hx-target="{{ target }}" hx-swap="beforeend">
<input type="hidden" id="plant_id" name="plant_id" value="{{ plant_id }}">
<label for="event_type">Type:</label>
<select id="event_type" name="event_type">
{% for type in event_types %}
<option value="{{ type }}">{{ type }}</option>
{% endfor %}
</select>
<label for="date">Date:</label>
<input type="date" id="date" name="date">
<label for="description">Description:</label>
<textarea id="description" name="description" rows=2></textarea></br>
<input type="submit">
</form>
{% endmacro form %}