food-tracker/templates/food.html

38 lines
1.4 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">
2025-10-24 23:08:23 +02:00
<!-- <sup>1</sup>&frasl;<sub>4</sub> Cup -->
2025-11-08 19:23:10 +01:00
{{ food.portion }} ({{ food.portion_weight }} g)
2025-10-20 14:34:24 +02:00
</p>
<p class="kc">
{{ food.kc_per_serving }} kc
</p>
</div>
<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-28 20:26:30 +01:00
{% if loop.index as i32 <= food.servings_eaten %}
<input type="button" hx-post="/set/{{ food.id }}/to/{{ loop.index as i32 - 1}}" hx-target="#card-{{ food.id }}" value="●" class="checked">
2025-10-24 17:17:08 +02:00
{% else %}
<input type="button" hx-post="/set/{{ food.id }}/to/{{ loop.index as i32 }}" hx-target="#card-{{ food.id }}" value="●" class="unchecked">
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-28 20:26:30 +01:00
{% if loop.index as i32 <= food.servings_eaten %}
<input type="button" hx-post="/set/{{ food.id }}/to/{{ loop.index as i32 - 1}}" hx-target="#card-{{ food.id }}" value="●" class="checked">
2025-10-24 17:17:08 +02:00
{% else %}
<input type="button" hx-post="/set/{{ food.id }}/to/{{ loop.index as i32 }}" hx-target="#card-{{ food.id }}" value="●" class="unchecked">
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>