brewlog/templates/partials/bag_card.html
Jon Seager 4a7b054de1
feat(brews): pre-select bag when clicking Brew on homepage bag card
- Add initial-value attribute to searchable-select web component
- Update bag card Brew link to pass bag_id query parameter to add page
- Thread bag_id through route handler and template to pre-select the bag
2026-02-06 10:53:42 +00:00

29 lines
1.1 KiB
HTML

{% import "partials/icons.html" as icons %}
{% macro card(bag, is_authenticated) %}
<div id="bag-card-{{ bag.id }}" class="rounded-lg border bg-surface p-4">
<div class="min-w-0">
<span class="block truncate font-semibold text-text">{{ bag.roast_name }}</span>
<p class="truncate text-sm text-text-muted">{{ bag.roaster_name }}</p>
</div>
<p class="mt-2 truncate text-sm text-text-secondary">
<span class="font-medium">{{ bag.remaining }}g</span>
<span class="text-text-muted">of {{ bag.amount }}g remaining</span>
</p>
{% if is_authenticated %}
<div class="mt-3 pt-3 border-t flex gap-3">
<a href="/add?type=brew&bag_id={{ bag.id }}" class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover">
{% call icons::plus_circle("h-4 w-4") %}
Brew
</a>
<button
type="button"
class="inline-flex items-center gap-1 text-sm font-medium text-text-muted hover:text-text"
onclick="closeBag('{{ bag.id }}', document.getElementById('bag-card-{{ bag.id }}'))"
>
{% call icons::x_circle("h-4 w-4") %}
Close
</button>
</div>
{% endif %}
</div>
{% endmacro %}