food-tracker/templates/food.html

41 lines
1.2 KiB
HTML
Raw Normal View History

2025-10-24 17:46:19 +02:00
<div class="card" id="card-{{ food.id }}">
2025-10-20 14:34:24 +02:00
<p class="food-name">
{{ food.name }}
</p>
<div class="card-inner">
<div class="amounts">
<p class="unit">
<sup>1</sup>&frasl;<sub>4</sub> Cup
</p>
<p class="kc">
{{ food.kc_per_serving }} kc
</p>
</div>
<div class="buttons">
2025-10-24 17:46:19 +02:00
<button class="increase" hx-post="/increase/{{ food.id }}" hx-target="#card-{{ food.id }}">+</button>
<button class="decrease" hx-post="/decrease/{{ food.id }}" hx-target="#card-{{ food.id }}">-</button>
2025-10-19 13:55:13 +02:00
</div>
2025-10-20 14:34:24 +02:00
<div class="checkboxes">
2025-10-24 17:17:08 +02:00
{% for counter in self::range(10) %}
{% if loop.index as i32 <= food.target_servings %}
2025-10-20 14:34:24 +02:00
<label class="ok">
2025-10-24 17:17:08 +02:00
{% if loop.index as i32 <= food.actual_servings %}
2025-10-20 14:34:24 +02:00
<input type="checkbox" checked>
2025-10-24 17:17:08 +02:00
{% else %}
2025-10-20 14:34:24 +02:00
<input type="checkbox">
2025-10-24 17:17:08 +02:00
{% endif %}
2025-10-20 14:34:24 +02:00
</label>
2025-10-24 17:17:08 +02:00
{% else %}
2025-10-20 14:34:24 +02:00
<label class="bad">
2025-10-24 17:17:08 +02:00
{% if loop.index as i32 <= food.actual_servings %}
2025-10-20 14:34:24 +02:00
<input type="checkbox" checked>
2025-10-24 17:17:08 +02:00
{% else %}
2025-10-20 14:34:24 +02:00
<input type="checkbox">
2025-10-24 17:17:08 +02:00
{% endif %}
2025-10-20 14:34:24 +02:00
</label>
2025-10-24 17:17:08 +02:00
{% endif %}
{% endfor %}
2025-10-20 14:34:24 +02:00
</div>
</div>
2025-10-24 17:17:08 +02:00
</div>