feat: added event form & POST route
This commit is contained in:
parent
3add93bdb2
commit
adef5c1fd5
13 changed files with 123 additions and 16 deletions
26
src/templates/macros/event.html
Normal file
26
src/templates/macros/event.html
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{% 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 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 %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue