food-tracker/templates/food.html

28 lines
No EOL
993 B
HTML

<div style="border: 1px solid black; margin: 1em; padding: 1em;" id="food-{{ food.id }}">
<div style="text-align: center;">
<p>
<b>{{ food.name }}</b>
</p>
{{ food.portion }} ({{ food.kc_per_serving }} kc.)
<br>
<progress max="{{food.target_servings}}" value="{{food.actual_servings}}" {% if food.actual_servings>
food.target_servings %}
style="accent-color: red;"
{% endif %}>
</progress>
{{ food.actual_servings }}/{{ food.target_servings }}
</div>
<br>
<form method="post">
<div style="text-align: center;">
<button hx-post="/decrease/{{ food.id }}" hx-target="#food-{{ food.id }}" hx-swap="outerHTML"
style="width: 40%; height: 3em;" {% if food.actual_servings <=0 %} disabled {% endif %}>
-
</button>
<button hx-post="/increase/{{ food.id }}" hx-target="#food-{{ food.id }}" hx-swap="outerHTML"
style="width: 40%; height: 3em;">
+
</button>
</div>
</form>
</div>