Add shopping entry notes

This commit is contained in:
2026-04-26 13:18:14 +02:00
parent d3c58c5dd2
commit 1034ea72a8
5 changed files with 255 additions and 75 deletions
+39 -54
View File
@@ -10,68 +10,34 @@
</section>
<section class="panel compact-form-panel">
<div class="stack-sections">
<form method="post" class="shopping-add-form">
{{ csrf_input() }}
<label>
Lebensmittel suchen
<input
type="text"
name="item_search"
list="shopping-food-options"
placeholder="Nach Lebensmitteln suchen"
data-filter-input
data-filter-target="#shopping-add-list"
data-filter-limit="8"
autocomplete="off"
>
</label>
<div class="shopping-add-grid" id="shopping-add-list">
<label>
Einkaufshinweis
<input
type="text"
name="shopping_note"
maxlength="80"
placeholder="z. B. TK, Dose, frisch"
>
</label>
<datalist id="shopping-food-options">
{% for item in addable_items %}
{% set item_icon_class = {
'protein': 'icon-component-protein',
'carb': 'icon-component-carb',
'veg': 'icon-component-veg',
'fruit': 'icon-component-fruit',
'dairy': 'icon-component-dairy',
'nuts': 'icon-component-nuts',
'seeds': 'icon-component-seeds',
'neutral': 'icon-component-neutral',
}.get(item.primary_builder_key or item.base_type, 'icon-component-neutral') %}
<form method="post" data-filter-label="{{ item.name|lower }} {{ item.base_type_label|lower }} {{ item.for_label|lower }}">
{{ csrf_input() }}
<input type="hidden" name="item_id" value="{{ item.id }}">
<button class="shopping-add-card" type="submit">
<span class="shopping-add-card-visual">
{% if item.photo_filename %}
<img
src="{{ image_url(item.photo_filename, 'md') }}"
srcset="{{ image_srcset(item.photo_filename) }}"
sizes="{{ image_sizes('grid') }}"
alt=""
loading="lazy">
{% else %}
<span class="shopping-add-card-fallback">
<span class="ui-icon {{ item_icon_class }}"></span>
</span>
{% endif %}
</span>
<span class="shopping-add-card-copy">
<strong>{{ item.name }}</strong>
<small>
{% if item.is_archived %}
Archiviert
{% elif item.is_quick_added %}
Unsortiert
{% elif item.is_home %}
Zuhause · trotzdem ergänzen
{% else %}
Gerade nicht da
{% endif %}
</small>
</span>
</button>
</form>
{% else %}
<p class="shopping-add-empty muted">Gerade ist nichts zusätzlich offen.</p>
<option value="{{ item.name }}"></option>
{% endfor %}
</div>
</div>
</datalist>
<button type="submit">Auf die Liste</button>
</form>
</section>
{% if entries %}
@@ -119,6 +85,9 @@
</div>
<div class="shopping-entry-copy">
<strong>{{ entry.item_name }}</strong>
{% if entry.shopping_note %}
<p class="shopping-entry-note">{{ entry.shopping_note }}</p>
{% endif %}
{% if entry.needed_for_label %}
<p class="muted">
Für {{ entry.needed_for_label }}
@@ -153,7 +122,9 @@
<div>
<h3>{{ entry.item_name }}</h3>
<p>
{% if entry.needed_for_label %}
{% if entry.shopping_note %}
{{ entry.shopping_note }}
{% elif entry.needed_for_label %}
Für {{ entry.needed_for_label }}
{% if entry.needed_daypart_name %} · {{ entry.needed_daypart_name }}{% endif %}
{% elif entry.is_home %}
@@ -174,6 +145,20 @@
<button type="submit">Eingekauft</button>
</form>
{% if entry.can_edit %}
<form method="post" action="{{ url_for('main.shopping_update_note', entry_id=entry.id) }}">
{{ csrf_input() }}
<label>
Einkaufshinweis
<input
type="text"
name="shopping_note"
maxlength="80"
value="{{ entry.shopping_note }}"
placeholder="z. B. TK, Dose, frisch"
>
</label>
<button class="ghost-button" type="submit">Hinweis speichern</button>
</form>
<form method="post" action="{{ url_for('main.shopping_remove', entry_id=entry.id) }}">
{{ csrf_input() }}
<button class="ghost-button" type="submit">Von Einkaufsliste nehmen</button>